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 a121f89 commit 59e8596
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 4 additions & 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:1cb9618b893555cdec0f0b75ac016cd378d12b719a3bf61e8044545cc2ac097a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -78,6 +78,9 @@ Contributors
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Denis Roussel <denis.roussel@acsone.eu>

* Ooops404 <https://ooops404.com>
* Ilyas <irazor147@gmail.com>

Maintainers
~~~~~~~~~~~

Expand Down
1 change: 0 additions & 1 deletion product_multi_company/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ProductProduct(models.Model):
)

@api.depends("product_tmpl_id.company_ids")
@api.depends_context("uid")
def _compute_company_ids(self):
for rec in self:
rec.company_ids = [(6, 0, rec.product_tmpl_id.company_ids.ids)]
10 changes: 9 additions & 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:1cb9618b893555cdec0f0b75ac016cd378d12b719a3bf61e8044545cc2ac097a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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 Expand Up @@ -424,6 +424,14 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</ul>
</li>
<li>Denis Roussel &lt;<a class="reference external" href="mailto:denis.roussel&#64;acsone.eu">denis.roussel&#64;acsone.eu</a>&gt;</li>
<li><dl class="first docutils">
<dt>Ooops404 &lt;<a class="reference external" href="https://ooops404.com">https://ooops404.com</a>&gt;</dt>
<dd><ul class="first last">
<li>Ilyas &lt;<a class="reference external" href="mailto:irazor147&#64;gmail.com">irazor147&#64;gmail.com</a>&gt;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
6 changes: 6 additions & 0 deletions product_multi_company/tests/test_product_multi_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def test_company_none(self):
).description_sale = "Test 2"

def test_company_1(self):
self.product_company_1.product_tmpl_id.company_ids = [
(6, 0, self.company_1.ids)
]
self.assertEqual(
self.product_company_1.with_user(self.user_company_1).company_id,
self.company_1,
Expand All @@ -42,6 +45,9 @@ def test_company_1(self):
).description_sale = "Test 3"

def test_company_2(self):
self.product_company_2.product_tmpl_id.company_ids = [
(6, 0, self.company_2.ids)
]
self.assertEqual(
self.product_company_2.with_user(self.user_company_2).company_id,
self.company_2,
Expand Down

0 comments on commit 59e8596

Please sign in to comment.