From 3a7ca5e77cd6f59e39d2d241c149963ea1d896ed Mon Sep 17 00:00:00 2001 From: David Alonso Date: Wed, 11 Sep 2024 20:01:21 +0200 Subject: [PATCH] [MIG] sale_commission_partial_settlement: Migration to 16.0 --- sale_commission_partial_settlement/README.rst | 10 +++++----- sale_commission_partial_settlement/__init__.py | 3 ++- .../__manifest__.py | 6 +++--- .../migrations/14.0.1.0.1/post-migrate.py | 11 ----------- .../models/__init__.py | 9 +++++---- .../models/account_move.py | 2 +- .../{sale_commission.py => commission.py} | 4 ++-- .../static/description/index.html | 17 +++++++---------- .../tests/test_partial_settlement.py | 4 ++-- ..._commission_view.xml => commission_view.xml} | 8 ++++---- 10 files changed, 31 insertions(+), 43 deletions(-) delete mode 100644 sale_commission_partial_settlement/migrations/14.0.1.0.1/post-migrate.py rename sale_commission_partial_settlement/models/{sale_commission.py => commission.py} (81%) rename sale_commission_partial_settlement/views/{sale_commission_view.xml => commission_view.xml} (56%) diff --git a/sale_commission_partial_settlement/README.rst b/sale_commission_partial_settlement/README.rst index 984415fd0..4cd76a036 100644 --- a/sale_commission_partial_settlement/README.rst +++ b/sale_commission_partial_settlement/README.rst @@ -17,13 +17,13 @@ Sales commissions based on paid amount :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github - :target: https://github.com/OCA/commission/tree/14.0/sale_commission_partial_settlement + :target: https://github.com/OCA/commission/tree/16.0/sale_commission_partial_settlement :alt: OCA/commission .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_partial_settlement + :target: https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_partial_settlement :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -50,7 +50,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -105,6 +105,6 @@ Current `maintainers `__: |maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba| -This module is part of the `OCA/commission `_ project on GitHub. +This module is part of the `OCA/commission `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_commission_partial_settlement/__init__.py b/sale_commission_partial_settlement/__init__.py index 9b4296142..95c7515fd 100644 --- a/sale_commission_partial_settlement/__init__.py +++ b/sale_commission_partial_settlement/__init__.py @@ -1,2 +1,3 @@ from . import models -from . import wizard + +# from . import wizard diff --git a/sale_commission_partial_settlement/__manifest__.py b/sale_commission_partial_settlement/__manifest__.py index 1b98f3e68..0e00ecab3 100644 --- a/sale_commission_partial_settlement/__manifest__.py +++ b/sale_commission_partial_settlement/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2023 Nextev { "name": "Sales commissions based on paid amount", - "version": "14.0.1.0.1", + "version": "16.0.1.0.0", "author": "Nextev Srl," "Ooops," "Odoo Community Association (OCA)", "maintainers": ["aleuffre", "renda-dev", "PicchiSeba"], "category": "Sales Management", @@ -9,8 +9,8 @@ "depends": ["sale_commission"], "website": "https://github.com/OCA/commission", "data": [ - "security/ir.model.access.csv", - "views/sale_commission_view.xml", + # "security/ir.model.access.csv", + "views/commission_view.xml", ], "installable": True, } diff --git a/sale_commission_partial_settlement/migrations/14.0.1.0.1/post-migrate.py b/sale_commission_partial_settlement/migrations/14.0.1.0.1/post-migrate.py deleted file mode 100644 index 626eae3f9..000000000 --- a/sale_commission_partial_settlement/migrations/14.0.1.0.1/post-migrate.py +++ /dev/null @@ -1,11 +0,0 @@ -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - env["account.invoice.line.agent"].search( - [ - ("settled", "=", True), - ("commission_id.payment_amount_type", "=", "paid"), - ] - )._compute_settled() diff --git a/sale_commission_partial_settlement/models/__init__.py b/sale_commission_partial_settlement/models/__init__.py index 4e17db438..f4b244747 100644 --- a/sale_commission_partial_settlement/models/__init__.py +++ b/sale_commission_partial_settlement/models/__init__.py @@ -1,4 +1,5 @@ -from . import sale_commission -from . import account_move -from . import account_partial_reconcile -from . import settlement +from . import commission + +# from . import account_move +# from . import account_partial_reconcile +# from . import settlement diff --git a/sale_commission_partial_settlement/models/account_move.py b/sale_commission_partial_settlement/models/account_move.py index a402c5ed3..97f13f1ee 100644 --- a/sale_commission_partial_settlement/models/account_move.py +++ b/sale_commission_partial_settlement/models/account_move.py @@ -17,7 +17,7 @@ def _compute_settled(self): if not line.mapped("agent_line.settlement_id"): line.settled = False - super(AccountInvoiceLineAgent, filtered_lines)._compute_settled() + return super(AccountInvoiceLineAgent, filtered_lines)._compute_settled() def _partial_commissions(self, date_payment_to): """ diff --git a/sale_commission_partial_settlement/models/sale_commission.py b/sale_commission_partial_settlement/models/commission.py similarity index 81% rename from sale_commission_partial_settlement/models/sale_commission.py rename to sale_commission_partial_settlement/models/commission.py index 68f03aea9..dcb090762 100644 --- a/sale_commission_partial_settlement/models/sale_commission.py +++ b/sale_commission_partial_settlement/models/commission.py @@ -3,8 +3,8 @@ from odoo import fields, models -class SaleCommission(models.Model): - _inherit = "sale.commission" +class Commission(models.Model): + _inherit = "commission" payment_amount_type = fields.Selection( [("full", "Full amount"), ("paid", "Paid amount")], diff --git a/sale_commission_partial_settlement/static/description/index.html b/sale_commission_partial_settlement/static/description/index.html index 6bf4cbe3b..74000c070 100644 --- a/sale_commission_partial_settlement/static/description/index.html +++ b/sale_commission_partial_settlement/static/description/index.html @@ -8,11 +8,10 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ +:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. -Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +274,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: gray; } /* line numbers */ +pre.code .ln { color: grey; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +300,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -369,7 +368,7 @@

Sales commissions based on paid amount

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:72b8b9ff4225524c4105f059588ec2038649d39259909c6d43d8e7c4b62b06a2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/commission Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/commission Translate me on Weblate Try me on Runboat

This module allows to settle commissions based on paid amount.

Table of contents

@@ -398,7 +397,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -439,15 +438,13 @@

Contributors

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

aleuffre renda-dev PicchiSeba

-

This module is part of the OCA/commission project on GitHub.

+

This module is part of the OCA/commission project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/sale_commission_partial_settlement/tests/test_partial_settlement.py b/sale_commission_partial_settlement/tests/test_partial_settlement.py index 66ba38ea4..317c506d4 100644 --- a/sale_commission_partial_settlement/tests/test_partial_settlement.py +++ b/sale_commission_partial_settlement/tests/test_partial_settlement.py @@ -129,7 +129,7 @@ def _invoice_sale_order(self, sale_order, date=None): old_invoices = sale_order.invoice_ids wizard = self.advance_inv_model.create({"advance_payment_method": "delivered"}) wizard.with_context( - { + **{ "active_model": "sale.order", "active_ids": [sale_order.id], "active_id": sale_order.id, @@ -170,7 +170,7 @@ def register_payment( "active_ids": [invoice.id], } return ( - payment_model.with_context(ctx) + payment_model.with_context(**ctx) .create( { "payment_date": payment_date, diff --git a/sale_commission_partial_settlement/views/sale_commission_view.xml b/sale_commission_partial_settlement/views/commission_view.xml similarity index 56% rename from sale_commission_partial_settlement/views/sale_commission_view.xml rename to sale_commission_partial_settlement/views/commission_view.xml index b82c7b9d1..3505ca083 100644 --- a/sale_commission_partial_settlement/views/sale_commission_view.xml +++ b/sale_commission_partial_settlement/views/commission_view.xml @@ -1,9 +1,9 @@ - - sale.commission.payment.amount.form - sale.commission - + + sale.commission.partial.settlement.form.view + commission +