From 21f8052bccb92f740449d06d6e51ea3fd102bc50 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 13 Sep 2021 15:11:12 +0000 Subject: [PATCH] [FIX] product_margin: select 'in_payment' line when generating report 1. Define a product [TEST] with automated inventory valuation (AVCO) 2. Define a landed cost product in the same way 3. Create a RFQ for [TEST], Confirm and Receive product 4. Create Bill, add the landed cost on the bill 5. Confirm the Bill and create the landed cost (from transfer of point 3) 6. Create a SO for [TEST], confirm, delivery and create the invoice 7. Generate product margin analysis, [TEST] will be present 8. Register a payment for the invoice (it should have the status 'In Payment') Generate product margin analysis again, [TEST] entries will be missing This occur because, when the invoice is in 'in_payment' state the records are not taken into account opw-2631974 closes odoo/odoo#76605 X-original-commit: f62c20d38844c50c678e4233913a97845420d766 Signed-off-by: agr-odoo --- addons/product_margin/models/product_product.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/product_margin/models/product_product.py b/addons/product_margin/models/product_product.py index d8c6be10c99..d5faed290b6 100644 --- a/addons/product_margin/models/product_product.py +++ b/addons/product_margin/models/product_product.py @@ -94,13 +94,13 @@ class ProductProduct(models.Model): payment_states = () if invoice_state == 'paid': states = ('posted',) - payment_states = ('paid',) + payment_states = ('in_payment', 'paid',) elif invoice_state == 'open_paid': states = ('posted',) - payment_states = ('not_paid', 'paid') + payment_states = ('not_paid', 'in_payment', 'paid') elif invoice_state == 'draft_open_paid': states = ('posted', 'draft') - payment_states = ('not_paid', 'paid') + payment_states = ('not_paid', 'in_payment', 'paid') if "force_company" in self.env.context: company_id = self.env.context['force_company'] else: