summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
diff options
context:
space:
mode:
authorHafidBuroiroh <hafidburoiroh09@gmail.com>2026-03-10 10:46:23 +0700
committerHafidBuroiroh <hafidburoiroh09@gmail.com>2026-03-10 10:46:23 +0700
commitf58fe20f96995228651a5a1a09c8c17a23e13838 (patch)
treedc6700fe931d229523c478ac6f290b3e45ae871c /indoteknik_custom/models/product_template.py
parentd91af3da1edea3c6b8074726e5306ea42a7c0a4b (diff)
<hafid> final change request
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 56022d06..ecaf9106 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -91,7 +91,8 @@ class ProductTemplate(models.Model):
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id
users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])])
active_model = self.env.context.get('active_model')
- if self.env.user.id not in users_in_group.mapped('id') and active_model == None:
+ from_sourcing = self.env.context.get('from_sourcing_approval')
+ if self.env.user.id not in users_in_group.mapped('id') and active_model == None and not from_sourcing:
raise UserError('Hanya MD yang bisa membuat Product')
result = super(ProductTemplate, self).create(vals)
return result
@@ -983,7 +984,8 @@ class ProductProduct(models.Model):
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id
active_model = self.env.context.get('active_model')
users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])])
- if self.env.user.id not in users_in_group.mapped('id') and active_model == None:
+ from_sourcing = self.env.context.get('from_sourcing_approval')
+ if self.env.user.id not in users_in_group.mapped('id') and active_model == None and not from_sourcing:
raise UserError('Hanya MD yang bisa membuat Product')
result = super(ProductProduct, self).create(vals)
return result