changeset 2c9a2d56f3ab in modules/account_invoice:default
details:
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=2c9a2d56f3ab
description:
Add with agent option to credit invoice
We do not always want to keep the agent on the credit note.
issue9407
review301791002
diffstat:
invoice.py | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (28 lines):
diff -r c9b8fe3441a0 -r 2c9a2d56f3ab invoice.py
--- a/invoice.py Sun Jun 07 09:35:40 2020 +0100
+++ b/invoice.py Wed Jun 24 23:00:48 2020 +0200
@@ -2914,16 +2914,20 @@
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: