[FIX] account_move_line_purchase_info: Overwrite _compute_invoice to ensure invoice count consistency

This commit is contained in:
hveficent
2020-03-04 09:56:06 +01:00
committed by Andrea Stirpe
parent 25fc3c341f
commit 24fe25c97c
5 changed files with 36 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
# Copyright 2020 ForgeFlow (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
pos = (
env["account.move.line"]
.search([("purchase_id", "!=", False), ("move_id.type", "=", "entry")])
.mapped("purchase_id")
)
pos._compute_invoice()