-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[13.0][FIX] purchase_sale_stock_inter_company: Allow reception with serial tracking and partial quantity (Dropshipping) #733
Conversation
po_picking_pending = purchase.picking_ids.filtered( | ||
lambda x: x.state not in ["done", "cancel"] | ||
) | ||
po_picking_pending.write({"intercompany_picking_id": pick.id}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it gets the same result, I consider dot notation cleaner:
po_picking_pending.write({"intercompany_picking_id": pick.id}) | |
po_picking_pending.intercompany_picking_id = pick.id |
and why writing this on each loop? It seems a bit weird this structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don’t understand. I only adapted the current code, but I don’t know the reasons. I think the action_done method can expect many records, and it’s better to iterate in a for loop.
"corresponding PO %s for assigning " | ||
"quantities and lots from %s for product %s" | ||
po_move_lines = po_moves_pending.mapped("move_line_ids") | ||
if move.product_id.tracking == "serial": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doing a special case depending on the product tracking instead of just mimicking the stock.move.line
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doing a special case depending on the product tracking instead of just mimicking the
stock.move.line
?
My error occurs only with serial products, so I isolated the error. In other cases, the check is fine, but for serial products, it’s not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, as lots may have the same problem if you have more than one lot. As said, you should mimic the stock.move.line
in one place and the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, please update your review
90be4a2
to
875853a
Compare
…tracking and partial quantity (Dropshipping) Issue: When handling intercompany dropshipping with serialized products, an error is raised during reception if the quantity received is less than the original purchase order's quantity. The error message states: "Mismatch between move lines with the corresponding." Steps to Reproduce: Settings: In General Settings (both companies): Enable Sales from Purchase Orders. Disable Sales Order Auto Validation. In Purchase Settings: Enable Dropshipping. In Inventory Settings: Enable Multi-Step Routes. Setup: In Company 1: Configure a product with vendor information linked to Company 2. In Company 2: Configure the same product with vendor information linked to any other vendor (not a company contact). Scenario: In Company 1: Create a sales order with a line using the Dropshipping route and the configured product. Confirm the sales order. Navigate to Purchase Orders, find the related record, and confirm it. Switch to Company 2: Locate the generated sales order and update the sales line to use the Dropshipping route. Set the quantity to 2 and confirm the sales order. Go to Purchase Orders, find the related record, and confirm it. Navigate to Receipts for the purchase order, enter the lot/serial numbers, and attempt to validate the receipt. Result: An error is raised, preventing the validation of the receipt due to a mismatch between the move lines and their corresponding records.
875853a
to
5118408
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, this change is not changing existing stock.move.line
to adapt things like the quantity, so it's not a real synchronization like it should be.
@pedrobaeza I updated the code to synchronize the |
6b5b806
to
d072eb8
Compare
…the origin company to the destination company The synchronization is done only when the picking is in the "Done" state because, before that, the lots are not yet synchronized.
d072eb8
to
bc478bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review OK
This PR has the |
/ocabot merge patch |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 1e155d1. Thanks a lot for contributing to OCA. ❤️ |
Issue: When handling intercompany dropshipping with serialized products, an error is raised during reception if the quantity received is less than the original purchase order's quantity. The error message states: "Mismatch between move lines with the corresponding."
Steps to Reproduce:
Settings:
In General Settings (both companies):
Setup:
In Company 1:
Configure a product with vendor information linked to Company 2.
In Company 2:
Configure the same product with vendor information linked to any other vendor (not a company contact).
Scenario:
In Company 1:
Switch to Company 2:
Result: An error is raised, preventing the validation of the receipt due to a mismatch between the move lines and their corresponding records.
SO in C1
http://oca-multi-company-13-0-c48386e2793f.runboat.odoo-community.org/web#id=25&action=376&model=sale.order&view_type=form&cids=1&menu_id=224
PO in C1
http://oca-multi-company-13-0-c48386e2793f.runboat.odoo-community.org/web#id=12&action=355&model=purchase.order&view_type=form&cids=&menu_id=206
SO in C2
http://oca-multi-company-13-0-c48386e2793f.runboat.odoo-community.org/web#id=26&action=376&model=sale.order&view_type=form&cids=2&menu_id=224
PO in C2
http://oca-multi-company-13-0-c48386e2793f.runboat.odoo-community.org/web#id=13&action=355&model=purchase.order&view_type=form&cids=&menu_id=206
TT51858
@Tecnativa @pedrobaeza could you please review this