Skip to content

Commit

Permalink
[MIG] account_payment_term_partner_holiday: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis D. Lafaurie authored and antoniospneto committed Feb 4, 2024
1 parent 7ace13d commit 3bec556
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 42 deletions.
27 changes: 14 additions & 13 deletions account_payment_term_partner_holiday/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ Account Payment Term Partner Holiday
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8219d804cde69d412d2f3a92abd869d204cddc1b3c7b6a18e207ae2013c9fc67
!! source digest: sha256:afe7b305107611842f1263bcb1bc45fed2405cd569ea078defd85c749ae46592
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/13.0/account_payment_term_partner_holiday
:target: https://github.com/OCA/account-payment/tree/14.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-13-0/account-payment-13-0-account_payment_term_partner_holiday
:target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-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=13.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -41,24 +41,24 @@ Usage

To use this module, you need to:

#. Go to 'Contacts' and create or edit some record.
#. Go to 'Sales & Purchases' tab and create some holidays records.
#. Go to 'Contacts' and create a record or edit an existing one.
#. Go to 'Sales & Purchase' tab and create some holiday periods.
#. Go to 'Invoicing > Customers > Invoices' or to 'Invoicing > Vendors >
Invoices' and create or edit some record.
#. If the computed due date is inside a holidays period, it's moved to the first available date.
Invoices' and create or edit a record.
#. If the computed due date is within a holiday period, it's moved to the first available date.

Known issues / Roadmap
======================

* Due dates for invoices are not updated when new holidays are created after.
* Due dates for invoices are not updated when new holiday periods are created.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-payment/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 <https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_partner_holiday%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_partner_holiday%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -77,6 +77,7 @@ Contributors

* Víctor Martínez
* Pedro M. Baeza
* Luis D. Lafaurie

Maintainers
~~~~~~~~~~~
Expand All @@ -99,6 +100,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/13.0/account_payment_term_partner_holiday>`_ project on GitHub.
This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/14.0/account_payment_term_partner_holiday>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_payment_term_partner_holiday/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"installable": True,
"depends": ["account_payment_term_extension"],
"maintainers": ["victoralmau"],
"development_status": "Production/Stable",
"development_status": "Beta",
"data": ["security/ir.model.access.csv", "views/res_partner_view.xml"],
}
16 changes: 7 additions & 9 deletions account_payment_term_partner_holiday/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _recompute_payment_terms_lines(self):
_self = self
if self.partner_id:
_self = self.with_context(move_partner_id=self.partner_id.id)
super(AccountMove, _self)._recompute_payment_terms_lines()
return super(AccountMove, _self)._recompute_payment_terms_lines()

@api.onchange("invoice_date_due")
def _onchange_invoice_date_due_account_payment_term_partner_holiday(self):
Expand All @@ -35,11 +35,9 @@ def _onchange_invoice_date_due_account_payment_term_partner_holiday(self):
self.invoice_date_due = new_invoice_date_due

def action_post(self):
"""Inject a context for getting the partner when computing payment term.
The trade-off is that we should split the call to super record per record,
but it shouldn't impact in performance.
"""
for item in self:
_item = item.with_context(move_partner_id=item.partner_id.id)
super(AccountMove, _item).action_post()
return True
"""Inject a context for getting the partner when computing payment term."""
for move in self:
super(
AccountMove, self.with_context(move_partner_id=move.partner_id.id)
).action_post()
return False
4 changes: 0 additions & 4 deletions account_payment_term_partner_holiday/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,18 @@ def _selection_months(self):
)
day_from = fields.Selection(
selection="_selection_days",
string="Day from",
required=True,
)
month_from = fields.Selection(
selection="_selection_months",
string="Month from",
required=True,
)
day_to = fields.Selection(
selection="_selection_days",
string="Day to",
required=True,
)
month_to = fields.Selection(
selection="_selection_months",
string="Month to",
required=True,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

* Víctor Martínez
* Pedro M. Baeza
* Luis D. Lafaurie
2 changes: 1 addition & 1 deletion account_payment_term_partner_holiday/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Due dates for invoices are not updated when new holidays are created after.
* Due dates for invoices are not updated when new holiday periods are created.
8 changes: 4 additions & 4 deletions account_payment_term_partner_holiday/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
To use this module, you need to:

#. Go to 'Contacts' and create or edit some record.
#. Go to 'Sales & Purchases' tab and create some holidays records.
#. Go to 'Contacts' and create a record or edit an existing one.
#. Go to 'Sales & Purchase' tab and create some holiday periods.
#. Go to 'Invoicing > Customers > Invoices' or to 'Invoicing > Vendors >
Invoices' and create or edit some record.
#. If the computed due date is inside a holidays period, it's moved to the first available date.
Invoices' and create or edit a record.
#. If the computed due date is within a holiday period, it's moved to the first available date.
19 changes: 10 additions & 9 deletions account_payment_term_partner_holiday/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Account Payment Term Partner Holiday</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8219d804cde69d412d2f3a92abd869d204cddc1b3c7b6a18e207ae2013c9fc67
!! source digest: sha256:afe7b305107611842f1263bcb1bc45fed2405cd569ea078defd85c749ae46592
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-payment/tree/13.0/account_payment_term_partner_holiday"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-13-0/account-payment-13-0-account_payment_term_partner_holiday"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-payment&amp;target_branch=13.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-payment/tree/14.0/account_payment_term_partner_holiday"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_term_partner_holiday"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-payment&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -390,25 +390,25 @@ <h1 class="title">Account Payment Term Partner Holiday</h1>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to ‘Contacts’ and create or edit some record.</li>
<li>Go to ‘Sales &amp; Purchases’ tab and create some holidays records.</li>
<li>Go to ‘Contacts’ and create a record or edit an existing one.</li>
<li>Go to ‘Sales &amp; Purchase’ tab and create some holiday periods.</li>
<li>Go to ‘Invoicing &gt; Customers &gt; Invoices’ or to ‘Invoicing &gt; Vendors &gt;
Invoices’ and create or edit some record.</li>
<li>If the computed due date is inside a holidays period, it’s moved to the first available date.</li>
Invoices’ and create or edit a record.</li>
<li>If the computed due date is within a holiday period, it’s moved to the first available date.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Due dates for invoices are not updated when new holidays are created after.</li>
<li>Due dates for invoices are not updated when new holiday periods are created.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-payment/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_partner_holiday%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_partner_holiday%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -425,6 +425,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Víctor Martínez</li>
<li>Pedro M. Baeza</li>
<li>Luis D. Lafaurie</li>
</ul>
</li>
</ul>
Expand All @@ -438,7 +439,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-payment/tree/13.0/account_payment_term_partner_holiday">OCA/account-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-payment/tree/14.0/account_payment_term_partner_holiday">OCA/account-payment</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _set_invoice_form(self, partner_id, date):
self.env["account.move"].with_context(
default_journal_id=self.journal.id,
default_partner_id=partner_id,
default_type="out_invoice",
default_move_type="out_invoice",
default_invoice_date=date,
),
)
Expand Down

0 comments on commit 3bec556

Please sign in to comment.