Skip to content

[MIG] stock_request: Migration to 19.0#89

Open
kirca wants to merge 134 commits intoOCA:19.0from
archeti-org:19.0-mig-stock_request
Open

[MIG] stock_request: Migration to 19.0#89
kirca wants to merge 134 commits intoOCA:19.0from
archeti-org:19.0-mig-stock_request

Conversation

@kirca
Copy link

@kirca kirca commented Jan 27, 2026

No description provided.

JordiBForgeFlow and others added 30 commits January 22, 2026 14:16
…of a location, the rules of the parents are also allowed
- Error with the sequence number.
- Visible texts that should be in uppercases.
- order_id should only be visible if group_stock_request_order
  option is enabled.
- adds more tests
- adds consistency between models company-wise
This commit allows the user to select multiple products from
a product list view and to create a Stock Request Order with
an action. If the user selects templates, all of those templates'
variants will be added to the order.

This is useful as it allows the user to filter products beforehand
based on their stocks, and to create a request order for all
those products whose stock is too low.
Currently translated at 57.1% (72 of 126 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_request/de/
* Add readme autogenerated
* Add some hooks
* Improve test inheritance (reduce testing time)
* Don't allow qty <= 0
* SR expected_date = order expected_date if SRO
Currently translated at 80.9% (131 of 162 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_request/de/
copied when duplicating a stock request order.
Currently translated at 3.1% (5 of 162 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_request/zh_CN/
Saran440 and others added 14 commits January 22, 2026 14:16
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-request-18.0/stock-logistics-request-18.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-request-18-0/stock-logistics-request-18-0-stock_request/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-request-18.0/stock-logistics-request-18.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-request-18-0/stock-logistics-request-18-0-stock_request/
…perations and improves in stock.view_move_form
Currently translated at 97.6% (169 of 173 strings)

Translation: stock-logistics-request-18.0/stock-logistics-request-18.0-stock_request
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-request-18-0/stock-logistics-request-18-0-stock_request/tr/
@kirca kirca force-pushed the 19.0-mig-stock_request branch 2 times, most recently from 4627857 to 7c0a905 Compare January 27, 2026 15:19
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

I did a functional review. It works well but I found an issue, that is probably affecting other versions of the module:

Steps to Reproduce

Setup:

Create a custom route to internally supply a location in the warehouse:

Rule 1: Pull from Location A to Location B (Procure Method: "Take from stock, if unavailable, trigger another rule")

Rule 2: Buy to Location A (standard Buy rule )

Create a product with this that route enabled
Set stock quantity in Location A to 3 units

Reproduce:

Create a stock request for 10 units to Location B
Confirm the stock request

Expected Result:

Internal transfer created for 3 units (available stock)
Purchase Order created for 7 units (shortage)
PO line linked to stock request via stock_request_ids

Actual Result:

  • Internal transfer created for 3 units
  • Purchase Order created for 7 units
  • PO line NOT linked to stock request --> This is not happening

I tested it together with the stock_request_purchase module. However, because potentially there it could be more chained rules than the scenario above I consider it is not harmful to include the code in the base module. I can propose the 'fix' to a previous version if you prefer that.

permissions (example: productions)."""
res = super()._action_done(cancel_backorder=cancel_backorder)
self.mapped("allocation_ids.stock_request_id").sudo().check_done()
return res
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add this code here? Reason explained in the review main comment.

    def _prepare_procurement_values(self):
        """Propagate stock_request_ids when creating procurement from moves"""
        values = super()._prepare_procurement_values()
        if self.stock_request_ids:
            values["stock_request_id"] = self.stock_request_ids[0].id

        return values

Comment on lines +168 to +172
for allocation in request.allocation_ids:
if allocation.stock_move_id.picking_code == "incoming":
incoming_qty += allocation.allocated_product_qty
else:
other_qty += allocation.allocated_product_qty
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for allocation in request.allocation_ids:
if allocation.stock_move_id.picking_code == "incoming":
incoming_qty += allocation.allocated_product_qty
else:
other_qty += allocation.allocated_product_qty
for allocation in request.allocation_ids:
if allocation.stock_move_id.move_dest_ids:
continue
if allocation.stock_move_id.picking_code == "incoming":
incoming_qty += allocation.allocated_product_qty
else:
other_qty += allocation.allocated_product_qty

Not due to this PR, but an issue that is present in v18 as well. Stock request qty_done was incorrectly calculated when using multi-step routes (e.g., Stock → Transit → Destination) because intermediate moves in the chain were counted, causing them to cancel each other out.
Solution: Skip moves that have move_dest_ids (intermediate moves in chain), only count the final destination move.

@kirca
Copy link
Author

kirca commented Feb 10, 2026

Hello @AaronHForgeFlow , thank you for the review!

The issue(s) you are describing are valid but I'm wondering if the second issue (counting allocations of the intermediate moves) is not result of your fix to the first issue (propagating the stock_request_id in case of multi step routes). If we propagate the stock_request_id this will mean an allocation will be created for all moves in the chain https://github.com/OCA/stock-logistics-request/blob/18.0/stock_request/models/stock_rule.py#L31. So this will create links to the stock_request which is then causing the issue in the _compute_qty method (could be in other places too). I'm wondering if this should be checked by the repo/module maintainers first. Perhaps it is best to track this in a separate PR and let others review it (including me!).

@AaronHForgeFlow
Copy link
Contributor

@kirca I see, the fixes proposed have some side effects. Perhaps we can discard them for now but put them in the readme as known issues.

@kirca
Copy link
Author

kirca commented Feb 11, 2026

@AaronHForgeFlow I've updated the roadmap with the issue and a possible solution

Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

Functional ok!

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.