diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py index a2e41708994..9abd9ddd807 100644 --- a/addons/stock_landed_costs/models/stock_landed_cost.py +++ b/addons/stock_landed_costs/models/stock_landed_cost.py @@ -188,7 +188,8 @@ class StockLandedCost(models.Model): for product in cost.cost_lines.product_id: accounts = product.product_tmpl_id.get_product_accounts() input_account = accounts['stock_input'] - all_amls.filtered(lambda aml: aml.account_id == input_account and not aml.reconciled).reconcile() + all_amls.filtered(lambda aml: aml.account_id == input_account and not aml.reconciled\ + and not aml.display_type in ('line_section', 'line_note')).reconcile() def get_valuation_lines(self): self.ensure_one() diff --git a/addons/stock_landed_costs/tests/test_stock_landed_costs.py b/addons/stock_landed_costs/tests/test_stock_landed_costs.py index 689e09ca135..31f06df1894 100644 --- a/addons/stock_landed_costs/tests/test_stock_landed_costs.py +++ b/addons/stock_landed_costs/tests/test_stock_landed_costs.py @@ -205,6 +205,13 @@ class TestStockLandedCosts(TestStockLandedCostsCommon): po.action_create_invoice() bill = po.invoice_ids bill.invoice_date = fields.Date.today() + + self.env['account.move.line'].create({ + 'move_id': bill.id, + 'display_type': 'line_section', + 'name': 'Great Section', + }) + bill._post() landed_cost_aml = bill.invoice_line_ids.filtered(lambda l: l.product_id == self.landed_cost)