summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-03-18 09:23:50 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-03-18 09:23:50 +0700
commitde8ac2be17f65cc1e551a0338ca49f30c4a021f2 (patch)
tree332dd85d758251f79dddcf0fb4e429c85498b0d3 /indoteknik_custom/models/product_template.py
parentc263662a9dd388eb9b23ae6ab8d9cd3f2bffb3f8 (diff)
parent9acebb424ead07109438e46c4f96038c9f50fbec (diff)
Merge branch 'odoo-backup' into cr/manzila-commision
# Conflicts: # indoteknik_custom/models/commision.py # indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index efacb95f..600dd90e 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -422,6 +422,18 @@ class ProductProduct(models.Model):
merchandise_ok = fields.Boolean(string='Product Promotion')
qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant')
+ def generate_product_sla(self):
+ product_variant_ids = self.env.context.get('active_ids', [])
+ product_variant = self.search([('id', 'in', product_variant_ids)])
+ sla_record = self.env['product.sla'].search([('product_variant_id', '=', product_variant.id)], limit=1)
+
+ if sla_record:
+ sla_record.generate_product_sla()
+ else:
+ new_sla_record = self.env['product.sla'].create({
+ 'product_variant_id': product_variant.id,
+ })
+ new_sla_record.generate_product_sla()
@api.model
def create(self, vals):
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id