[19.0][MIG] sale_order_lot_selection: Migration to 19.0#3985
[19.0][MIG] sale_order_lot_selection: Migration to 19.0#3985
Conversation
[FIX] Fix product_id on test [FIX] Fix product on test
[FIX] Use product_14 instead of product_11 [FIX] Add test's flow step
[FIX] change data in quant search [FIX] Fixed tab [FIX] Add check on lots list FIX product_id_change_with_wh
Because quants_get_prefered_domain does not return quants with our lots, if other quants are available
…roup_production_lot res.groups
Steps to reproduce: 1.- Create a new Sale Order with 2 or more lines of products 2.- Assign lot to every line (ensure lot has stock available) 3.- Confirm the Sale Order 4.- Go to the Delivery Order Result: Only the first line in the Delivery Order is in state "Available" and reserved, the rest of the lines are in state "Waiting Availability" and not reserved
…ects If we use the lot_id field to add it as a dependency of the _compute_price_unit method, we may encounter side effects, and indirectly we will need the field to be defined as precompute=True to avoid them.
…does not have tracking defined
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-18.0/sale-workflow-18.0-sale_order_lot_selection Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_lot_selection/
Currently translated at 100.0% (3 of 3 strings) Translation: sale-workflow-18.0/sale-workflow-18.0-sale_order_lot_selection Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_lot_selection/it/
2924a0a to
635139f
Compare
|
Please, cherry-pick #4011 to commit history before migration commit. |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Solid migration overall. The core lot selection logic, procurement integration, and view xpaths are correct for 19.0. A few observations:
Functional scope change -- The 16.0 version had allow_to_change_lot_on_confirmed_so (company setting + config view + write() override + lot_id_readonly computed field). All of this is dropped in the migration. If this is intentional simplification, it would be worth mentioning in the PR description or a migration note, since users upgrading from 16.0 will lose that capability.
Minor code observations:
-
_compute_product_tracking-- The fallbacksol.product_id.tracking or sol.product_trackingworks correctly for the visibility use-case but could be simplified to justsol.product_id.trackingsince the compute fires onproduct_idchange and the only consumer is theinvisibleexpression. Theor sol.product_trackingbranch only preserves a stale value whenproduct_idis cleared, which has no practical benefit since the field is hidden whennot product_idanyway. -
In the test
test_02_sale_order_lot_selection,self.product_46.write({"tracking": "lot", "type": "consu"})-- the"type": "consu"is a no-op in 19.0 since these products are alreadyconsu(created withis_storable=True). Not a bug, but dead code carried forward from older versions. -
The
product_trackingfield is used in the viewinvisibleexpression but not declared in the view XML. Odoo 17+ auto-fetches fields in expressions, so this works, but adding<field name="product_tracking" column_invisible="True"/>would make the dependency explicit.
CI: "Detect unreleased dependencies" failure is expected due to the pending stock_restrict_lot migration (OCA/stock-logistics-workflow#2151).
Tests pass on both Odoo and OCB.
| @api.depends("product_id") | ||
| def _compute_product_tracking(self): | ||
| for sol in self: | ||
| sol.product_tracking = sol.product_id.tracking or sol.product_tracking |
There was a problem hiding this comment.
Nit: the or sol.product_tracking fallback is only reached when product_id is empty (since 'none' is truthy). In that case the view already hides the lot field via invisible="not product_id ...", so the preserved stale value has no visible effect. Could simplify to just:
sol.product_tracking = sol.product_id.trackingNot blocking, just a readability point.
| if move.product_id == self.prd_cable: | ||
| lot10 = self.lot_model.create( | ||
| { | ||
| "name": "0000010", |
There was a problem hiding this comment.
Minor: "type": "consu" is redundant in 19.0 -- products created with is_storable=True already have type='consu'. This write effectively only sets tracking. Consider removing the type key to avoid confusion during future migrations.
| context="{'default_product_id': product_id}" | ||
| groups="stock.group_production_lot" | ||
| optional="show" | ||
| /> |
There was a problem hiding this comment.
Consider adding <field name="product_tracking" column_invisible="True"/> explicitly in the list view. While Odoo 17+ auto-fetches fields used in invisible expressions, declaring it makes the dependency clear and avoids surprises if that auto-fetch behavior ever changes.
victoralmau
left a comment
There was a problem hiding this comment.
My comment #3985 (comment) is still pending.
…ock moves Example use case: - Product with Lot A and Lot B. - SO with Lot A linked. - The SO is confirmed and the OUT is generated with Lot A linked in the stock move - The SO is modified to define Lot B. - The OUT stock move is changed to Lot B. TT57112
9ea84b1 to
f702c4a
Compare
f702c4a to
2bd743c
Compare
|
@victoralmau Done! |
BhaveshHeliconia
left a comment
There was a problem hiding this comment.
Functional review LGTM!
|
/ocabot migration sale_order_lot_selection |
Depends on: