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.
28 lines
1.0 KiB
28 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from openerp import api, models
|
|
|
|
|
|
class PurchaseOrderLine(models.Model):
|
|
_inherit = 'account.analytic.account'
|
|
|
|
@api.multi
|
|
def _recurring_create_invoice(self, automatic=False):
|
|
invoices = self.env['account.invoice'].browse(
|
|
super(PurchaseOrderLine, self)._recurring_create_invoice(automatic)
|
|
)
|
|
res = []
|
|
unlink_list = []
|
|
for partner in invoices.mapped('partner_id'):
|
|
inv_to_merge = invoices.filtered(lambda x: x.partner_id == partner)
|
|
if len(inv_to_merge) > 1:
|
|
invoices_info = inv_to_merge.do_merge(
|
|
keep_references=True, date_invoice=False)
|
|
res.extend(invoices_info.keys())
|
|
for inv_ids_list in invoices_info.values():
|
|
unlink_list.append(inv_ids_list)
|
|
else:
|
|
res.append(inv_to_merge.id)
|
|
return res
|