Update re_unit.py

This commit is contained in:
zainab2097 2024-08-28 17:10:26 +03:00 committed by GitHub
parent 2660cb52a0
commit 75c6814bb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 5 deletions

View File

@ -90,13 +90,10 @@ class Unit(models.Model):
action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
action['domain'] = str([('res_model', '=', 're.unit'),('res_id', 'in', self.ids)])
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
return action
def get_attachments(self):
res = super(Unit, self).get_attachments()
domain = [('res_model', '=', 're.unit'), ('res_id', '=', self.id)]
self.attach_nbr = self.env['ir.attachment'].search_count(domain)
return res
return action
def _compute_maintenance_count(self):
for record in self:
record.maintenance_count = self.env['property.management.maintenance'].search_count([