summaryrefslogtreecommitdiff
path: root/addons/coupon
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-05-19 08:08:37 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-05-25 07:44:35 +0000
commit8eefb6925247f838369d1cb4d4cb807c3010da51 (patch)
tree37fe26485dc93ab1f3056b9522eea84b0658618c /addons/coupon
parentfadaf8b748111bb6e02340776ace3d1993ea25ac (diff)
[FIX] sale_coupon: correct discount application values from view
Create a coupon program following these steps: - Set name - set 'Discount Apply On' to 'On Specific Product' - Add specific product - Set 'Apply Discount' to Fixed price - Input the fixed price - Save Generate a coupon and try to apply it on a quotation. Error will popup because Not all conditions are met. The field discount_apply_on (invisible with fixed price) keep the application "specific_products". Fixing by checking the values in the backend. opw-2257783 closes odoo/odoo#51574 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/coupon')
-rw-r--r--addons/coupon/models/coupon_program.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/coupon/models/coupon_program.py b/addons/coupon/models/coupon_program.py
index f9b080df2e4..3232ab63947 100644
--- a/addons/coupon/models/coupon_program.py
+++ b/addons/coupon/models/coupon_program.py
@@ -77,6 +77,11 @@ class CouponProgram(models.Model):
if self.reward_product_id:
self.reward_product_uom_id = self.reward_product_id.uom_id
+ @api.onchange('discount_type')
+ def _onchange_discount_type(self):
+ if self.discount_type == 'fixed_amount':
+ self.discount_apply_on = 'on_order'
+
@api.model
def create(self, vals):
program = super(CouponProgram, self).create(vals)