summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-17 15:53:17 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-17 15:53:17 +0700
commit955301fbaf26f847c72e7f0f9f4b8ab47708c906 (patch)
tree3885ca68fb5778dce37ad8974c35d89bf0d9bad0
parentee9255e9e404938fa7a49d8219b14101df84f8b9 (diff)
Add ignore change validation on temporary product
-rwxr-xr-xindoteknik_custom/models/product_template.py6
1 files changed, 6 insertions, 0 deletions
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