OCA / margin-analysis

Odoo Financial Controlling (margin, costs, ...)
https://odoo-community.org/project/9
GNU Affero General Public License v3.0
71 stars 161 forks source link

Bug on product_margin_classification when variants product not activated on DB #180

Closed vdewulf closed 7 months ago

vdewulf commented 1 year ago

Module

product_margin_classification

Describe the bug

When selecting a product margin classification on a product form, the field is empty when saving manually (and if we don't save manually as not required on v16, the field is empty when moving to another screen).

To Reproduce

Affected versions: v16

Steps to reproduce the behavior:

  1. Install module, create a margin classification in the configuration
  2. Go on a product form (product.template) and select a value on the product margin classification field
  3. Save => the field is empty (no error is displayed)

Expected behavior

  1. Save => the field keeps the value selected by user

Additional context We investigated the issue with a developer in our team @huguesdk. Issue comes from the fact that the value of this field on the product.template is overwritten by the value on the product.product. We think that in case there is no variants products on the database (hence 1 product.product for 1 product.template), the field should be exactly the same on both models (like the field pricelist for example).

We might propose a PR to fix this in the following months depending on the need of this module for our customers in v16. @legalsylvain fyi

github-actions[bot] commented 7 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

huguesdk commented 7 months ago

@legalsylvain has this been correctly fixed by #181?

vdewulf commented 7 months ago

I tested on runboat on v16.

Steps to reproduce the behavior:

Install module, déactivate variants, create a margin classification in the configuration
Go on a product form (product.template) and select a value on the product margin classification field
Save => the field keeps the value selected by user

OK

vdewulf commented 7 months ago

fixed