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.

31 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
  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
  6. from openerp.addons.account.wizard.pos_box import CashBox
  7. class CashBoxOut(CashBox):
  8. _inherit = 'cash.box.out'
  9. @api.one
  10. def _calculate_values_for_statement_line(self, record):
  11. session_obj = self.env['pos.session']
  12. active_model = self._context.get('active_model', False)
  13. active_ids = self._context.get('active_ids', [])
  14. # Call with [0] because new api.one func calls old api func
  15. res = super(CashBoxOut, self)._calculate_values_for_statement_line(
  16. record)[0]
  17. if active_model == 'pos.session':
  18. session = session_obj.browse(active_ids[0])
  19. if session.config_id.transfer_account_id:
  20. res['account_id'] =\
  21. session.config_id.transfer_account_id.id
  22. return res