[FIX] product: keep package.company_id in view

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: 0e4ae108cc191ca469770c456a341e455d664886
Part-of: odoo/odoo#140025
This commit is contained in:
Levi Siuzdak (sile)
2023-10-27 14:22:03 +00:00
parent ecc6066642
commit 10ede45cf5
@@ -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>