From 6524300a4b89e5616d4ebcef20128a527c5208e1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 16 Sep 2015 10:43:51 +0200 Subject: [PATCH] [FIX] sale: do not store invoice_count Because reasons: - The field is only used in a stat button, so there is a limited number of accesses to it. - The field is computed in a method which is used to compute invoice_ids, which is not stored anyway. - If some refund_ids are found, invoice_count is not updated in the database. This is because the refunds are not linked in any way to the SO or to the original invoice, making impossible to find an appropriate @api.depends field to monitor. --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 72380c4786e..f5072a8cacf 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -98,7 +98,7 @@ class SaleOrder(models.Model): order_line = fields.One2many('sale.order.line', 'order_id', string='Order Lines', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True) - invoice_count = fields.Integer(string='# of Invoices', compute='_get_invoiced', store=True, readonly=True) + invoice_count = fields.Integer(string='# of Invoices', compute='_get_invoiced', readonly=True) invoice_ids = fields.Many2many("account.invoice", string='Invoices', compute="_get_invoiced", readonly=True, copy=False) invoice_status = fields.Selection([ ('upselling', 'Upselling Opportunity'),