-
-
Notifications
You must be signed in to change notification settings - Fork 675
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
Conversation
There was a problem hiding this 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".
Please check Travis |
68ea673
to
b110ee2
Compare
This PR has the |
There was a problem hiding this 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
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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. |
Odoo standard logic in the
compute()
of theaccount.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 thecompute()
of theaccount.payment.term
andday_of_the_month
is no long being considered in the overwritten method. Hence this PR is trying to keep thecompute()
consistent with standard logic.