[FIX] sale_coupon: validity duration of coupons

- Create a Promotion Program with
  'Applicability' set to 'Apply On Next Order'
  'Promo Code Usage' set to 'Use a code', set a code (not required,
  only for easiness)
- Create a SO, use the code and validate
- In the Promotion Programs, open the coupon list

The Expiration Date is set to tomorrow.

The Expiration Date is not useful in this case, and it is computed only
because the default value of `validity_duration` is 1. However, the user
is not able to change it since `maximum_use_number` is used for
programs instead.

We set a default value to zero to avoid any confusing computation.

opw-2210794

closes odoo/odoo#47779

X-original-commit: 44e71f9192d8711cbaeac0088db55c3ff26813a1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-03-17 09:59:23 +00:00
parent ef043deafd
commit b91085e5ca
2 changed files with 4 additions and 2 deletions
@@ -22,6 +22,7 @@
<field name="discount_percentage">10.0</field>
<field name="program_type">promotion_program</field>
<field name="discount_line_product_id" ref="sale_coupon.product_product_10_percent_discount"/>
<field name="validity_duration">0</field>
</record>
<record id="product_product_free_large_cabinet" model="product.product">
@@ -46,6 +47,7 @@
<field name="rule_min_quantity">3</field>
<field name="rule_products_domain">[["name","ilike","large cabinet"]]</field>
<field name="discount_line_product_id" ref="sale_coupon.product_product_free_large_cabinet"/>
<field name="validity_duration">0</field>
</record>
<record id="10_percent_coupon" model="sale.coupon.program">
@@ -273,8 +273,8 @@
<field name="domain">[('program_type', '=', 'promotion_program')]</field>
<field name="context">{
'default_program_type': 'promotion_program',
'default_promo_code_usage':
'no_code_needed',
'default_promo_code_usage': 'no_code_needed',
'default_validity_duration': 0,
'search_default_opened': 1
}</field>
<field name="help" type="html">