deisy 5 anni fa
parent
commit
1b681a7f18
2 ha cambiato i file con 10 aggiunte e 9 eliminazioni
  1. 5 5
      models/account_invoice.py
  2. 5 4
      models/purchase_order.py

+ 5 - 5
models/account_invoice.py

@@ -7,14 +7,14 @@ class account_invoice(models.Model):
     contado = fields.Boolean('Contado')
     credito = fields.Boolean('Crédito')
 
-    @api.one
-    @api.onchange('credito')
-    def cambiar_estado_credito(self):
-        self.contado = not self.credito
-
     @api.one
     @api.onchange('contado')
     def cambiar_estado_contado(self):
         self.credito = not self.contado
         if self.contado == True:
             self.payment_term = False
+
+    @api.one
+    @api.onchange('credito')
+    def cambiar_estado_credito(self):
+        self.contado = not self.credito

+ 5 - 4
models/purchase_order.py

@@ -13,10 +13,6 @@ class purchase_order(models.Model):
     contado = fields.Boolean('Contado')
     credito = fields.Boolean('Crédito')
 
-    @api.one
-    @api.onchange('credito')
-    def cambiar_estado_credito(self):
-        self.contado = not self.credito
 
     @api.one
     @api.onchange('contado')
@@ -25,6 +21,11 @@ class purchase_order(models.Model):
         if self.contado == True:
             self.payment_term = False
 
+    @api.one
+    @api.onchange('credito')
+    def cambiar_estado_credito(self):
+        self.contado = not self.credito
+
     def _convert_str_to_datetime(self, date):
         return datetime.strptime(date,DEFAULT_SERVER_DATETIME_FORMAT)