Skip to content

Commit

Permalink
[MIG] fiscal_company_product: Migration to 16.0 (from 12.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Nov 27, 2024
1 parent 02f9920 commit ed70f39
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fiscal_company_product/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "CAE - Product",
"version": "12.0.1.1.1",
"version": "16.0.1.0.0",
"category": "CAE",
"summary": "Glue Module between CAE and Product modules",
"author": "GRAP",
Expand Down
2 changes: 0 additions & 2 deletions fiscal_company_product/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def create(self, vals):
self._check_administrative_access()
return super().create(vals)

@api.multi
def write(self, vals):
forbidden_fields = [
key
Expand All @@ -37,7 +36,6 @@ def write(self, vals):
self._check_administrative_access()
return super().write(vals)

@api.multi
def unlink(self):
if any(self.mapped("cae_administrative_ok")):
self._check_administrative_access()
Expand Down
6 changes: 3 additions & 3 deletions fiscal_company_product/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def test_01_administrative_product_creation(self):
# Try to write on administrative product with user that is not
# CAE manager should fail if the field is protected
with self.assertRaises(ValidationError):
product.sudo(self.user_worker).write({"name": "New name"})
product.with_user(self.user_worker).write({"name": "New name"})

# Try to write on administrative product with user that is not
# CAE manager should success if the field is not protected
with self.assertRaises(ValidationError):
product.sudo(self.user_worker).write({"lst_price": 5.0})
product.with_user(self.user_worker).write({"lst_price": 5.0})

def _create_administrative_product(self, user):
product_vals = {
Expand All @@ -57,7 +57,7 @@ def _create_administrative_product(self, user):
}
user.company_id = self.child_company.id
return (
self.ProductProduct.sudo(user)
self.ProductProduct.with_user(user)
.with_context(mail_create_nosubscribe=True, mail_create_nolog=True)
.create(product_vals)
)

0 comments on commit ed70f39

Please sign in to comment.