[UPDATE]UPDATE invoice from maintenance
This commit is contained in:
parent
122b3c6cdf
commit
274cf6693e
|
|
@ -220,6 +220,15 @@ class PropertyManagementMaintenance(models.Model):
|
|||
origin = _(
|
||||
'Maintenance Order') + ' ' + maintenance.name + ' ' + maintenance.partner_id.name if maintenance.partner_id else \
|
||||
_('Maintenance Order') + ' ' + maintenance.name + ' ' + maintenance.vendor_id.name
|
||||
line_data = []
|
||||
for line in maintenance.end_line_ids:
|
||||
line_data.append((0, 0, {
|
||||
'product_id': line.product_id.id,
|
||||
'name': origin + ' - ' + str(maintenance.date),
|
||||
'account_id': line.product_id.property_account_expense_id.id,
|
||||
'quantity': line.qty,
|
||||
'price_unit': line.cost,
|
||||
}))
|
||||
invoice_vals = {
|
||||
'ref': maintenance.name,
|
||||
'move_type': 'in_invoice',
|
||||
|
|
@ -228,12 +237,7 @@ class PropertyManagementMaintenance(models.Model):
|
|||
'invoice_date': maintenance.date,
|
||||
'narration': maintenance.note,
|
||||
'partner_id': maintenance.partner_id.id if maintenance.partner_id else maintenance.vendor_id.id,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'name': origin + ' - ' + str(maintenance.date),
|
||||
'price_unit': amount,
|
||||
'quantity': 1.0,
|
||||
|
||||
})],
|
||||
'invoice_line_ids': line_data
|
||||
}
|
||||
return invoice_vals
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue