[IMP] purchase_order_weight_volume: resolve total UoM via standard helper - #3175
Open
Camille0907 wants to merge 3 commits into
Open
Camille0907 wants to merge 3 commits into
Camille0907 wants to merge 3 commits into
Conversation
Contributor
|
Hi @ilyasProgrammer, |
HviorForgeFlow
approved these changes
Sep 14, 2026
Member
|
Fix pre-commit |
BhaveshHeliconia
approved these changes
Sep 15, 2026
HviorForgeFlow
requested changes
Sep 22, 2026
HviorForgeFlow
left a comment
Member
There was a problem hiding this comment.
Attend comment #3175 (comment)
CI is broken
…helper `total_weight_uom_id` / `total_volume_uom_id` were read directly as a raw `uom.uom` id from the `ir.config_parameter` keys `product_default_weight_uom_id` / `product_default_volume_uom_id`. These parameters are only meaningful when the module `product_logistics_uom` (not in dependencies of the current module) is installed. If it is not installed, or was installed and later removed, the parameters can be missing, stale, or point to an orphaned/incompatible UoM. Since `uom.uom._compute_quantity()` does not validate that a conversion happens between compatible units, this could silently produce incorrect totals (e.g. a weight expressed in kg on the lines summed and displayed as if it were in ml on the total). The line weight/volume UoM already resolves through `product.template._get_weight_uom_id_from_ir_config_parameter()` / `_get_volume_uom_id_from_ir_config_parameter()`, the standard Odoo helper that reads the same parameters through `product_logistics_uom`'s override when installed, and safely falls back to kg/m3 otherwise. Use the same helper for the PO total, so lines and total are always expressed in compatible UoMs. This changes almost nothing in practice: if `product_logistics_uom` is installed and correctly configured, the helper returns the exact same UoM the raw parameter already pointed to. Whether the total is displayed at all is untouched: it can still be disabled entirely through the existing `display_order_weight_in_po` / `display_order_volume_in_po` company settings, as before.
vvrossem
force-pushed
the
19.0-imp-purchase_order_weight_volume
branch
from
September 25, 2026 09:14
cebd436 to
dd23f9f
Compare
…PO form The total volume label and value were hidden based on the weight settings (`total_weight_uom_id` / `display_order_weight_in_po`) instead of the volume ones, so the volume total could be hidden while enabled, or shown while disabled. Regression from the 19.0 migration (OCA#2901, cb2edf8): when converting `attrs` to `invisible`, the volume rows got the weight condition. Hide each total based on its own `display_order_*_in_po` setting only: the total UoMs are now always set by the standard helper, so the `total_*_uom_id == False` condition is no longer needed.
vvrossem
force-pushed
the
19.0-imp-purchase_order_weight_volume
branch
from
September 25, 2026 10:16
8b41ffb to
8722b5d
Compare
…ay settings `display_order_weight_in_po` / `display_order_volume_in_po` copied the company settings through a compute depending on `company_id` only: a PO value already read in the current transaction was not invalidated when the company setting changed, and kept returning the old value. Declare them as related fields: the dependencies on the company settings come for free, and the compute that only copied the values goes away.
vvrossem
force-pushed
the
19.0-imp-purchase_order_weight_volume
branch
from
September 25, 2026 10:20
8722b5d to
aeea72d
Compare
Contributor
|
Two related fixes added in the same module:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
total_weight_uom_id/total_volume_uom_idwere read directly as a rawuom.uomid from their.config_parameterkeysproduct_default_weight_uom_id/product_default_volume_uom_id. These parameters are only meaningful when the moduleproduct_logistics_uom(not in dependencies of the current module) is installed. If it is not installed, or was installed and later removed, the parameters can be missing, stale, or point to an orphaned/incompatible UoM. Sinceuom.uom._compute_quantity()does not validate that a conversion happens between compatible units, this could silently produce incorrect totals (e.g. a weight expressed in kg on the lines summed and displayed as if it were in ml on the total).The line weight/volume UoM already resolves through
product.template._get_weight_uom_id_from_ir_config_parameter()/_get_volume_uom_id_from_ir_config_parameter(), the standard Odoo helper that reads the same parameters throughproduct_logistics_uom's override when installed, and safely falls back to kg/m3 otherwise. Use the same helper for the PO total, so lines and total are always expressed in compatible UoMs.This changes almost nothing in practice: if
product_logistics_uomis installed and correctly configured, the helper returns the exact same UoM the raw parameter already pointed to. Whether the total is displayed at all is untouched: it can still be disabled entirely through the existingdisplay_order_weight_in_po/display_order_volume_in_pocompany settings, as before.