Commit Graph
197 Commits
Author SHA1 Message Date
Christophe Simonis 5244a6cf48 [MERGE] forward port branch 12.0 up to ff147a08761 2019-02-03 10:42:29 +01:00
Christophe Simonis f8a91ebed9 [MERGE] forward port branch saas-11.3 up to 39c58130da1 2019-01-16 17:03:22 +01:00
Christophe Simonis ea5e878c1d [MERGE] forward port branch 11.0 up to 0c75c2d1e50 2019-01-16 14:26:34 +01:00
Maxime Chambreuil 375c061daf [FIX] sale_coupon: sdd sequence to the list view
The coupon program applies only one rule based on the sequence.

Steps to reproduce the bug:

Create a promotion with 5% if untaxed amount is greater than 1,000$
Create a promotion with 10% if untaxed amount is greater than 2,000$
Create a promotion with 15% if untaxed amount is greater than 3,000$
Create a SO for 3500$
Click on "Update Promotions"

Bug:

The 5% promotion is applied because it is the first one in the list.

Solution:

Display the sequence field in the list view with a handle to sort the different
promotions.

closes odoo/enterprise#3209
2019-01-15 15:49:17 +00:00
Christophe Simonis 3390fec761 [MERGE] forward port branch 12.0 up to 744c073abb7
closes odoo/enterprise#3394
2019-01-09 15:35:00 +00:00
Sébastien Theys 19d8d3a626 [FIX] sale_coupon(_delivery): fix coupon test with product configurator
The copy() is unnecessary, and it is introducing an issue because
product.template.attribute.value are not created correctly for copied templates.

The test can be done on the original data, the transaction is going to be
reverted either way.

closes odoo/enterprise#3301
2018-12-18 16:15:34 +00:00
Christophe Simonis f5622ea33c [MERGE] forward port branch 12.0 up to f65ea08f313 2018-11-29 21:00:44 +01:00
Christophe Simonis 0a095da31b [MERGE] forward port branch saas-11.3 up to a04dd653d26 2018-11-29 19:41:00 +01:00
Adrian Torres fecc8156cf [REM] *: remove pycompat py2 helpers/shims
This commit complements the removal of pycompat PY2 helpers and shims
from base by removing / adapting references to these helpers from the
enterprise code.
2018-11-29 08:40:45 +00:00
Christophe Simonis 7b092761c6 [MERGE] forward port branch 11.0 up to 423d06ff978 2018-11-28 17:55:37 +01:00
Wolfgang Taferner 284eb622d6 [FIX] sale_coupon: typo in variable
closes odoo/enterprise#3143
2018-11-24 10:42:48 +00:00
Christophe Simonis 41b10b14a8 [MERGE] forward port branch 12.0 up to ba03284065c 2018-11-16 15:53:59 +01:00
Christophe Simonis 5ac7557df2 [MERGE] forward port branch saas-11.3 up to a9f3cf76b93 2018-11-16 14:27:04 +01:00
Christophe Simonis 89ed115fe0 [MERGE] forward port branch 11.0 up to d2af0b13250 2018-11-15 20:41:29 +01:00
Christophe Simonis f89eef2b60 [MERGE] forward port branch saas-15 up to a267fcbdf62 2018-11-15 19:20:15 +01:00
Christophe Simonis c4f95c9254 [MERGE] forward port branch saas-14 up to 6e254b8ae9c 2018-11-15 18:16:38 +01:00
Romain Derie 63131c2584 [FIX] sale_coupon: reset no more eligible applied coupon to Valid state
Before this commit:
When a coupon_program's coupon was giving a reward on a SO and then the
recompute was removing that reward (eg the SO did not met the requirements
anymore) the coupon would not be reset and would be lost.

Now:
If a coupon's reward got removed for some reason, the coupon got reset to a
valid state (`new`) so it can be used again.

Step to reproduce:
  - Generate a coupon from a coupon program that needs requirements (eg $300)
  - Add that coupon to a SO that has a total over $300
  - Coupon is set as `used` and the reward is granted
  - Remove some products to set the SO total below $300
  - Recompute coupon, the reward is correctly removed but the coupon is still
    set as `used` so it won't be usable again and is basically lost.

Closes #3062
2018-11-15 15:57:17 +01:00
Romain Derie 231669e332 [FIX] sale_coupon: remove coupon_program reward if req. not met anymore
Before this commit:
If a reward had been given on the SO with a coupon_program code and that the
program had requirements and that these requirements are not met anymore,
recomputing the SO would not remove the reward.

Now:
If the SO does not met the program requirements anymore, we remove the reward

Step to reproduce:
  - Create a coupon_program with quantity or amount requirements (eg: $200)
  - Generate a coupon for that program
  - Add $200 worth of products (matching the program domain) in the SO
  - Add the generated coupon to that SO
  - You should get the reward as you have $200 in the SO
  - Remove some products from the SO to go below $200
  - Recompute coupons, the reward won't be removed

Closes #3062
2018-11-15 15:57:12 +01:00
Romain Derie 5a75d1aeae [FIX] sale_coupon: unvalid next_order programs if needed
Before this commit:
We would never unvalid a `next_order` program (and thus it's generated coupon)

Now:
We also retrieve applied `next_order` programs as we need to check if they are
still valid too

Step to reproduce:
  - Create a program on `next_order` that require $300
  - Add $300 worth of product on a SO
  - Apply program, it will generate a coupon
  - Make the SO total go below $300
  - The generated coupon is still Valid and the client will receive that coupon
    even if it is not supposed to anymore

Closes #3062
2018-11-15 15:57:06 +01:00
Romain Derie e8efcb1bc3 [FIX] sale_coupon: do not deduce reward quantity on current_order
Before this commit:
1. We were checking if the rewards were in the SO even if it was 'next_order'
   program.
2. We were deducing the rewards quantity for 'next_order' program when checking
   if we had enough products to meet the program requirements.

Now:
1. We don't verify if the reward is on the SO if the program is 'next_order'
2. We don't deduce reward quantity when checking if enough products to meet the
   program requirements if the program is 'next_order'

opw-1907211
Closes #3062
2018-11-15 15:56:25 +01:00
Romain Derie 7b99c0db92 [FIX] sale_coupon: generate only one coupon per program per SO
Before this commit:
Everytime the SO met a 'on_next_order' program requirements, a coupon would be
generated on that SO. Even if there was already a coupon for that program set to
'expired', for instance when the SO did not met the requirements anymore.

Now:
When the requirements are met, it checks that an `expired` coupon does not
already exist.
It it does, it will set that coupon back to `reserved` state.

Step to reproduce:
  - Create a program on `next_order` with requirements, eg $300 amount
  - Create a SO and add $300 worth of products
  - Update promotion, a coupon is created and set to `reserved`
  - Now update the SO to go below $300
  - Update promotion, the coupon is set to `expired` as it should
  - Update again the SO to meet the $300 requirements again
  - Update promotion, a new `reserved` coupon is generated instead of updating
    the state of the previous one from `expired` to `reserved`

Closes #3062
2018-11-15 15:56:19 +01:00
Adrian Torres 51c7afff48 [FIX] sale_coupon: restore SO processing time
This optimizes the confirmation of a sale_order in the ecommerce by ~73%,
for a cart with 160 unique items, the processing time goes from
7m46s to 39s, which is roughly the same amount of processing time if the
module `sale_coupon` is not installed.

This optimization is achieved in two steps:

1. By validating promotional/discounted products in batch instead of
validating each product one at a time.

2. By performing an unlink() on invalid reward lines instead of sending
a delete command by writing to the one2many, as delete commands are not
(yet) performed in batch, which means record recomputation after every
delete.

opw-1893277
2018-11-15 15:56:14 +01:00
Christophe Simonis f3aedcbad0 [MERGE] forward port branch 12.0 up to a21db09f18b 2018-11-06 16:41:25 +01:00
Christophe Simonis 251be0905b [MERGE] forward port branch saas-11.4 up to 590445ac4c1 2018-11-02 12:12:22 +01:00
Christophe Simonis b13d3b1357 [MERGE] forward port branch saas-11.3 up to 4bde063d914 2018-10-29 12:05:58 +01:00
Christophe Simonis 78d5941d50 [MERGE] forward port branch 11.0 up to aace8470b8e 2018-10-25 17:44:56 +02:00
Christophe Simonis 3a61254d0e [MERGE] forward port branch 12.0 up to 97a0de12f96 2018-10-23 17:52:50 +02:00
Christophe Simonis eb902f8b39 [MERGE] forward port branch saas-11.4 up to 5999fd47c43 2018-10-23 15:18:46 +02:00
Adrian Torres c8d5ff55ff [FIX] sale_coupon: restore SO processing time
This optimizes the confirmation of a sale_order in the ecommerce by ~73%,
for a cart with 160 unique items, the processing time goes from
7m46s to 39s, which is roughly the same amount of processing time if the
module `sale_coupon` is not installed.

This optimization is achieved in two steps:

1. By validating promotional/discounted products in batch instead of
validating each product one at a time.

2. By performing an unlink() on invalid reward lines instead of sending
a delete command by writing to the one2many, as delete commands are not
(yet) performed in batch, which means record recomputation after every
delete.

opw-1893277

closes odoo/enterprise#2905
2018-10-23 06:57:50 +00:00
Christophe Simonis 94ae74a87a [MERGE] forward port branch saas-11.3 up to 793c90edd20 2018-10-19 14:48:58 +02:00
Christophe Simonis 9632d38f0a [MERGE] forward port branch 11.0 up to cba39ad6754 2018-10-19 12:27:00 +02:00
Christophe Simonis 879aef37f3 [MERGE] forward port branch saas-15 up to bff8b16f5d9 2018-10-18 17:16:57 +02:00
Christophe Simonis 81c249d84a [MERGE] forward port branch saas-14 up to 9f58457b4a9 2018-10-18 15:31:27 +02:00
Goffin Simon 7633f96306 [FIX] sale_coupon: promotion program with fixed amount
Steps to reproduce the bug:

- Create a promotion program P with a fixed amount discount
- Set a customer tax T on the discount product generated for P
- Create a SO with one line
- Apply the promotion program by clicking on "Update promotions"

Bug:

The SO line with the discount product is generated but the tax T was missing.

opw:1888484
2018-10-17 15:24:33 +02:00
TWA 4cdc7c565d [IMP] mail,crm,...: Replace occurences of name_get()[0][1] by display_name
Purpose
=======

display_name is equal to doing name_get()[0][1]

Replacing name_get()[0][1] by display_name could be good for 2 things:
- Uniformization of the code
- Probable optimization if name_get is used inside a for loop on a recordset (as the values will be prefetched and put in the cache).

TaskID: 1849250

closes odoo/enterprise#2515
2018-10-09 12:29:38 +00:00
Christophe Simonis edaff83894 [FIX] sale_coupon: adapt coupon program rules to new demo data
Oversight of previous forward-port.
2018-10-02 10:40:14 +02:00
Christophe Simonis dbb575179f [MERGE] forward port branch saas-11.4 up to 8faebd0cf52 2018-10-01 20:17:14 +02:00
Christophe Simonis 4aed744934 [MERGE] forward port branch saas-11.3 up to 07444245de2 2018-10-01 14:01:11 +02:00
Christophe Simonis 3fc388c696 [MERGE] forward port branch 11.0 up to 92d7a5210d7 2018-10-01 10:46:29 +02:00
Christophe Simonis cfca60d422 [MERGE] forward port branch saas-15 up to ed3eff1427c 2018-09-28 19:17:34 +02:00
Christophe Simonis 9c457eb0d5 [MERGE] forward port branch saas-14 up to 285a68d2357 2018-09-28 19:15:14 +02:00
Romain Derie af0e47f42f [FIX] sale_coupon: compute fixed amount as such
Commit 092200073 broke the discount computation for discount of type
fixed_amount. Indeed the appropriate method was not called anymore and such
discount type would be computed as percentage discount with default value of
10% (field default for percentage).

opw-1888484
2018-09-28 18:14:10 +02:00
Christophe Simonis 47ef5cb2c0 [FIX] sale_coupon: correct sending of coupon via email 2018-09-28 13:43:36 +02:00
Adrian Torres 67431fcfaa [REF] *: adapt code to new related default behaviour
This commit adapts the business code to changes introduced by
the change to related field's default readonly value in order to
keep the same behaviour as before.

All readonly=False fields will have to be checked afterwards to confirm
that the business case requires write access to the source field.
2018-09-27 12:09:45 +02:00
Christophe Simonis a17ddde9a1 [MERGE] forward port branch 11.0 up to 1e8ab568c1f 2018-09-26 20:02:37 +02:00
Christophe Simonis 6b5aadc7ce [MERGE] forward port branch saas-15 up to c74e1ae51a8
closes odoo/enterprise#2707
2018-09-22 19:41:40 +00:00
Christophe Simonis 15f5a7fae7 [MERGE] forward port branch saas-14 up to 448b17e601b 2018-09-21 15:17:50 +02:00
Nimesh Jethva 5d45235549 [IMP]sale_*: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:48:45 +02:00
Romain Derie 602b48eeba [FIX] (website_)sale_coupon: fix website dependence in sale_coupon
67c3de295e9 wrongly adapt coupon to multi-websites as website references should
have been written in website_sale_coupon and not sale_coupon.

Closes #2673
2018-09-18 12:09:17 +02:00
Romain Derie 85c89c300a [FIX] sale_coupon: dont show strikethrough if pricelist show discount
Using a pricelist set as `without_discount` will show a strikethrough price on
reward line (discount and free product).
This is happening because the program reward line (discount_line_product_id) is
created with the default 1$ price as this price is not usefull when computing
coupons. Only the line price is checked.

Now, we create a reward line with a -1 000 000$ price to prevent this UI
behavior.

Step to reproduce:
  - Activate pricelist (Sales>Config>Settings>Pricelist formulas)
  - Activate discounts in Sales Configuration (Manual discount on order lines)
  - Set pricelist to 'Show public price & discount to the customer'
  - Add a discount in your cart
  - There in a strikethrough price of $1 above the discount line price

task-1878245
2018-09-13 15:21:51 +02:00