Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][FIX] account_payment_term_extension: consider day_of_the_month in compute() #715

Closed
wants to merge 1 commit into from

Conversation

TimLai125
Copy link

Odoo standard logic in the compute() of the account.payment.term considers Terms' day_of_the_month.
https://github.com/odoo/odoo/blob/6ed05368ab616aa6b256898bcef35fac93dcbb54/addons/account/models/account_invoice.py#L2067-L2069

As account_payment_term_extension overwrites the compute() of the account.payment.term and day_of_the_month is no long being considered in the overwritten method. Hence this PR is trying to keep the compute() consistent with standard logic.

@TimLai125 TimLai125 changed the title [12.0][IMP] Consider day_of_the_month in compute() [12.0][FIX] account_payment_term_extension: consider day_of_the_month in compute() May 20, 2020
Copy link
Sponsor Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ;)

This fix makes it possible for us to handle a payment term such as "The end of month after next".

@pedrobaeza
Copy link
Member

Please check Travis

@TimLai125 TimLai125 force-pushed the fix_compute_day_of_the_month branch from 68ea673 to b110ee2 Compare May 21, 2020 05:29
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza added this to the 12.0 milestone May 24, 2020
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test exercising the new addition

Comment on lines +182 to +185
if line.day_of_the_month > 0:
months_delta = (line.day_of_the_month < next_date.day) and 1 or 0
next_date += relativedelta(
day=line.day_of_the_month, months=months_delta)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if line.day_of_the_month > 0:
months_delta = (line.day_of_the_month < next_date.day) and 1 or 0
next_date += relativedelta(
day=line.day_of_the_month, months=months_delta)
if line.day_of_the_month > 0:
months_delta = (line.months == 0) and (line.day_of_the_month < next_date.day) and 1 or 0
next_date += relativedelta(
day=line.day_of_the_month, months=months_delta)

On second thought, we should bypass the standard month_delta logic when line.months is set, since the delta for line.months is already taken care of in the previous step.

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 29, 2023
@github-actions github-actions bot closed this Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants