summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-05-18 11:09:37 +0200
committerNicolas Martinelli <nim@odoo.com>2017-05-18 11:11:37 +0200
commit4cbbbaddd5735c8f91c2ccecc33f9e2d4dc6af61 (patch)
treebf5315f07f59e94c1be8454551c801d67a2f0247
parent64eb5ce48ea53987d00075d43f2ec93bfe4d4ba4 (diff)
[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
-rw-r--r--addons/account/models/account_invoice.py2
-rw-r--r--addons/account/wizard/account_invoice_refund.py5
2 files changed, 3 insertions, 4 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index 81540697766..6c8c160aaba 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -1019,7 +1019,7 @@ class AccountInvoice(models.Model):
:return: dict of value to create() the refund
"""
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']:
if invoice._fields[field].type == 'many2one':
values[field] = invoice[field].id
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index bb30c799611..729d2bd325d 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -79,8 +79,7 @@ class AccountInvoiceRefund(models.TransientModel):
invoice = inv.read(
['name', 'type', 'number', 'reference',
'comment', 'date_due', 'partner_id',
- 'partner_insite', 'partner_contact',
- 'partner_ref', 'payment_term_id', 'account_id',
+ 'payment_term_id', 'account_id', 'team_id',
'currency_id', 'invoice_line_ids', 'tax_line_ids',
'journal_id', 'date'])
invoice = invoice[0]
@@ -101,7 +100,7 @@ class AccountInvoiceRefund(models.TransientModel):
'fiscal_position_id': inv.fiscal_position_id.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]
inv_refund = inv_obj.create(invoice)
if inv_refund.payment_term_id.id: