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.

29 lines
905 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Alex Comba - Agile Business Group
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import api, fields, models
  5. class PosConfig(models.Model):
  6. _inherit = 'pos.config'
  7. @api.model
  8. def _default_invoice_journal(self):
  9. company_id = self._context.get(
  10. 'company_id', self.env.user.company_id.id)
  11. domain = [
  12. ('type', '=', 'sale'),
  13. ('company_id', '=', company_id),
  14. ]
  15. return self.env['account.journal'].search(domain, limit=1)
  16. invoice_journal_id = fields.Many2one(
  17. string='Invoice Journal',
  18. help='When choosing to invoice the pos order, this is the '
  19. 'Accounting Journal used to post sales entries.',
  20. comodel_name='account.journal',
  21. domain=[('type', '=', 'sale')],
  22. default=_default_invoice_journal,
  23. )