Update internal_property.py
This commit is contained in:
parent
7f2e3bd432
commit
87bfae6a14
|
|
@ -30,6 +30,29 @@ class Property(models.Model):
|
|||
('residential', 'Residential'),
|
||||
('non_residential', 'Non-Residential'),
|
||||
], string="Property Suitability for Residence")
|
||||
contract_counts = fields.Integer(string='Contracts', compute='count_contracts_number')
|
||||
def count_contracts_number(self):
|
||||
contract_count = self.env['rental.contract'].search([('property_id', '=', self.id)])
|
||||
self.contract_counts = len(contract_count)
|
||||
|
||||
def get_contract(self):
|
||||
contract_id = self.env['rental.contract'].search(
|
||||
[('property_id', '=', self.id)])
|
||||
form_id = self.env.ref('property_management.rental_contract_form_view').id
|
||||
list_id = self.env.ref('property_management.rental_contract_list_view').id
|
||||
domain = [('id', 'in', contract_id.ids)]
|
||||
return {
|
||||
'name': _('Rental Contract'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'rental.contract',
|
||||
'views': [(list_id, 'tree'), (form_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'current',
|
||||
'domain': domain,
|
||||
}
|
||||
|
||||
|
||||
|
||||
# @api.model
|
||||
# def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
|
||||
|
|
|
|||
Loading…
Reference in New Issue