[FIX] account: Sales team on refund
When doing a refund of an invoice, the sales team is not kept. At the same time, remove fields which don't exist anymore. opw-743093
This commit is contained in:
@@ -1019,7 +1019,7 @@ class AccountInvoice(models.Model):
|
|||||||
:return: dict of value to create() the refund
|
:return: dict of value to create() the refund
|
||||||
"""
|
"""
|
||||||
values = {}
|
values = {}
|
||||||
for field in ['name', 'reference', 'comment', 'date_due', 'partner_id', 'company_id',
|
for field in ['name', 'reference', 'comment', 'date_due', 'partner_id', 'company_id', 'team_id',
|
||||||
'account_id', 'currency_id', 'payment_term_id', 'user_id', 'fiscal_position_id']:
|
'account_id', 'currency_id', 'payment_term_id', 'user_id', 'fiscal_position_id']:
|
||||||
if invoice._fields[field].type == 'many2one':
|
if invoice._fields[field].type == 'many2one':
|
||||||
values[field] = invoice[field].id
|
values[field] = invoice[field].id
|
||||||
|
|||||||
@@ -79,8 +79,7 @@ class AccountInvoiceRefund(models.TransientModel):
|
|||||||
invoice = inv.read(
|
invoice = inv.read(
|
||||||
['name', 'type', 'number', 'reference',
|
['name', 'type', 'number', 'reference',
|
||||||
'comment', 'date_due', 'partner_id',
|
'comment', 'date_due', 'partner_id',
|
||||||
'partner_insite', 'partner_contact',
|
'payment_term_id', 'account_id', 'team_id',
|
||||||
'partner_ref', 'payment_term_id', 'account_id',
|
|
||||||
'currency_id', 'invoice_line_ids', 'tax_line_ids',
|
'currency_id', 'invoice_line_ids', 'tax_line_ids',
|
||||||
'journal_id', 'date'])
|
'journal_id', 'date'])
|
||||||
invoice = invoice[0]
|
invoice = invoice[0]
|
||||||
@@ -101,7 +100,7 @@ class AccountInvoiceRefund(models.TransientModel):
|
|||||||
'fiscal_position_id': inv.fiscal_position_id.id,
|
'fiscal_position_id': inv.fiscal_position_id.id,
|
||||||
})
|
})
|
||||||
for field in ('partner_id', 'account_id', 'currency_id',
|
for field in ('partner_id', 'account_id', 'currency_id',
|
||||||
'payment_term_id', 'journal_id'):
|
'payment_term_id', 'journal_id', 'team_id'):
|
||||||
invoice[field] = invoice[field] and invoice[field][0]
|
invoice[field] = invoice[field] and invoice[field][0]
|
||||||
inv_refund = inv_obj.create(invoice)
|
inv_refund = inv_obj.create(invoice)
|
||||||
if inv_refund.payment_term_id.id:
|
if inv_refund.payment_term_id.id:
|
||||||
|
|||||||
Reference in New Issue
Block a user