Skip to content

[18.0] [MIG] stock_mts_mto_rule : migrate to 18.0#2425

Open
apik-mgu wants to merge 61 commits into
OCA:18.0from
apikcloud:18.0-mig-stock_mts_mto_rule
Open

[18.0] [MIG] stock_mts_mto_rule : migrate to 18.0#2425
apik-mgu wants to merge 61 commits into
OCA:18.0from
apikcloud:18.0-mig-stock_mts_mto_rule

Conversation

@apik-mgu

Copy link
Copy Markdown

No description provided.

florian-dacosta and others added 30 commits September 11, 2025 12:29
… procurement rules to handle the mts+mto scenario
Add explanation for finding this setting
Conforms to the latest README template: bugtracker, runbot etc.
Fixes bugtracker URL on some modules.
States OCA as maintainer, removes other contributors from the 'Maintainer' section.
…en warehouse is two/three steps delivery propagate move by mts-mto in pick/pack/out
OCA Transbot updated translations from Transifex
There's a traceback when renaming warehouse code (without renaming warehouse name), as name argument is False.
OCA Transbot updated translations from Transifex

OCA Transbot updated translations from Transifex
This method is called from the write() method the one how support
multiple records an api.multi method.

I was making some test when I tried to activate the mto+mts option for
multiple warehouse and the next error appears: ``ValueError: Expected singleton``

In order to fix this error I only added a loop to manage the multiple
registers.
OCA Transbot updated translations from Transifex
Major changes to the way Warehouses update their routes/rules and self heal.
Improved rule code to use `float_compare` and `float_is_zero`.
Currently translated at 11.8% (2 of 17 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_mts_mto_rule/fr_FR/
Currently translated at 100.0% (18 of 18 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_mts_mto_rule/zh_CN/
weblate and others added 11 commits September 11, 2025 12:29
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-warehouse-16.0/stock-logistics-warehouse-16.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_mts_mto_rule/
Currently translated at 100.0% (13 of 13 strings)

Translation: stock-logistics-warehouse-17.0/stock-logistics-warehouse-17.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-stock_mts_mto_rule/it/
Currently translated at 100.0% (13 of 13 strings)

Translation: stock-logistics-warehouse-17.0/stock-logistics-warehouse-17.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-stock_mts_mto_rule/es/
Currently translated at 100.0% (13 of 13 strings)

Translation: stock-logistics-warehouse-17.0/stock-logistics-warehouse-17.0-stock_mts_mto_rule
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-stock_mts_mto_rule/it/
@apik-mgu apik-mgu mentioned this pull request Sep 12, 2025
72 tasks
@rousseldenis

Copy link
Copy Markdown
Contributor

/ocabot migration stock_mts_mto_rule

]
)
self.assertEqual(1, len(move_mts))
# self.assertEqual(1, len(move_mts))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why removing this ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Source reviewed and control reinstated

@apik-mgu
apik-mgu force-pushed the 18.0-mig-stock_mts_mto_rule branch from 156798c to 9685e62 Compare September 29, 2025 10:10
@ypapouin

Copy link
Copy Markdown
Contributor

Something is broken somewhere, you changed the test_mts_mto_route_mto_only assertion to pass the test but the global behaviour is really strange. I ran the same test with Odoo 14.0 to compare moves data:

Odoo 14.0:

[{'id': N,
  'location_dest_id': (5, 'Partner Locations/Customers'),
  'location_id': (8, 'WH/Stock'),
  'move_dest_ids': [],
  'move_orig_ids': [N+1]}]

[{'id': N+1,
  'location_dest_id': (8, 'WH/Stock'),
  'location_id': (4, 'Partner Locations/Vendors'),
  'move_dest_ids': [N],
  'move_orig_ids': []}]
graph LR
    subgraph v14 [Odoo 14 Flow]
        direction LR
        V14_Vendor(Vendors)
        V14_Stock(WH/Stock)
        V14_Customer(Customers)

        V14_Vendor -- "Move N+1<br/>(Supply)" --> V14_Stock
        V14_Stock -- "Move N<br/>(Delivery)" --> V14_Customer
    end

Loading

Odoo 18.0:

[{'id': N+1,
  'location_dest_id': (5, 'Partners/Customers'),
  'location_final_id': (8, 'WH/Stock'),
  'location_id': (4, 'Partners/Vendors'),
  'move_dest_ids': [N],
  'move_orig_ids': []}]

[{'id': N,
  'location_dest_id': (5, 'Partners/Customers'),
  'location_final_id': (5, 'Partners/Customers'),
  'location_id': (8, 'WH/Stock'),
  'move_dest_ids': [],
  'move_orig_ids': [N+1]}]
graph LR
    subgraph v18 [Odoo 18 Flow]
        direction LR
        V18_Vendor(Vendors)
        V18_Stock(WH/Stock)
        V18_Customer(Customers)

        %% The main difference: Move N+1 points to Customer in location_dest_id
        V18_Vendor -- "Move N+1<br/>(Supply)<br/>Dest: Customers" --> V18_Customer
        
        %% The delivery move
        V18_Stock -- "Move N<br/>(Delivery)" --> V18_Customer

        %% Dotted line representing location_final_id
        V18_Vendor -.-> |"Move N+1<br/>Final: WH/Stock"| V18_Stock
    end

    %% Highlight the changed path in red
    linkStyle 0 stroke:#ffff00,stroke-width:3px,color:yellow;
    linkStyle 2 stroke:#00AAff,stroke-width:2px,stroke-dasharray:
Loading

With Odoo 18.0, both moves have the same location_dest_id.
I will continue to investigate on this.

@ypapouin

Copy link
Copy Markdown
Contributor

It looks like it is related to Odoo changes from odoo/odoo@11e6987 ([REF] stock: pull & push rules refactor) with introduction of the location_final_id and that made location_dest_id a non-readonly computed field.

image

)
== 0.0
):
getattr(self.env["stock.rule"], f"_run_{rule.mts_rule_id.action}")(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mts_rule_id -> mto_rule_id

moves_to_assign._action_assign()

mto_procurement = procurement._replace(product_qty=needed_qty)
getattr(self.env["stock.rule"], f"_run_{rule.mts_rule_id.action}")(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mts_rule_id -> mto_rule_id

Comment on lines +238 to +246
rule_vals = {
"location_dest_id": self.env.ref("stock.stock_location_stock").id,
"location_src_id": self.env.ref("stock.stock_location_suppliers").id,
"action": "pull",
"warehouse_id": self.warehouse.id,
"picking_type_id": self.env.ref("stock.picking_type_out").id,
"name": "dummy rule",
"route_id": self.dummy_route.id,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add:

"location_dest_from_rule": True,

Fix:
from supplier to stock => in

"picking_type_id": self.env.ref("stock.picking_type_in").id,

@github-actions

Copy link
Copy Markdown

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 Apr 19, 2026
@BhaveshHeliconia

Copy link
Copy Markdown
Contributor

@apik-mgu could you please address @ypapouin’s comments?

@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 10, 2026
@ypapouin

Copy link
Copy Markdown
Contributor

@BhaveshHeliconia, I made a new PR for this module:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.