diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-03-13 10:11:33 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-03-13 10:11:33 +0700 |
| commit | ed9a8ebd0e3a16ac501da848fd4dbc5ae0ce6ff5 (patch) | |
| tree | 5585297ea85e86eaa09da2d0c20373fd64bd8c5b /indoteknik_custom/models/product_template.py | |
| parent | 60de643d4a5f19abc7bee34ccd2e6e6f6219a750 (diff) | |
| parent | 1ff9a57e2f7a7ecb3ba9321f7133f43e7009aa47 (diff) | |
Merge branch 'odoo-backup' into CR/renca-banner
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 12 |
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 |
