Skip to content

Fix warehouse propagation in MTO procurements#928

Closed
jcadhoc wants to merge 4 commits into
ingadhoc:18.0from
adhoc-dev:18.0-h-118573-jc
Closed

Fix warehouse propagation in MTO procurements#928
jcadhoc wants to merge 4 commits into
ingadhoc:18.0from
adhoc-dev:18.0-h-118573-jc

Conversation

@jcadhoc

@jcadhoc jcadhoc commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • override stock.move._prepare_procurement_values() in stock_ux to propagate the warehouse that owns the physical source location
  • avoid reusing draft RFQs from a different warehouse in multi-warehouse MTO chains
  • prevent purchase orders from mixing destinations from different warehouses and later failing the operation type consistency check

Why

In some multi-warehouse MTO flows the move still carries the commercial warehouse in warehouse_id even though its real source location belongs to another warehouse. That stale value is propagated to the next procurement and can attach buy procurements to a draft RFQ from the wrong warehouse.

@roboadhoc

Copy link
Copy Markdown
Collaborator

Pull request status dashboard

@jcadhoc jcadhoc force-pushed the 18.0-h-118573-jc branch from 0f17c7b to 8cf5065 Compare May 21, 2026 15:43
jcadhoc and others added 3 commits June 24, 2026 19:16
The MTO warehouse propagation guard checked for `raw_material_production_id`
(defined by mrp) and then read `subcontractor_id`, which only exists once
mrp_subcontracting is installed. On a database with mrp but not
mrp_subcontracting, that read raised AttributeError during procurement,
blocking the picking/order flow. Guard the subcontractor read with a field
presence check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jcadhoc jcadhoc force-pushed the 18.0-h-118573-jc branch from 44ad9e5 to 1d4db9c Compare June 24, 2026 19:30
Satisfies the end-of-file-fixer pre-commit hook.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@les-adhoc

Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

@roboadhoc

Copy link
Copy Markdown
Collaborator

@jcadhoc @les-adhoc because this PR has multiple commits, I need to know how to merge it:

  • merge to merge directly, using the PR as merge commit message
  • rebase-merge to rebase and merge, using the PR as merge commit message
  • rebase-ff to rebase and fast-forward

@les-adhoc

Copy link
Copy Markdown
Contributor

@roboadhoc rebase-ff

roboadhoc pushed a commit that referenced this pull request Jun 25, 2026
Part-of: #928
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc pushed a commit that referenced this pull request Jun 25, 2026
Part-of: #928
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc pushed a commit that referenced this pull request Jun 25, 2026
The MTO warehouse propagation guard checked for `raw_material_production_id`
(defined by mrp) and then read `subcontractor_id`, which only exists once
mrp_subcontracting is installed. On a database with mrp but not
mrp_subcontracting, that read raised AttributeError during procurement,
blocking the picking/order flow. Guard the subcontractor read with a field
presence check.

Part-of: #928
Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
roboadhoc pushed a commit that referenced this pull request Jun 25, 2026
Satisfies the end-of-file-fixer pre-commit hook.

closes #928

Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@roboadhoc

Copy link
Copy Markdown
Collaborator

Merge method set to rebase and fast-forward.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants