[FIX] sale: keep all client ref
During batch invoicing, the client reference kept is only the reference of the first invoice. opw-673188
This commit is contained in:
+7
-3
@@ -241,7 +241,6 @@ class SaleOrder(models.Model):
|
|||||||
'name': self.client_order_ref or '',
|
'name': self.client_order_ref or '',
|
||||||
'origin': self.name,
|
'origin': self.name,
|
||||||
'type': 'out_invoice',
|
'type': 'out_invoice',
|
||||||
'reference': self.client_order_ref or self.name,
|
|
||||||
'account_id': self.partner_invoice_id.property_account_receivable_id.id,
|
'account_id': self.partner_invoice_id.property_account_receivable_id.id,
|
||||||
'partner_id': self.partner_invoice_id.id,
|
'partner_id': self.partner_invoice_id.id,
|
||||||
'journal_id': journal_id,
|
'journal_id': journal_id,
|
||||||
@@ -308,8 +307,13 @@ class SaleOrder(models.Model):
|
|||||||
inv_data = order._prepare_invoice()
|
inv_data = order._prepare_invoice()
|
||||||
invoice = inv_obj.create(inv_data)
|
invoice = inv_obj.create(inv_data)
|
||||||
invoices[group_key] = invoice
|
invoices[group_key] = invoice
|
||||||
elif group_key in invoices and order.name not in invoices[group_key].origin.split(', '):
|
elif group_key in invoices:
|
||||||
invoices[group_key].write({'origin': invoices[group_key].origin + ', ' + order.name})
|
vals = {}
|
||||||
|
if order.name not in invoices[group_key].origin.split(', '):
|
||||||
|
vals['origin'] = invoices[group_key].origin + ', ' + order.name
|
||||||
|
if order.client_order_ref and order.client_order_ref not in invoices[group_key].name.split(', '):
|
||||||
|
vals['name'] = invoices[group_key].name + ', ' + order.client_order_ref
|
||||||
|
invoices[group_key].write(vals)
|
||||||
if line.qty_to_invoice > 0:
|
if line.qty_to_invoice > 0:
|
||||||
line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice)
|
line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice)
|
||||||
elif line.qty_to_invoice < 0 and final:
|
elif line.qty_to_invoice < 0 and final:
|
||||||
|
|||||||
Reference in New Issue
Block a user