From 368f14bd0cf6e840eee5e80da14d633966d0c627 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 11 Dec 2017 12:47:42 +0100 Subject: [PATCH] [FIX] sale_coupon: fix performance issue during coupon creation When you create a coupon, before this commit, all account move line was rewrite with the currency (useless OP). Now the creation for a db of 15k lines tkaes 2 secondes instead of 10 minutes. --- models/sale_coupon_program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/sale_coupon_program.py b/models/sale_coupon_program.py index cdf178aad50..b6d43713cec 100644 --- a/models/sale_coupon_program.py +++ b/models/sale_coupon_program.py @@ -45,7 +45,7 @@ class SaleCouponProgram(models.Model): coupon_count = fields.Integer(compute='_compute_coupon_count') order_count = fields.Integer(compute='_compute_order_count') company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.user.company_id) - currency_id = fields.Many2one(string="Currency", related='company_id.currency_id') + currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True) validity_duration = fields.Integer(default=1, help="Validity duration for a coupon after its generation")