From 6424192cdcb34ff2ea57a19b5ee41bf4bf68870c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 16 Jan 2025 13:29:35 +0700 Subject: push --- indoteknik_custom/models/product_template.py | 2 +- indoteknik_custom/models/stock_picking.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 5bedae13..29608297 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -416,7 +416,7 @@ class ProductProduct(models.Model): box_size=5, border=4, ) - qr.add_data(rec.default_code) + qr.add_data(rec.barcode if rec.barcode else rec.default_code) qr.make(fit=True) img = qr.make_image(fill_color="black", back_color="white") diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 05a7ee4a..cf5b0502 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -894,10 +894,20 @@ class StockPicking(models.Model): @api.model def create(self, vals): self._use_faktur(vals) + if vals.get('picking_type_code') == 'incoming' and vals.get('location_dest_id') == 58: + if 'name' in vals and vals['name'].startswith('BU/IN/'): + vals['name'] = vals['name'].replace('BU/IN/', 'BU/INPUT/', 1) return super(StockPicking, self).create(vals) def write(self, vals): self._use_faktur(vals) + for picking in self: + if (vals.get('picking_type_code', picking.picking_type_code) == 'incoming' and + vals.get('location_dest_id', picking.location_dest_id.id) == 58): + if 'name' in vals or picking.name.startswith('BU/IN/'): + name_to_modify = vals.get('name', picking.name) + if name_to_modify.startswith('BU/IN/'): + vals['name'] = name_to_modify.replace('BU/IN/', 'BU/INPUT/', 1) return super(StockPicking, self).write(vals) def _use_faktur(self, vals): -- cgit v1.2.3