From 7bfc92fdb73a89c5bc0b4c711315cbd5ea3ff268 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Tue, 24 Feb 2026 08:47:38 +0700 Subject: sourcing job dari sale order ga include crm --- indoteknik_custom/models/product_template.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom/models/product_template.py') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 397bd06d..969c9765 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -947,6 +947,11 @@ class ProductProduct(models.Model): qty_pcs_box = fields.Float("Pcs Box") barcode_box = fields.Char("Barcode Box") keyword_id = fields.Many2one('keywords', string='Keyword') + sourcing_job_id = fields.Many2one( + "sourcing.job.order", + string="Sourcing Job", + readonly=True, + ) def _add_product_to_keywords(self,product): keywords_model = self.env['keywords'] -- cgit v1.2.3 From f58fe20f96995228651a5a1a09c8c17a23e13838 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Tue, 10 Mar 2026 10:46:23 +0700 Subject: final change request --- indoteknik_custom/models/product_template.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/product_template.py') 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 -- cgit v1.2.3