diff --git a/account_payment_term_partner_holiday/README.rst b/account_payment_term_partner_holiday/README.rst index a4cd3d921892..fa506d20447a 100644 --- a/account_payment_term_partner_holiday/README.rst +++ b/account_payment_term_partner_holiday/README.rst @@ -17,13 +17,13 @@ Account Payment Term Partner Holiday :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github - :target: https://github.com/OCA/account-payment/tree/14.0/account_payment_term_partner_holiday + :target: https://github.com/OCA/account-payment/tree/16.0/account_payment_term_partner_holiday :alt: OCA/account-payment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_term_partner_holiday + :target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_payment_term_partner_holiday :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/account-payment&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -58,7 +58,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. @@ -100,6 +100,6 @@ Current `maintainer `__: |maintainer-victoralmau| -This module is part of the `OCA/account-payment `_ project on GitHub. +This module is part of the `OCA/account-payment `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_term_partner_holiday/__manifest__.py b/account_payment_term_partner_holiday/__manifest__.py index a100d1916aae..574698215938 100644 --- a/account_payment_term_partner_holiday/__manifest__.py +++ b/account_payment_term_partner_holiday/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Account Payment Term Partner Holiday", - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "website": "https://github.com/OCA/account-payment", "author": "Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/account_payment_term_partner_holiday/models/account_payment_term.py b/account_payment_term_partner_holiday/models/account_payment_term.py index ed61c448f472..c28617c73a7c 100644 --- a/account_payment_term_partner_holiday/models/account_payment_term.py +++ b/account_payment_term_partner_holiday/models/account_payment_term.py @@ -1,35 +1,52 @@ # Copyright 2021 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import fields, models +from odoo import models class AccountPaymentTerm(models.Model): _inherit = "account.payment.term" - def compute(self, value, date_ref=False, currency=None): + def _compute_terms( + self, + date_ref, + currency, + company, + tax_amount, + tax_amount_currency, + sign, + untaxed_amount, + untaxed_amount_currency, + ): """Compute the due date taking into account the holiday periods set in the partner. - Once an initial date resulting of the payment term is computed, compute the first available date after that. Then, apply_payment_days() and apply_holidays() to prevent incompatibilities. """ - result = super().compute(value=value, date_ref=date_ref, currency=currency) + result = super()._compute_terms( + date_ref, + currency, + company, + tax_amount, + tax_amount_currency, + sign, + untaxed_amount, + untaxed_amount_currency, + ) ctx = self.env.context partner_id = ctx.get("move_partner_id", ctx.get("default_partner_id")) if partner_id: partner = self.env["res.partner"].browse(partner_id) result2 = [] for key, item in enumerate(result): - next_date = partner._get_valid_due_date(item[0]) - if next_date != item[0]: - line = self.line_ids[key] + next_date = partner._get_valid_due_date(item["date"]) + if next_date != item["date"]: + line = self.line_ids.sorted(lambda x: x.value == "balance")[key] next_date = self.apply_payment_days(line, next_date) next_date = self.apply_holidays(next_date) - result2.append((fields.Date.to_string(next_date), item[1])) - else: - result2.append(item) + item.update({"date": next_date}) + result2.append(item) result = result2 return result diff --git a/account_payment_term_partner_holiday/static/description/index.html b/account_payment_term_partner_holiday/static/description/index.html index 4b9a17f7b8e4..917ab7e33723 100644 --- a/account_payment_term_partner_holiday/static/description/index.html +++ b/account_payment_term_partner_holiday/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z 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 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* 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 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,7 +369,7 @@

Account Payment Term Partner Holiday

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:afe7b305107611842f1263bcb1bc45fed2405cd569ea078defd85c749ae46592 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This addon adds the possibility of defining holiday periods in a partner so as not to use those periods as the due date on invoices.

Table of contents

@@ -408,7 +408,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.

@@ -433,13 +433,15 @@

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 maintainer:

victoralmau

-

This module is part of the OCA/account-payment project on GitHub.

+

This module is part of the OCA/account-payment project on GitHub.

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

diff --git a/account_payment_term_partner_holiday/tests/test_partner_holiday.py b/account_payment_term_partner_holiday/tests/test_partner_holiday.py index d0719895b34c..ad14c6565492 100644 --- a/account_payment_term_partner_holiday/tests/test_partner_holiday.py +++ b/account_payment_term_partner_holiday/tests/test_partner_holiday.py @@ -73,7 +73,6 @@ def setUp(self): { "value": "balance", "days": 0, - "option": "day_after_invoice_date", }, ) ], @@ -89,7 +88,6 @@ def setUp(self): { "value": "balance", "days": 10, - "option": "day_after_invoice_date", }, ) ], @@ -105,7 +103,6 @@ def setUp(self): { "value": "balance", "days": 0, - "option": "day_after_invoice_date", }, ) ], @@ -124,7 +121,6 @@ def setUp(self): { "value": "balance", "days": 0, - "option": "day_after_invoice_date", "payment_days": "5,10", }, ) @@ -141,7 +137,7 @@ def setUp(self): { "name": "Test Account", "code": "TEST", - "user_type_id": self.env.ref("account.data_account_type_receivable").id, + "account_type": "asset_receivable", "reconcile": True, } ) @@ -149,9 +145,7 @@ def setUp(self): { "name": "Test Account", "code": "ACC", - "user_type_id": self.env.ref( - "account.data_account_type_other_income" - ).id, + "account_type": "income_other", "reconcile": True, } )