1234567891011121314151617181920 |
- # -*- encoding: utf-8 -*-
- from openerp import models, fields, api, _
- from openerp.exceptions import Warning
- class account_invoice(models.Model):
- _inherit = "account.invoice"
- is_a_expense = fields.Boolean(string="Es un gasto")
- @api.model
- def _get_default(self):
- x = self._context.get('is_a_expense')
- if x == True:
- return self.env['account.journal'].search([('code','=','GASTO')], limit=1)
- else:
- return super(account_invoice, self)._default_journal()
- _defaults = {
- 'journal_id': _get_default
- }
|