commit
0b720fad5e
|
|
@ -325,13 +325,13 @@ class RentalContract(models.Model):
|
|||
|
||||
def action_confirm(self):
|
||||
invoice_vals = self._prepare_invoice_values(self, self.insurance_amount)
|
||||
invoice = self.env['account.move'].sudo().create(invoice_vals).with_user(self.env.uid)
|
||||
# Get the ID of the second line
|
||||
line_id = invoice.invoice_line_ids[1].id
|
||||
commands = [(2, line_id, 0)]
|
||||
invoice.write({'invoice_line_ids': commands})
|
||||
|
||||
self.insurance_invoice_id = invoice.id
|
||||
if self.insurance_amount>0.00 or self.insurance_cost>0.00:
|
||||
invoice = self.env['account.move'].sudo().create(invoice_vals).with_user(self.env.uid)
|
||||
# Get the ID of the second line
|
||||
line_id = invoice.invoice_line_ids[1].id
|
||||
commands = [(2, line_id, 0)]
|
||||
invoice.write({'invoice_line_ids': commands})
|
||||
self.insurance_invoice_id = invoice.id
|
||||
if self.rent_method != 'property':
|
||||
for unit in self.unit_ids:
|
||||
unit.write({'state': 'rented',
|
||||
|
|
|
|||
|
|
@ -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([
|
||||
|
|
|
|||
Loading…
Reference in New Issue