account_invoice.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- encoding: utf-8 -*-
  2. #################################################################################
  3. # #
  4. # #
  5. # This program is free software: you can redistribute it and/or modify #
  6. # it under the terms of the GNU Affero General Public License as #
  7. # published by the Free Software Foundation, either version 3 of the #
  8. # License, or (at your option) any later version. #
  9. # #
  10. # This program is distributed in the hope that it will be useful, #
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. # GNU Affero General Public License for more details. #
  14. # #
  15. # You should have received a copy of the GNU Affero General Public License #
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>. #
  17. # #
  18. #################################################################################
  19. from openerp import models, fields, api
  20. class account_invoice(models.Model):
  21. _inherit = 'account.invoice'
  22. _name = 'account.invoice'
  23. contado = fields.Boolean('Contado')
  24. credito = fields.Boolean('Crédito')
  25. _defaults = {
  26. 'contado': True
  27. }
  28. @api.one
  29. @api.onchange('credito')
  30. def cambiar_estado_credito(self):
  31. self.contado = not self.credito
  32. @api.one
  33. @api.onchange('contado')
  34. def cambiar_estado_contado(self):
  35. self.credito = not self.contado