account_invoice.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #-*- coding:utf-8 -*-
  2. from openerp import models, api, _
  3. from openerp.exceptions import Warning
  4. from datetime import datetime, date
  5. #
  6. # class account_invoice(models.Model):
  7. # _inherit = "account.invoice"
  8. #
  9. # def invoice_validate(self):
  10. # self.check_limit()
  11. # # self.check_morosidad()
  12. # return super(account_invoice, self).invoice_validate()
  13. #
  14. # @api.one
  15. # def check_limit(self):
  16. #
  17. # if self.contado == True:
  18. # return True
  19. #
  20. # available_credit = self.partner_id.credit_limit - self.partner_id.credit
  21. #
  22. # if self.amount_total > available_credit:
  23. # if not self.user_has_groups('partner_credito_limite.groups_partner_credito_limite'):
  24. # msg = 'No se puede confirmar el Pedido ya que el cliente no tiene crédito suficiente.\
  25. # Pruebe marcar la opción "Contado" o pedir autorización para poder realizar la venta.'
  26. # raise Warning(_(msg))
  27. # return False
  28. # return True