diff --git a/account_commission/__manifest__.py b/account_commission/__manifest__.py index c87663d62..bc18a4a60 100644 --- a/account_commission/__manifest__.py +++ b/account_commission/__manifest__.py @@ -3,7 +3,7 @@ # Copyright 2014-2022 Tecnativa - Pedro M. Baeza { "name": "Account commissions", - "version": "15.0.2.1.0", + "version": "15.0.2.1.1", "author": "Tecnativa, Odoo Community Association (OCA)", "category": "Sales Management", "license": "AGPL-3", diff --git a/account_commission/models/account_move.py b/account_commission/models/account_move.py index 019fe622f..526b71795 100644 --- a/account_commission/models/account_move.py +++ b/account_commission/models/account_move.py @@ -199,6 +199,7 @@ class AccountInvoiceLineAgent(models.Model): currency_id = fields.Many2one( related="object_id.currency_id", readonly=True, + store=True, ) @api.depends( diff --git a/account_commission/models/commission_settlement.py b/account_commission/models/commission_settlement.py index 1f36422e0..a8772f989 100644 --- a/account_commission/models/commission_settlement.py +++ b/account_commission/models/commission_settlement.py @@ -78,6 +78,9 @@ def action_invoice(self): def _get_invoice_partner(self): return self[0].agent_id + def _get_invoice_currency(self): + return self[0].currency_id + def _prepare_invoice(self, journal, product, date=False): move_form = Form( self.env["account.move"].with_context(default_move_type="in_invoice") @@ -85,8 +88,10 @@ def _prepare_invoice(self, journal, product, date=False): if date: move_form.invoice_date = date partner = self._get_invoice_partner() + currency = self._get_invoice_currency() move_form.partner_id = partner move_form.journal_id = journal + move_form.currency_id = currency for settlement in self: with move_form.invoice_line_ids.new() as line_form: line_form.product_id = product @@ -118,7 +123,7 @@ def _prepare_invoice(self, journal, product, date=False): return vals def _get_invoice_grouping_keys(self): - return ["company_id", "agent_id"] + return ["company_id", "currency_id", "agent_id"] def make_invoices(self, journal, product, date=False, grouped=False): invoice_vals_list = [] diff --git a/account_commission/readme/CONTRIBUTORS.rst b/account_commission/readme/CONTRIBUTORS.rst index 77b751822..35e90bee4 100644 --- a/account_commission/readme/CONTRIBUTORS.rst +++ b/account_commission/readme/CONTRIBUTORS.rst @@ -7,6 +7,7 @@ * Oihane Crucelaegui * Nicola Malcontenti * Aitor Bouzas +* Alexei Rivera * `Tecnativa `__: diff --git a/account_commission/views/account_move_views.xml b/account_commission/views/account_move_views.xml index e6a65c4cb..6cacb0333 100644 --- a/account_commission/views/account_move_views.xml +++ b/account_commission/views/account_move_views.xml @@ -10,7 +10,12 @@ name="commission_id" domain="['|', ('settlement_type', '=', 'sale_invoice'), ('settlement_type', '=', False)]" /> - + + diff --git a/account_commission/wizards/commission_make_settle.py b/account_commission/wizards/commission_make_settle.py index d2e5c32c5..c4870e325 100644 --- a/account_commission/wizards/commission_make_settle.py +++ b/account_commission/wizards/commission_make_settle.py @@ -14,16 +14,19 @@ class CommissionMakeSettle(models.TransientModel): ondelete={"sale_invoice": "cascade"}, ) + def _get_account_settle_domain(self, agent, date_to_agent): + return [ + ("invoice_date", "<", date_to_agent), + ("agent_id", "=", agent.id), + ("settled", "=", False), + ] + def _get_agent_lines(self, agent, date_to_agent): """Filter sales invoice agent lines for this type of settlement.""" if self.settlement_type != "sale_invoice": return super()._get_agent_lines(agent, date_to_agent) return self.env["account.invoice.line.agent"].search( - [ - ("invoice_date", "<", date_to_agent), - ("agent_id", "=", agent.id), - ("settled", "=", False), - ], + self._get_account_settle_domain(agent, date_to_agent), order="invoice_date", ) diff --git a/commission/README.rst b/commission/README.rst index 1ea503bcc..f97dbc143 100644 --- a/commission/README.rst +++ b/commission/README.rst @@ -19,9 +19,9 @@ Commissions .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/commission-15-0/commission-15-0-commission :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/165/15.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/commission&target_branch=15.0 + :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -109,8 +109,6 @@ Known issues / Roadmap ====================== * Make it totally multi-company aware. -* Be multi-currency aware for settlements. -* Allow to calculate and pay in other currency different from company one. * Set agent popup window with a kanban view with richer information and mobile friendly. @@ -144,6 +142,7 @@ Contributors * Oihane Crucelaegui * Nicola Malcontenti * Aitor Bouzas +* Alexei Rivera * `Tecnativa `__: diff --git a/commission/__manifest__.py b/commission/__manifest__.py index 57a56ccc5..ecf8f897e 100644 --- a/commission/__manifest__.py +++ b/commission/__manifest__.py @@ -3,7 +3,7 @@ # Copyright 2014-2022 Tecnativa - Pedro M. Baeza { "name": "Commissions", - "version": "15.0.2.0.0", + "version": "15.0.2.1.0", "author": "Tecnativa, Odoo Community Association (OCA)", "category": "Invoicing", "license": "AGPL-3", diff --git a/commission/readme/CONTRIBUTORS.rst b/commission/readme/CONTRIBUTORS.rst index 77b751822..35e90bee4 100644 --- a/commission/readme/CONTRIBUTORS.rst +++ b/commission/readme/CONTRIBUTORS.rst @@ -7,6 +7,7 @@ * Oihane Crucelaegui * Nicola Malcontenti * Aitor Bouzas +* Alexei Rivera * `Tecnativa `__: diff --git a/commission/readme/ROADMAP.rst b/commission/readme/ROADMAP.rst index 64f69a38f..b4bdd9c35 100644 --- a/commission/readme/ROADMAP.rst +++ b/commission/readme/ROADMAP.rst @@ -1,5 +1,3 @@ * Make it totally multi-company aware. -* Be multi-currency aware for settlements. -* Allow to calculate and pay in other currency different from company one. * Set agent popup window with a kanban view with richer information and mobile friendly. diff --git a/commission/static/description/index.html b/commission/static/description/index.html index 322f674c1..ddfb0ada8 100644 --- a/commission/static/description/index.html +++ b/commission/static/description/index.html @@ -3,7 +3,7 @@ - + Commissions