[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.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user