Files
contract/contract_invoice_merge_by_partner/models/account_analytic_analysis.py
Pedro M. Baeza 7d7295c8bb [IMP] contract_invoice_merge_by_partner: Don't require to merge invoices later
Adapting source contract module, we don't need to rely on account_invoice_merge
functionality for having all the invoices merged.
2017-08-25 16:28:25 +02:00

24 lines
889 B
Python

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