Skip to content

Commit

Permalink
[FIX] product: keep package.company_id in view
Browse files Browse the repository at this point in the history
Versions:
---------
- 16.0+

Steps to reproduce:
-------------------
1. install stock;
2. in Inventory settings, enable product packagings;
3. set the company_id of a product to current company;
4. in user settings, remove access to all other companies;
5. from the page of the edited product, add a package;
6. try to save changes.

Problem:
--------
User Error pops up due to incompatible companies on records.

Cause:
------
As of version 16.0, a field with the `groups="base.group_multi_company"`
attribute might as well not exist outside multi-company contexts,
preventing the context that automatically added a company_id to a newly
created package from working properly.

Solution:
---------
Add an invisible field containing the `company_id` with the
`groups="!base.group_multi_company"` attribute.

opw-3457782

X-original-commit: 0e4ae10
Part-of: odoo#140025
  • Loading branch information
lvsz committed Oct 27, 2023
1 parent ecc6066 commit 10ede45
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions addons/product/views/product_packaging_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom"/>
<field name="barcode" optional="hide"/>
<field name="company_id" groups="base.group_multi_company" optional="hide"/>
<field name="company_id" groups="!base.group_multi_company" invisible="1"/>
</tree>
</field>
</record>
Expand Down

0 comments on commit 10ede45

Please sign in to comment.