diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-02-03 14:46:38 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-02-03 14:46:38 +0700 |
| commit | dd0158651c5fa665cde6c534e7f4283f86adafc9 (patch) | |
| tree | 55194f161f3f7e513fc6ea86b109cc9b05546e61 /indoteknik_custom/models/barcoding_product.py | |
| parent | b4249a4dbed1f982ce2355ea7b8245dd1c44da8d (diff) | |
add type on barcoding product
Diffstat (limited to 'indoteknik_custom/models/barcoding_product.py')
| -rw-r--r-- | indoteknik_custom/models/barcoding_product.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_custom/models/barcoding_product.py b/indoteknik_custom/models/barcoding_product.py index 6bbf9fde..e1b8f41f 100644 --- a/indoteknik_custom/models/barcoding_product.py +++ b/indoteknik_custom/models/barcoding_product.py @@ -12,6 +12,14 @@ class BarcodingProduct(models.Model): barcoding_product_line = fields.One2many('barcoding.product.line', 'barcoding_product_id', string='Barcoding Product Lines', auto_join=True) product_id = fields.Many2one('product.product', string="Product", tracking=3) quantity = fields.Float(string="Quantity", tracking=3) + type = fields.Selection([('print', 'Print Barcode'), ('barcoding', 'Add Barcode To Product')], string='Type', default='print') + barcode = fields.Char(string="Barcode") + + @api.constrains('barcode') + def _send_barcode_to_product(self): + for record in self: + if record.barcode and not record.product_id.barcode: + record.product_id.barcode = record.barcode @api.onchange('product_id', 'quantity') def _onchange_product_or_quantity(self): |
