Allow creating commission invoices for specific agents

issue10817
review373681002
This commit is contained in:
David Blanco Bautista
2021-10-09 00:38:28 +02:00
parent d259cb97d5
commit 2f2300cbbd
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Allow creating commission invoices for specific agents
* Add reporting
Version 6.0.0 - 2021-05-03
+14
View File
@@ -560,6 +560,9 @@ class CreateInvoice(Wizard):
domain.append(('agent.type_', '=', 'principal'))
elif self.ask.type_ == 'out':
domain.append(('agent.type_', '=', 'agent'))
if self.ask.agents:
agents = [agent.id for agent in self.ask.agents]
domain.append(('agent', 'in', agents))
return domain
def do_create_(self, action):
@@ -597,6 +600,17 @@ class CreateInvoiceAsk(ModelView):
('both', 'Both'),
], 'Type',
help="Limit to commissions of this type.")
agents = fields.Many2Many(
'commission.agent', None, None, "Agents",
domain=[
If(Eval('type_') == 'in',
('type_', '=', 'principal'), ()),
If(Eval('type_') == 'out',
('type_', '=', 'agent'), ()),
],
depends=['type_'],
help="Limit to commissions for these agents.\n"
"If empty all agents of the selected type are used.")
@staticmethod
def default_type_():
@@ -8,4 +8,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="to"/>
<label name="type_"/>
<field name="type_"/>
<field name="agents" colspan="4"/>
</form>