From 38b1742d33eaa04318a0e8c28d93c7bcd9fd4def Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 13 Jun 2024 11:56:41 +0200 Subject: [PATCH] [FIX] stock_picking_invoice_link: Avoid inconsistent computes --- stock_picking_invoice_link/models/account_move.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stock_picking_invoice_link/models/account_move.py b/stock_picking_invoice_link/models/account_move.py index 22e6877cc48..0ab91ef804b 100644 --- a/stock_picking_invoice_link/models/account_move.py +++ b/stock_picking_invoice_link/models/account_move.py @@ -20,7 +20,7 @@ class AccountMove(models.Model): ) picking_count = fields.Integer( - string="Pickings count", compute="_compute_picking_ids" + string="Pickings count", compute="_compute_picking_count" ) @api.depends("invoice_line_ids", "invoice_line_ids.move_line_ids") @@ -31,6 +31,11 @@ def _compute_picking_ids(self): ) invoice.picking_count = len(invoice.picking_ids) + @api.depends("picking_ids") + def _compute_picking_count(self): + for invoice in self: + invoice.picking_count = len(invoice.picking_ids) + def action_show_picking(self): """This function returns an action that display existing pickings of given invoice.