From 395cb850ae364b36764e9d5e0ee0ff8226916696 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 22 Nov 2023 10:37:22 +0700 Subject: Add product rating from sold amount --- indoteknik_custom/models/product_template.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom/models/product_template.py') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index d1de2221..264d0bbb 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -120,6 +120,8 @@ class ProductTemplate(models.Model): rate = 0 if product.web_price: rate += 4 + if product.qty_sold > 0: + rate += 3 if product.have_promotion_program: #have discount from pricelist rate += 5 if product.image_128: -- cgit v1.2.3 From 3e6c8343e93d7126f4002a23e396f22db7667774 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 24 Nov 2023 15:44:31 +0700 Subject: fix archive product --- indoteknik_custom/models/product_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/product_template.py') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 264d0bbb..90e8a144 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -315,8 +315,9 @@ class ProductTemplate(models.Model): return values def write(self, vals): - if self.id == 224484: - raise UserError('Tidak dapat mengubah produk sementara') + for rec in self: + if rec.id == 224484: + raise UserError('Tidak dapat mengubah produk sementara') return super(ProductTemplate, self).write(vals) -- cgit v1.2.3