Skip to content

[16.0][FIX] Avoid repetition of lines at reception#2816

Open
CILC98 wants to merge 1 commit intoOCA:16.0from
CILC98:CILC16.0-fix-duplicate-move-line
Open

[16.0][FIX] Avoid repetition of lines at reception#2816
CILC98 wants to merge 1 commit intoOCA:16.0from
CILC98:CILC16.0-fix-duplicate-move-line

Conversation

@CILC98
Copy link
Copy Markdown
Contributor

@CILC98 CILC98 commented Sep 17, 2025

This change prevents the creation of lines when receiving products. This will also prevent inventory valuation from being corrupted, such that if there is more than one line (stock.move), the valuation will be incorrect when the purchase order has been invoiced previously.

Before
https://github.com/user-attachments/assets/64041144-a51f-47d4-a401-bc69f9844341

After
https://github.com/user-attachments/assets/be2eb62a-dff3-4794-8bf9-ef5c509cfd73

@CILC98
Copy link
Copy Markdown
Contributor Author

CILC98 commented Sep 22, 2025

Please @pedrobaeza and @carlos-lopez-tecnativa can you review it?

@pedrobaeza pedrobaeza added this to the 16.0 milestone Sep 22, 2025
@pedrobaeza
Copy link
Copy Markdown
Member

Tests are in red.

@CILC98 CILC98 closed this Oct 3, 2025
@CILC98 CILC98 force-pushed the CILC16.0-fix-duplicate-move-line branch from 6fa938b to 61d2a7d Compare October 3, 2025 00:27
@CILC98 CILC98 reopened this Oct 3, 2025
@CILC98 CILC98 force-pushed the CILC16.0-fix-duplicate-move-line branch from 18fd225 to b39d765 Compare October 3, 2025 00:53
@CILC98
Copy link
Copy Markdown
Contributor Author

CILC98 commented Oct 3, 2025

@pedrobaeza Hi Pedro, there's a constraint in the purchase_order_no_zero_price module that's preventing the tests from running properly. In my opinion, this module shouldn't be involved in the purchase_request module tests. Could you help me by telling me why this might be happening? I'd be very grateful in advance.

@pedrobaeza
Copy link
Copy Markdown
Member

Well, why don't you assure your PO lines are not 0 price unit in the tests to avoid it?

@CILC98 CILC98 force-pushed the CILC16.0-fix-duplicate-move-line branch from ff19259 to 88356b4 Compare October 3, 2025 14:25
@CILC98
Copy link
Copy Markdown
Contributor Author

CILC98 commented Oct 3, 2025

@pedrobaeza I followed your recommendation and it worked. Thank you. Can you review it please?

Is smiliar to #2819 but the time zone is not a problem

Comment on lines +120 to +121
purchase = purchase_request_line.purchase_lines.write({"price_unit": 100.0})
self.assertEqual(purchase, True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And the rest for the same.

Suggested change
purchase = purchase_request_line.purchase_lines.write({"price_unit": 100.0})
self.assertEqual(purchase, True)
purchase_request_line.purchase_lines.price_unit = 100.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've already adjusted it.

@CILC98 CILC98 force-pushed the CILC16.0-fix-duplicate-move-line branch 4 times, most recently from 4bd7128 to 346aa32 Compare October 3, 2025 21:03
@CILC98 CILC98 force-pushed the CILC16.0-fix-duplicate-move-line branch from 346aa32 to e1419bc Compare October 3, 2025 21:06
@CILC98
Copy link
Copy Markdown
Contributor Author

CILC98 commented Oct 7, 2025

Hi @victoralmau this PR is similar to #2819 which one you helped me. Can you help again with the review please?

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.

2 participants