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 d7e373a79b
commit 6ff4a57e93
5 files changed
+40

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Add with agent option to credit invoice
* Add employee on agent selection
Version 5.6.0 - 2020-05-04
+2
View File
@@ -20,6 +20,7 @@ def register():
commission.CreateInvoiceAsk,
invoice.Invoice,
invoice.InvoiceLine,
invoice.CreditInvoiceStart,
product.Template,
product.Template_Agent,
product.Product,
@@ -33,6 +34,7 @@ def register():
depends=['sale'])
Pool.register(
commission.CreateInvoice,
invoice.CreditInvoice,
party.Replace,
party.Erase,
module='commission', type_='wizard')
+22
View File
@@ -198,3 +198,25 @@ class InvoiceLine(metaclass=PoolMeta):
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
+6
View File
@@ -65,5 +65,11 @@ this repository contains the full copyright notices and license terms. -->
<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>
@@ -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>