From 955301fbaf26f847c72e7f0f9f4b8ab47708c906 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 17 Oct 2023 15:53:17 +0700 Subject: Add ignore change validation on temporary product --- indoteknik_custom/models/product_template.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 19bcc780..55a9288f 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -333,6 +333,12 @@ class ProductProduct(models.Model): is_edited = fields.Boolean(string='Is Edited') qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold') + def write(self, vals): + if self.id in [385544, 224484]: + raise UserError('Tidak dapat mengubah produk sementara') + + return super(ProductProduct, self).write(vals) + def _get_qty_upcoming(self): for product in self: product.qty_upcoming = product.incoming_qty + product.qty_available -- cgit v1.2.3