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.

25 lines
906 B

  1. # coding: utf-8
  2. # Copyright (C) 2015 - Today: GRAP (http://www.grap.coop)
  3. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. from openerp import api, fields, models
  6. class PosChangePaymentsWizardLine(models.TransientModel):
  7. _name = 'pos.change.payments.wizard.line'
  8. wizard_id = fields.Many2one(
  9. comodel_name='pos.change.payments.wizard', ondelete='cascade')
  10. new_journal_id = fields.Many2one(
  11. comodel_name='account.journal', string='Journal', required=True,
  12. domain=lambda s: s._domain_new_journal_id())
  13. amount = fields.Float(string='Amount', required=True)
  14. @api.model
  15. def _domain_new_journal_id(self):
  16. PosOrder = self.env['pos.order']
  17. order = PosOrder.browse(self.env.context.get('active_id'))
  18. return [('id', 'in', order.session_id.journal_ids.ids)]