Skip to content

Commit

Permalink
[IMP] product_supplierinfo_intercompany: handle active toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-RB committed Aug 20, 2024
1 parent d2e6146 commit 7e94149
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions product_supplierinfo_intercompany/models/product_pricelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ def _unactive_intercompany(self):
self.sudo().with_context(automatic_intercompany_sync=True).mapped(
"generated_supplierinfo_ids"
).unlink()

def toggle_active(self):
super().toggle_active()
for rec in self:
if rec.active:
rec._active_intercompany()
else:
rec._unactive_intercompany()
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def test_unset_pricelist_intercompany(self):
supplierinfo = self._get_supplier_info()
self.assertEqual(len(supplierinfo), 0)

def test_unactive_pricelist_intercompany(self):
self.pricelist_intercompany.toggle_active()
supplierinfo = self._get_supplier_info()
self.assertEqual(len(supplierinfo), 0)
self.pricelist_intercompany.toggle_active()
supplierinfo = self._get_supplier_info()
self.assertEqual(len(supplierinfo), 4)

def test_intercompany_access_rule(self):
# Check that supplier this supplier info are not visible
# with the current user "demo"
Expand Down

0 comments on commit 7e94149

Please sign in to comment.