diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-01 08:39:17 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-01 08:39:17 +0700 |
| commit | fb2ee6f00d4b8caf351b05db92af7bf0e4774ec8 (patch) | |
| tree | 0fbf3118ad855c658325a1a71f30162f4bf0b33e | |
| parent | eff76a5d9671ba8a39b58166e3df9428a1f10e0c (diff) | |
fix product template variants
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index e9d57dc3..b44f585e 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -51,6 +51,7 @@ class ProductTemplate(models.Model): is_new_product = fields.Boolean(string='Produk Baru', help='Centang jika ingin ditammpilkan di website sebagai segment Produk Baru') seq_new_product = fields.Integer(string='Seq New Product', help='Urutan Sequence New Product') + is_edited = fields.Boolean(string='Is Edited') # def write(self, vals): # if not self.env.user.is_purchasing_manager: @@ -331,6 +332,7 @@ class ProductProduct(models.Model): qty_onhand_bandengan = fields.Float(string='Qty Incoming Bandengan', compute='_get_qty_onhand_bandengan') qty_incoming_bandengan = fields.Float(string='Qty Incoming Bandengan', compute='_get_qty_incoming_bandengan') sla_version = fields.Integer(string="SLA Version", default=0) + is_edited = fields.Boolean(string='Is Edited') # def write(self, vals): # if not self.env.user.is_purchasing_manager: @@ -365,12 +367,15 @@ class ProductProduct(models.Model): raise UserError(massage) else: domain = [ - ('id', '=', product.id) + ('id', '=', product.id), + ('is_edited', '=', True), ] - massage="Hanya Pak Tyas Yang Dapat Merubah Data Product" - existing_purchase = self.search(domain, limit=1) + existing_purchase = self.search(domain) if existing_purchase: - raise UserError(massage) + raise UserError('Hanya Pak Tyas Yang Dapat Merubah Data Product') + if not existing_purchase: + true = True + self.is_edited = true @api.constrains('name') def _validate_name(self): |
