summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/account_move.py4
-rwxr-xr-xindoteknik_custom/models/product_template.py8
2 files changed, 9 insertions, 3 deletions
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
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 13654ab3..a812fc28 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 'solr_flag' not in vals and self.solr_flag == 1:
+ 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 '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)
def _compute_web_price(self):