Skip to content

Comments

[18.0][FIX] product_secondary_unit: UoM conversion in secondary unit mixin#2182

Merged
OCA-git-bot merged 1 commit intoOCA:18.0from
qrtl:6285-imp-product_attribute
Feb 16, 2026
Merged

[18.0][FIX] product_secondary_unit: UoM conversion in secondary unit mixin#2182
OCA-git-bot merged 1 commit intoOCA:18.0from
qrtl:6285-imp-product_attribute

Conversation

@AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Jan 6, 2026

  • Replace _get_factor_line() with uom._compute_quantity() to fix incorrect conversion when line UoM differs from product's base UoM. The previous method failed for certain UoM combinations

Related: OCA/stock-logistics-warehouse#2496

@qrtl QT6285

@OCA-git-bot
Copy link
Contributor

Hi @sergio-teruel,
some modules you are maintaining are being modified, check this out!

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

Code review. LGTM.

Copy link
Contributor

@nobuQuartile nobuQuartile left a comment

Choose a reason for hiding this comment

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

LGTM Code review

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

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

Code review.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from 9a080ba to 4cf667a Compare January 20, 2026 05:40
@AungKoKoLin1997
Copy link
Contributor Author

In my last commit, I add the configuration for qweb reports presentation.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from 3722287 to f207287 Compare January 21, 2026 04:22
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch 2 times, most recently from 5fb5d21 to 6eb4143 Compare January 21, 2026 08:43
@AungKoKoLin1997 AungKoKoLin1997 changed the title [18.0][IMP] product_secondary_unit: refactor _compute_secondary_uom_qty [18.0][FIX] product_secondary_unit: UoM conversion in secondary unit mixin Jan 21, 2026
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

Partial review.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch 2 times, most recently from 3b7c135 to c8dcb39 Compare January 22, 2026 01:57
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch 2 times, most recently from 0ce7836 to 687642c Compare January 22, 2026 03:17
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from 72ea224 to eeedb26 Compare February 9, 2026 07:26
Copy link
Member

@HviorForgeFlow HviorForgeFlow left a comment

Choose a reason for hiding this comment

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

Code review 👍

@mav-adhoc
Copy link

LGTM

@HviorForgeFlow
Copy link
Member

@rousseldenis could we prioritize merging this, I merged a PR that is working on the top of this new changes, I didn't realize, and now we are blocking many edge users.

OCA/purchase-workflow#2932

Copy link
Contributor

@Reyes4711-S73 Reyes4711-S73 left a comment

Choose a reason for hiding this comment

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

LGTM

@HviorForgeFlow
Copy link
Member

@pedrobaeza @legalsylvain could you merge this? Appreciate

@pedrobaeza pedrobaeza added this to the 18.0 milestone Feb 12, 2026
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Sorry, but the text putting that the previous code fails for certain conversion is not enough for me. In fact, there are no regression tests for those cases. I only see that in the test, the base UoM is changed, making me suspect that something is altering the result of the previous tests.

@AungKoKoLin1997 can you explain the problems? This is also mixing something that is not a fix and the main PR subject. It's OK having it in a different commit, but both should be discussed separately IMO. Starting with, this is only used for sales/purchase, so they should be in their respective modules. OK to have the common selection options here, but not the fields, as if you install only this module and sale, you will see useless options in the configuration. Or am I misunderstanding anything?

@AungKoKoLin1997
Copy link
Contributor Author

AungKoKoLin1997 commented Feb 13, 2026

@pedrobaeza
In my first commit, I added a new test case for the UOM conversion fix.

OK to have the common selection options here, but not the fields, as if you install only this module and sale, you will see useless options in the configuration.

I added non-stored fields to hide the options if the related modules aren’t installed, preventing user confusion.
Could you please review?

@pedrobaeza
Copy link
Member

I still don't like that. Please add them directly in sale_secondary_unit / purchase_secondary_unit, not here. And please split in 2 PRs for discussing both separatetly.

@AungKoKoLin1997
Copy link
Contributor Author

@pedrobaeza
The reason I’m adding these fields in this module (instead of sale_order_secondary_unit and purchase_order_secondary_unit) is that I’m planning to introduce an account_move_secondary_unit module. In that module, I’d like to reuse the Sale/Purchase configurations depending on the document type (customer invoice vs. vendor bill).

If the configuration lives only in the sale_secondary_unit / purchase_secondary_unit, then account_move_secondary_unit would likely need to depend on both modules, which I’d prefer to avoid if possible.

So I’m leaning toward adding these fields in product_secondary_unit, so the configuration can be shared and reused across Sale, Purchase, and Invoicing.

@pedrobaeza
Copy link
Member

OK, please open a separate PR for that feature, and explain in commit message and in comments that intention and the reason for that. I personally don't like that configurations anyway, as if you install the modules, you should see them. I think you should go instead with security groups.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from a7b145f to bdcaabc Compare February 16, 2026 03:42
@AungKoKoLin1997
Copy link
Contributor Author

AungKoKoLin1997 commented Feb 16, 2026

@pedrobaeza @yostashiro @rousseldenis @HviorForgeFlow @Reyes4711-S73 @kanda999 @nobuQuartile
I made a separate PR for the report presentation settings. I also hide the settings when the related child modules aren’t installed by using security groups.

#2211

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from bdcaabc to e8d2ceb Compare February 16, 2026 09:10
Replace _get_factor_line() with uom._compute_quantity() to fix incorrect
conversion when line UoM differs from product's base UoM. The previous method
failed for certain UoM combinations (e.g., line in L, product in mL).

Co-authored-by: Yoshi Tashiro <tashiro@quartile.co>
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 6285-imp-product_attribute branch from e8d2ceb to 42e20c1 Compare February 16, 2026 10:43
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-2182-by-pedrobaeza-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit a9f785b into OCA:18.0 Feb 16, 2026
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 1282097. Thanks a lot for contributing to OCA. ❤️

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.

10 participants