odoo/odoo#234567
Created by fw-bot
Merged
at e992e675145a2f4802233635f8aea527ab4ca716
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 20s)
- ci/documentation: (runtime 929s)
- label
- odoo-dev:19.0-17.0-opw-4965036-protect_invoice_on_line_create-sile-475211-fw
- head
- f48a582eb94bfd24069ad56a2c47288fc46fabd2
- merged
- 7 months ago by Bugfix, Levi Siuzdak
| odoo/odoo | |
|---|---|
| 17.0 | #231186 |
| 18.0 | #234435 |
| saas-18.2 | #234452 |
| saas-18.3 | #234459 |
| saas-18.4 | #234529 |
| 19.0 | #234567 |
| saas-19.1 | |
| saas-19.2 | |
| saas-19.3 | |
| master | #234592 |
[FIX] account, sale_stock: protect moves on line create
Versions
- 17.0+
Steps
- Enable anglo-saxon accounting;
- have a product category with automated AVCO;
- assign category to a deliverable product;
- set product to invoice on delivery;
- add product to a sales order;
- confirm order & delivery;
- create invoice;
- change the delivery on the invoice;
- confirm the invoice.
Issue
The delivery date gets reset.
Cause
Commit 818cf04f05767 added delivery_date as a permanently protected field when modifying moves or move lines, protecting the records on write. With anglo-saxon accounting however, new move lines are created when confirming an invoice, which in turn recalculate the delivery date, as _get_protected_vals isn't used for their move on create.
Solution
Add self.env['account.move'].protecting(_get_protected_vals({}, moves)) when creating new lines for a move, to avoid recomputing fields that should always be protected.
Forward-Port-Of: #231186