|
@@ -16,17 +16,18 @@ class sale_order(models.Model):
|
|
|
@api.one
|
|
|
def check_limit(self):
|
|
|
|
|
|
- if self.contado == True:
|
|
|
- return True
|
|
|
-
|
|
|
- available_credit = self.partner_id.credit_limit - self.partner_id.credit
|
|
|
-
|
|
|
- if self.amount_total > available_credit:
|
|
|
- msg = 'No se puede confirmar el Pedido ya que el cliente no tiene crédito suficiente.\
|
|
|
- Pruebe marcar la opción "Contado"'
|
|
|
- raise Warning(_(msg))
|
|
|
- return False
|
|
|
- return True
|
|
|
+ if self.contado == True:
|
|
|
+ return True
|
|
|
+
|
|
|
+ available_credit = self.partner_id.credit_limit - self.partner_id.credit
|
|
|
+
|
|
|
+ if self.amount_total > available_credit:
|
|
|
+ if not self.user_has_groups('partner_credito_limite.groups_partner_credito_limite'):
|
|
|
+ msg = 'No se puede confirmar el Pedido ya que el cliente no tiene crédito suficiente.\
|
|
|
+ Pruebe marcar la opción "Contado"'
|
|
|
+ raise Warning(_(msg))
|
|
|
+ return False
|
|
|
+ return True
|
|
|
|
|
|
#@api.one
|
|
|
#def check_morosidad(self):
|