You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. from openerp.fields import One2many, Float, Many2one
  4. class BeesPOS(models.Model):
  5. _inherit = 'pos.config'
  6. bill_value = One2many('bill_value', 'pos')
  7. class BillValue(models.Model):
  8. _name = 'bill_value'
  9. _order = 'name asc'
  10. name = fields.Float(string='Name')
  11. pos = Many2one('pos.config')
  12. class BeesAccountBankStatement(models.Model):
  13. _inherit = 'account.bank.statement.cashbox'
  14. def _get_default_line(self):
  15. print "in _get_default_line", self.env.context['active_id']
  16. if not self.env.context.get('active_id'):
  17. return []
  18. default_lines = []
  19. pos_obj = self.env['pos.session']
  20. pos_session_rec = pos_obj.browse(self.env.context['active_id'])
  21. for bill_value_rec in pos_session_rec.config_id.bill_value:
  22. default_lines.append((0, 0, {'coin_value' : bill_value_rec.name}))
  23. return default_lines
  24. cashbox_lines_ids = fields.One2many(default=_get_default_line)