[FIX] stock_landed_cost: reconcillation with partial/zero journal items

If a landed cost is validated for an invoice where items either have 1)
a zero value, or 2) have been partially reconciled multiple times until
it is fully reconciled, validation will fail with a cannot reconcile
error because they are already reconciled.

The fix is to use the `reconcilled` attribute rather than checking for
existence of `full_reconcile_id`.

X-original-commit: 608ed487b61c81e38a5d0b856732a8b94c6df64a
Part-of: odoo/odoo#85621
This commit is contained in:
Michael de Villiers
2022-03-02 13:06:10 +00:00
committed by Michael de Villiers
parent d40e0e8242
commit e2ac705dce
@@ -183,7 +183,7 @@ 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.full_reconcile_id).reconcile()
all_amls.filtered(lambda aml: aml.account_id == input_account and not aml.reconciled).reconcile()
return True