cash_box_transfer.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, tools, api
  3. import openerp.addons.decimal_precision as dp
  4. from openerp.osv import osv
  5. from openerp.tools.translate import _
  6. class cash_box_transfer(models.Model):
  7. _name = "cash.box.transfer"
  8. name = fields.Char('name', required=True)
  9. amount = fields.Float('Amount', digits_compute=dp.get_precision('Account'), required=True)
  10. ref = fields.Char('Ref')
  11. date = fields.Date()
  12. message_deleted = fields.Text('Message Deleted')
  13. active = fields.Boolean('Active', default=True)
  14. ##### statement line
  15. input_line = fields.Many2one('account.bank.statement.line', 'Bank statement line Input')
  16. output_line = fields.Many2one('account.bank.statement.line', 'Bank statement line Output')
  17. ##### statement
  18. input_statement = fields.Many2one('account.bank.statement', 'Bank statement input')
  19. output_statement = fields.Many2one('account.bank.statement', 'Bank statement Output')
  20. class account_bank_statement_line_deleted(models.Model):
  21. _inherit = 'account.bank.statement.line'
  22. is_deleted = fields.Boolean('is deleted', default=False)
  23. @api.multi
  24. def unlink(self):
  25. if (self.is_deleted):
  26. raise osv.except_osv(('Atencion!'), ('No puedes eliminar el ítem de la caja.'))
  27. return super(account_bank_statement_line_deleted, self).unlink()