[18.0][IMP] product_secondary_unit: add configuration for report presentation#2211
Conversation
211015e to
b59ecd9
Compare
|
Hi @sergio-teruel, |
Add hidden security groups (group_sale_secondary_unit, group_purchase_secondary_unit) and company-level configuration fields for secondary unit price display and column visibility. These groups and settings are defined here in the base module so they can be shared across Sale, Purchase, and Invoicing without forcing account_move_secondary_unit to depend on sale_order_secondary_unit or purchase_order_secondary_unit. Each child module activates the relevant group(s) via implied_ids on install, which controls the visibility of the corresponding settings in the UI. Co-authored-by: Yoshi Tashiro <tashiro@quartile.co>
b59ecd9 to
b569a94
Compare
… unmerged dependency Partially revert a1eea87 for purchase order and quotation report templates. The reverted portions rely on methods (hide_secondary_uom_column, get_secondary_uom_display_mode) introduced by OCA/product-attribute#2211, which is not yet merged. Without that dependency, the reports would crash when printing. The secondary quantity column is kept but the conditional visibility and display mode logic are removed until the dependency is available.
| class ResCompany(models.Model): | ||
| _inherit = "res.company" | ||
|
|
||
| secondary_uom_price_display_sale = fields.Selection( |
There was a problem hiding this comment.
This configurability level seems a bit insane. Are you going to display UoM price on sale, but not on purchase, but show the UoM? Can't this be fit with a single security group "Show seconday unit prices"?
There was a problem hiding this comment.
For showing the UoM column option, it is intended only to preserve the existing Sales/Purchase report behavior of sale_order_secondary_unit and purchase_order_secondary_unit when Primary Unit Price Only is selected. For the other price display modes, the secondary UoM is already shown in the quantity and price columns, so showing an additional UoM column would be redundant.
I don't think Sales and Purchase should always share the same display style for the secondary unit price and the secondary unit column. Therefore, I prefer separate settings for Sales and Purchase documents, with separate security groups to control each document type.
There was a problem hiding this comment.
There was a problem hiding this comment.
But as said, this is too many configurations, while it's not a usual problem to show both. This only increases the maintenance burden to the main module being a residual feature that most people won't use, being enough with the default option. I think this has to be simplified.
There was a problem hiding this comment.
@pedrobaeza To me it makes sense to be able to configure sales and purchasing separately as they have different needs. But we can do the secondary UoM price display thing in a separate module if it's too much to be covered in the main module, which will mean four new additional modules (i.e., product_secondary_unit_price, purchase_order_secondary_unit_price, sale_order_secondary_unit_price and account_move_secondary_unit_price).
What we still want to do in this module, though, is to be able to hide the secondary qty column in reports. For this, we don't need to have separate config for sales and purchasing (as we will most likely disable this for both anyway).
Does this sound like a good approach?
There was a problem hiding this comment.
@sergio-teruel is the main creator of this module, so I let him to decide at last if he considers OK to have all the configuration tweaks in the main module.
kanda999
left a comment
There was a problem hiding this comment.
Confirmed that the report display changes depending on the option settings in my local
nobuQuartile
left a comment
There was a problem hiding this comment.
Functional review LGTM:
Check the report behaviour with the related purchase_order_secondary_unit PR code.



Add hidden security groups (
group_sale_secondary_unit,group_purchase_secondary_unit) and company-level configuration fields for secondary unit price display and column visibility.These groups and settings are defined here in the base module so they can be shared across Sale, Purchase, and Invoicing without forcing
account_move_secondary_unitto depend onsale_order_secondary_unitorpurchase_order_secondary_unit.Each child module activates the relevant group(s) via
implied_idson install, which controls the visibility of the corresponding settings in the UI.@qrtl QT6210