[FIX] contract_invoice_merge_by_partner: Minor fix

This commit is contained in:
Carlos Incaser
2016-06-14 14:29:45 +02:00
parent c273694bbd
commit 2a34a8cbc7
3 changed files with 3 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ To install this module you need *account_invoice_merge*, available in:
Usage Usage
===== =====
#. Go to *Sales > Contracts* and create some contrats with same partner #. Go to *Sales > Contracts* and create some contracts with same partner
#. Go to *Settings > Automation > Scheduled Actions* #. Go to *Settings > Automation > Scheduled Actions*
#. Select *Generate Recurring Invoices from Contracts* #. Select *Generate Recurring Invoices from Contracts*
#. Set previous time that now in *Next Execution Date* #. Set previous time that now in *Next Execution Date*
@@ -28,12 +28,6 @@ Usage
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/95/8.0 :target: https://runbot.odoo-community.org/runbot/95/8.0
Known issues / Roadmap
======================
* If product supplier info min quantity is greater than procurement qty and we
have sale orders with distinct analytic account which contains this product,
each purchase order line takes seller min quantity.
Bug Tracker Bug Tracker
=========== ===========

View File

@@ -19,8 +19,7 @@ class PurchaseOrderLine(models.Model):
for partner in invoices.mapped('partner_id'): for partner in invoices.mapped('partner_id'):
inv_to_merge = invoices.filtered(lambda x: x.partner_id == partner) inv_to_merge = invoices.filtered(lambda x: x.partner_id == partner)
if len(inv_to_merge) > 1: if len(inv_to_merge) > 1:
invoices_info = inv_to_merge.do_merge( invoices_info = inv_to_merge.do_merge()
keep_references=True, date_invoice=False)
res.extend(invoices_info.keys()) res.extend(invoices_info.keys())
for inv_ids_list in invoices_info.values(): for inv_ids_list in invoices_info.values():
unlink_list.extend(inv_ids_list) unlink_list.extend(inv_ids_list)

View File

@@ -35,7 +35,7 @@ class TestContractInvoiceMergeByPartner(TransactionCase):
self.contract4 = self.contract1.copy() self.contract4 = self.contract1.copy()
def test_invoices_merged(self): def test_invoices_merged(self):
self.env['account.analytic.account']._cron_recurring_create_invoice() self.env['account.analytic.account']._recurring_create_invoice()
invoices = self.env['account.invoice'].search( invoices = self.env['account.invoice'].search(
[('partner_id', '=', self.partner.id)]) [('partner_id', '=', self.partner.id)])
inv_draft = invoices.filtered(lambda x: x.state == 'draft') inv_draft = invoices.filtered(lambda x: x.state == 'draft')