Add with agent option to credit invoice

We do not always want to keep the agent on the credit note.

issue9407
review301791002
This commit is contained in:
Cédric Krier committed 2020-06-24 23:00:48 +02:00
1 parent 3aaa057c90
commit 987cd0dd9e
1 file changed
+8 -4
+8 -4
View File
@@ -2914,16 +2914,20 @@ class CreditInvoice(Wizard):
default['with_refund'] = False
return default
@property
def _credit_options(self):
return dict(
refund=self.start.with_refund,
invoice_date=self.start.invoice_date,
)
def do_credit(self, action):
pool = Pool()
Invoice = pool.get('account.invoice')
refund = self.start.with_refund
invoice_date = self.start.invoice_date
invoices = Invoice.browse(Transaction().context['active_ids'])
credit_invoices = Invoice.credit(
invoices, refund=refund, invoice_date=invoice_date)
credit_invoices = Invoice.credit(invoices, **self._credit_options)
data = {'res_id': [i.id for i in credit_invoices]}
if len(credit_invoices) == 1: