changeset 638450d4fca5 in modules/commission:default
details:
https://hg.tryton.org/modules/commission?cmd=changeset;node=638450d4fca5
description:
Add with agent option to credit invoice
We do not always want to keep the agent on the credit note.
issue9407
review301791002
diffstat:
CHANGELOG | 1 +
__init__.py | 2 ++
invoice.py | 22 ++++++++++++++++++++++
invoice.xml | 6 ++++++
view/account_invoice_credit_start_form.xml | 9 +++++++++
5 files changed, 40 insertions(+), 0 deletions(-)
diffs (84 lines):
diff -r 296f763a9477 -r 638450d4fca5 CHANGELOG
--- a/CHANGELOG Sun Jun 07 12:24:55 2020 +0200
+++ b/CHANGELOG Wed Jun 24 23:00:48 2020 +0200
@@ -1,3 +1,4 @@
+* Add with agent option to credit invoice
* Add employee on agent selection
Version 5.6.0 - 2020-05-04
diff -r 296f763a9477 -r 638450d4fca5 __init__.py
--- a/__init__.py Sun Jun 07 12:24:55 2020 +0200
+++ b/__init__.py Wed Jun 24 23:00:48 2020 +0200
@@ -20,6 +20,7 @@
commission.CreateInvoiceAsk,
invoice.Invoice,
invoice.InvoiceLine,
+ invoice.CreditInvoiceStart,
product.Template,
product.Template_Agent,
product.Product,
@@ -33,6 +34,7 @@
depends=['sale'])
Pool.register(
commission.CreateInvoice,
+ invoice.CreditInvoice,
party.Replace,
party.Erase,
module='commission', type_='wizard')
diff -r 296f763a9477 -r 638450d4fca5 invoice.py
--- a/invoice.py Sun Jun 07 12:24:55 2020 +0200
+++ b/invoice.py Wed Jun 24 23:00:48 2020 +0200
@@ -198,3 +198,25 @@
default.setdefault('commissions', None)
default.setdefault('from_commissions', None)
return super(InvoiceLine, cls).copy(lines, default=default)
+
+
+class CreditInvoiceStart(metaclass=PoolMeta):
+ __name__ = 'account.invoice.credit.start'
+ with_agent = fields.Boolean(
+ "With Agent",
+ help="Check to keep the original invoice's agent.")
+
+ @classmethod
+ def default_with_agent(cls):
+ return True
+
+
+class CreditInvoice(metaclass=PoolMeta):
+ __name__ = 'account.invoice.credit'
+
+ @property
+ def _credit_options(self):
+ options = super()._credit_options
+ if not self.start.with_agent:
+ options['agent'] = None
+ return options
diff -r 296f763a9477 -r 638450d4fca5 invoice.xml
--- a/invoice.xml Sun Jun 07 12:24:55 2020 +0200
+++ b/invoice.xml Wed Jun 24 23:00:48 2020 +0200
@@ -65,5 +65,11 @@
<field name="action" ref="act_commission_from_relate"/>
</record>
+ <record model="ir.ui.view" id="account_invoice_credit_start_view_form">
+ <field name="model">account.invoice.credit.start</field>
+ <field name="inherit"
ref="account_invoice.credit_start_view_form"/>
+ <field name="name">account_invoice_credit_start_form</field>
+ </record>
+
</data>
</tryton>
diff -r 296f763a9477 -r 638450d4fca5 view/account_invoice_credit_start_form.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/view/account_invoice_credit_start_form.xml Wed Jun 24 23:00:48
2020 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<data>
+ <xpath expr="//field[@name='with_refund']" position="after">
+ <label name="with_agent"/>
+ <field name="with_agent"/>
+ </xpath>
+</data>