12345678910111213141516171819202122232425262728 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, tools, api
- class AccountBankStatement(models.Model):
- _inherit = 'account.bank.statement'
- @api.model
- def _default_type_statement(self):
- typeStatement = self.env['account.bank.statement.type'].search([('is_default', '=', True)],limit=1)
- return typeStatement.id if (typeStatement) else ''
- type_statement = fields.Many2one('account.bank.statement.type', string='Tipo de Caja', ondelete='restrict')
- _defaults = {
- 'type_statement': _default_type_statement,
- }
- @api.model
- def update_statement_type_defualt(self):
- type = self.env['account.bank.statement.type'].search([('is_default', '=', True)],limit=1)
- statement = self.env['account.bank.statement'].search([('type_statement', '=', False)])
- if (not statement):
- return False
- for statementUpdate in statement:
- statementUpdate.write({
- 'type_statement': type.id
- })
|