From e68240fe7de4b327785f80ad629b34550c3d8554 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 2 Nov 2022 09:56:24 +0700 Subject: fix error open journal entries --- indoteknik_custom/models/account_move.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index aa4b0b1e..1e0c56cf 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -15,6 +15,8 @@ class AccountMove(models.Model): @api.onchange('date_kirim_tukar_faktur') def change_date_kirim_tukar_faktur(self): for invoice in self: + if not invoice.date_kirim_tukar_faktur: + return tukar_date = invoice.date_kirim_tukar_faktur term = invoice.invoice_payment_term_id add_days = 0 @@ -26,6 +28,8 @@ class AccountMove(models.Model): @api.onchange('date_terima_tukar_faktur') def change_date_terima_tukar_faktur(self): for invoice in self: + if not invoice.date_terima_tukar_faktur: + return tukar_date = invoice.date_terima_tukar_faktur term = invoice.invoice_payment_term_id add_days = 0 -- cgit v1.2.3 From 4396d6b781775f4b0be4b076e65d9ec8b29a01aa Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 2 Nov 2022 11:21:54 +0700 Subject: Update product_template.py --- indoteknik_custom/models/product_template.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 13654ab3..6bd1acda 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -35,7 +35,8 @@ class ProductTemplate(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - vals['solr_flag'] = 2 + if not vals['solr_flag']: + vals['solr_flag'] = 2 return super().write(vals) def _compute_qty_stock_vendor(self): @@ -150,8 +151,9 @@ class ProductProduct(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - self.product_tmpl_id.solr_flag = 2 - vals['solr_flag'] = 2 + if not vals['solr_flag']: + self.product_tmpl_id.solr_flag = 2 + vals['solr_flag'] = 2 return super().write(vals) def _compute_web_price(self): -- cgit v1.2.3 From 4b77d80172abc5576f495d444dddd078b752efb5 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 2 Nov 2022 11:28:02 +0700 Subject: Update product_template.py --- indoteknik_custom/models/product_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 6bd1acda..2ce577ce 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -35,7 +35,7 @@ class ProductTemplate(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if not vals['solr_flag']: + if 'solr_flag' in vals: vals['solr_flag'] = 2 return super().write(vals) @@ -151,7 +151,7 @@ class ProductProduct(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if not vals['solr_flag']: + if 'solr_flag' in vals: self.product_tmpl_id.solr_flag = 2 vals['solr_flag'] = 2 return super().write(vals) -- cgit v1.2.3 From bf99a04f7c5530da790e25e67b9786ec0dffeb9b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 2 Nov 2022 11:30:35 +0700 Subject: Update product_template.py --- indoteknik_custom/models/product_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 2ce577ce..33073e57 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -35,7 +35,7 @@ class ProductTemplate(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if 'solr_flag' in vals: + if 'solr_flag' not in vals: vals['solr_flag'] = 2 return super().write(vals) @@ -151,7 +151,7 @@ class ProductProduct(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if 'solr_flag' in vals: + if 'solr_flag' not in vals: self.product_tmpl_id.solr_flag = 2 vals['solr_flag'] = 2 return super().write(vals) -- cgit v1.2.3 From c5e1a624c8cc015d8fe457a90cd5bc3c7571b5eb Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 2 Nov 2022 14:20:29 +0700 Subject: Update product_template.py --- indoteknik_custom/models/product_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 33073e57..a812fc28 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -35,7 +35,7 @@ class ProductTemplate(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if 'solr_flag' not in vals: + if 'solr_flag' not in vals and self.solr_flag == 1: vals['solr_flag'] = 2 return super().write(vals) @@ -151,7 +151,7 @@ class ProductProduct(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if 'solr_flag' not in vals: + if 'solr_flag' not in vals and self.solr_flag == 1: self.product_tmpl_id.solr_flag = 2 vals['solr_flag'] = 2 return super().write(vals) -- cgit v1.2.3