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.

23 lines
889 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
  3. # Copyright 2016-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
  4. # Copyright 2017 Vicent Cubells <vicent.cubells@tecnativa.com>
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  6. from openerp import api, models
  7. class AccountAnalyticAccount(models.Model):
  8. _inherit = 'account.analytic.account'
  9. @api.multi
  10. def _get_contracts2invoice(self, rest_contracts):
  11. """Invoice together contracts from partners that have the option
  12. checked and that have several contracts to invoice"""
  13. if self.partner_id.contract_invoice_merge:
  14. return rest_contracts.filtered(
  15. lambda x: x.partner_id == self.partner_id
  16. ) | self
  17. return super(AccountAnalyticAccount, self)._get_contracts2invoice(
  18. rest_contracts
  19. )