-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
[15.0][MIG] account_payment_term_partner_holiday: Migration to version 15.0 #523
[15.0][MIG] account_payment_term_partner_holiday: Migration to version 15.0 #523
Conversation
…xclude it when payment term assigned in invoices set due dates
…_in_holiday() to filtered correctly when day_to is less than date to compare [IMP] Improve is_date_in_holiday() to work fine in child partners [IMP] Add constraint to holidays to prevent month_to < month_from [FIX] account_payment_term_partner_holiday: Change month_from and month_to fields to convert in 2 characters to order correctly holidays + Script migration
…ds account_payment_term_extension and change the way to set correctly due date according payment term lines definition (not +1 day always)
e8fc9bf
to
b717be7
Compare
@chienandalu please review. @pedrobaeza please review. |
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.
Thanks @LudLaf This should be changed thou:
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) | ||
return super(AccountMove, _item).action_post() |
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.
Not a migration bug but it should be fixed though. This code will allways exit in the first loop iteration. So it will break the expected behavior when several invoices are posted with this method. Attending to the core method design (odoo/odoo/addons/account/models/account_move.py#L3081-L3086), this would be IMO a better approach:
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) | |
return super(AccountMove, _item).action_post() | |
def action_post(self): | |
"""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 |
ping @victoralmau
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.
Thanks, you are right, that is incorrect.
Reviewing in v13 I see that action_post()
method does not recompute the payment terms lines (this is only done by form when changing some fields), therefore I think that method could be removed directly. What do you think?
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.
What if the invoice date was empty?: https://github.com/odoo/odoo/blob/c79bda62edd8316c2a5754d8aa8838f8aa4caee0/addons/account/models/account_move.py#L2989-L2992
e641b93
to
1eeee6f
Compare
1eeee6f
to
0df8043
Compare
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.
Let's go with it :)
All changes have been applied. Thank you for your comments. |
/ocabot migration account_payment_term_partner_holiday |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 65f8f99. Thanks a lot for contributing to OCA. ❤️ |
…moves with multi-record (Found in OCA#523 (comment)). TT37271
…moves with multi-record (Found in OCA#523 (comment)). TT37271
…moves with multi-record (Found in OCA#523 (comment)). TT37271
…moves with multi-record (Found in OCA#523 (comment)). TT37271
…moves with multi-record (Found in OCA#523 (comment)). TT37271
…moves with multi-record (Found in OCA#523 (comment)). TT37271
TT37271
@Tecnativa
Standard migration to version 15.0