[FIX] sale_coupon: prevent program w/o company
The company is used to compute currency of: - discount_fixed_amount - discount_max_amount - rule_minimum_amount If currently we don't set a company, we have an error when using the company. opw-2458950 note: forward-port in master set the company field as required setting it as required in the view. closes odoo/odoo#66231 X-original-commit: d260dddcdeddecd2bc0649d948f5e0cc30607e09 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -47,7 +47,7 @@ class CouponProgram(models.Model):
|
||||
default='on_current_order', string="Applicability")
|
||||
coupon_ids = fields.One2many('coupon.coupon', 'program_id', string="Generated Coupons", copy=False)
|
||||
coupon_count = fields.Integer(compute='_compute_coupon_count')
|
||||
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.company)
|
||||
company_id = fields.Many2one('res.company', string="Company", required=True, default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True)
|
||||
validity_duration = fields.Integer(default=30,
|
||||
help="Validity duration for a coupon after its generation")
|
||||
|
||||
Reference in New Issue
Block a user