Skip to content

Commit

Permalink
[FIX] product_multi_company: recompute variant companies
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Feb 23, 2024
1 parent d248a27 commit 437b94b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion product_multi_company/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Product multi-company
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c0b3d1060c5a3b214c6a2264ef198fd7c40aed60ab30b6c35c6830aa70e3dc0e
!! source digest: sha256:14c252bd170be5831503257961d346adca028abbdbbaba5c63b092382e70547c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
1 change: 1 addition & 0 deletions product_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import base
from . import product_template
from . import product_category
16 changes: 16 additions & 0 deletions product_multi_company/models/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import models


class Base(models.AbstractModel):
_inherit = "base"

def _compute_field_value(self, field):
# Remove cached company_ids
if field.name == "company_ids":
self.env.cache.remove(
self.product_tmpl_id, self.product_tmpl_id._fields["company_ids"]
)
res = super(Base, self)._compute_field_value(field)
return res
14 changes: 14 additions & 0 deletions product_multi_company/security/product_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">

<record id="product_variant_comp_rule" model="ir.rule">
<field name="name">Product Variant multi-company</field>
<field name="model_id" ref="product.model_product_product" />
<field
name="domain_force"
> ['|', ('company_id', 'in', company_ids), ('company_id', '=', False)]</field>
</record>

</data>
</odoo>
2 changes: 1 addition & 1 deletion product_multi_company/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Product multi-company</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c0b3d1060c5a3b214c6a2264ef198fd7c40aed60ab30b6c35c6830aa70e3dc0e
!! source digest: sha256:14c252bd170be5831503257961d346adca028abbdbbaba5c63b092382e70547c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/multi-company/tree/14.0/product_multi_company"><img alt="OCA/multi-company" src="https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/multi-company-14-0/multi-company-14-0-product_multi_company"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/multi-company&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This modules allows to select in which of the companies you want to use each of the product templates.</p>
Expand Down

0 comments on commit 437b94b

Please sign in to comment.