[FIX] stock_landed_costs: skip display lines in reconciliation

Steps to reproduce:
- Create a vendor bill with landed costs
- Add section and note lines
- Try posting the bill (ERROR)

Bug:
display lines should be skipped

opw-3715660

closes odoo/odoo#161791

X-original-commit: 3174c4a793f24782d835a15d96376e45b5f333e4
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Walid
2024-04-15 09:10:20 +00:00
parent 094447485c
commit 1648ee1abf
2 changed files with 9 additions and 1 deletions
@@ -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()
@@ -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)