Commit Graph
19 Commits
Author SHA1 Message Date
pedrambiria 4f19f2040a [FIX] pos_loyalty: correctly compute discount with existing discount
Before this commit, if you have a discount promotion on the order,
adding a free product reward would change the discount incorrectly.

The problem is that in the `_getDiscountableOnSpecific` function the
non-discount rewards weren't excluded from `discountLinesPerReward`.

opw-3276337

closes odoo/odoo#127003

X-original-commit: 914dad0d23df4c3f8a117252a8159c07df9ee8ad
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-07-03 19:57:49 +02:00
roen-odoo 075da19e4e [FIX] pos_loyalty: specific discountable take discount into account
Current behavior:
When computing the discountable values of an order, the discount of the
program where not taken into account if you used specific discountable
products.

Steps to reproduce:
- Create products A and B with a price of 20$
- Create a loyalty program
- Rule:
  - Minimum qty : 2
  - Apply on specific products : Product A and Product B
  - Reward : 5 points per order
- Reward:
  - 10$ per order
  - In exchange of 2 points
  - Apply on specific products : Product A and Product B
- Open PoS and add Product A and Product B to the order
- A reward should be added automatically with a value of -10$
- Click on the reward button, another reward should be added but it has
  the wrong value. It should be -10$ but it is not.

opw-3232565

closes odoo/odoo#126245

X-original-commit: f33d3b09ff49aae1fdaf3379915b7e7b5f03080c
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2023-06-23 18:00:13 +02:00
pedrambiria 09b2dab543 [FIX] pos_loyalty: zero division when reward product has zero price
The issue occurred when a loyalty program's rule was set to be
based on money spent, and the reward was a free product with a
sale price of zero. This caused a zero division error in the code,
resulting in the remaining points becoming NaN after the reward
was obtained in the point of sale.

opw-3253366

closes odoo/odoo#123123

X-original-commit: 1eaca074741157e42c12da22e945a1817e7ceec3
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-06-01 11:43:57 +02:00
David Monnom (moda) cd81cc64ed [FIX] point_of_sale,pos_*: launch test with demo user
Before the PoS tours were mainly run with the `accountman` user, which
did not allow us to have a clear view of the permissions required for
each function of the Point of Sale.

Now, two users have been created for the PoS:
- `pos_user`
- `pos_admin`

The first one has no particular permission, he is a normal user of the
Point of Sale and Odoo, the second one is an administrator of the Odoo
application.

If the user `pos_user` is used and some permissions are missing in a
tour, these are added to the user with starting the test.

closes odoo/odoo#120380

Related: odoo/enterprise#40656
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-15 13:59:09 +02:00
Loukas Wets (lowe) a19cdd6e27 [IMP] point_of_sale,{pos_}loyalty: ux misc improvements
- The calculator logo of the cash opening popup has been changed to a
bill logo to be more explicite for the end user.
- The cash input is autofocused at the opening of the cash opening
popup. Select number input on focus and align numbers right money
details popup.
- Rearrange Close pos popup layout.
- Set the Gift Card amount to the price of the refound if there is one.
- Change pos_payement_method_view form id order to sequence. Set the
order of payement methods in PayementScreen to sequence.
- Fix markut issue in the chatter.

Task-3215901

closes odoo/odoo#118288

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-11 18:25:00 +02:00
roen-odoo 6b014dd0d6 [REV] pos_loyalty: revert gift card specifid point computation
The correct behavior for the gift cards should be that the value of the
gift card is equal to the value of the order line.
For example :
-50$ giftcard -> Apply discount 50% on the order line -> 25$ gift card

If we want to apply a discount on a gift card we need to use the global
discount

The commit we are reverting was forcing the value of the gift card to be
the base value of the order line.

This reverts commit 83ceeecde76a859749d0659d6c387d95155c8425.

OPW-3264945

closes odoo/odoo#120794

X-original-commit: 023e2f2571ab7c814ed3cad45871fc221562fb67
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-05-09 06:07:44 +02:00
roen-odoo 32f7be02c0 [FIX] pos_loyalty: correct value for gift card with discount
Current behavior:
When you sell a gift card in the PoS with a discount, the value of the
gift card is not correct. For example, if you sell a gift card of 100€
with a 50% discount the customer should pay 50€ and the gift card should
be worth 100€. But the customer pays 50€ and the gift card is worth 50€.

Steps to reproduce:
- Create a gift card program
- Open a PoS session
- Sell a gift card of 100€ with a 50% discount
- Pay the order
- The value of the giftcard should be 100€ but it is 50€

opw-3221553

closes odoo/odoo#116746

X-original-commit: 1631ab332a6c9c7ca5e1f2451a51fb663534cb8e
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-03-28 13:43:46 +02:00
roen-odoo d013b32d90 [FIX] pos_loyalty: free product correctly added to order with loyalty
Current behavior:
When you have a loyalty program with a free product, and a rule with a
minimum amout. The free product is not added to the order if the free
product is already in the order.

Steps to reproduce:
-Set a loyalty program with the following Conditions:
    Minimum Qty: 1
    Minimum Spend: $5
    Grant: 10 Points/Order
-Reward:
    Type: Free Product
    Item: Any item (eg: Bacon Burger)
    Exchange: 30 Points
1. Open POS that has this loyalty program.
2. Process sales with a Test User until user has 30 points.
3. Attempt to redeem the Free Product under "Reward".

Note: I modified the other test, IMO it makes sense that when triggering
the rewards it adds Product A and Product A * -1. Because if the product
that was already in the order become free, the rule to trigger the
rewards is not met anymore.

opw-3135794

closes odoo/odoo#113313

X-original-commit: 253d308a26f1e6479c1d3c5342e1cede6f635198
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-02-22 12:42:55 +01:00
rhe-odoo e75c5fc1af [IMP] point_of_sale: warning with cash payment methods
Currently, it is possible to assign the same "Cash" payment method to multiple PoS.
At the moment, when creating a new PoS, Odoo tends to assign it by default. Although this is highly not recommended as it can only lead to incorrect cash control (two PoS devices rarely share the same till and therefore needs their own cash payment method).

This commit makes sure payment methods of type Cash aren't set by default when creating new PoS.
it also blocks the user from setting the same Cash payment method to multiple PoS configs.

closes odoo/odoo#92664

Task-id: 2857417
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-02-13 12:36:15 +01:00
roen-odoo e1aa9c1e39 [FIX] pos_coupon: correctly filter out global discount
Current behavior:
When a global discount is applied, it is considered as a regular
orderline when computing the order discounts. Because of this if you
applied a coupon and a global discount, the pos would add a discount of
infinity value.

Steps to reproduce:
- Create a promotion with a discount of 10%
- Create a product with no taxes
- Enable the global discount feature, and make sure the Discount product
  has a tax set on it.
- Create a new order, add the product, apply the promotion, and apply
  the global discount.
- The order will have a discount of infinity value.

opw-3094784

closes odoo/odoo#108441

X-original-commit: 1ea082b933a9583a9af1839164e919a0ac7512f9
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-12-21 17:41:44 +01:00
roen-odoo 80656a2672 [FIX] point_of_sale: recompute reward after pricelist change
Current behavior:
In the PoS if you apply a coupon on an order that contains 2 products
with different taxes, it will create 2 discount lines on the order.
If you change the pricelist, the discount lines won't have the correct
values.

Steps to reproduce:
- Create 2 different products with different taxes.
- Create a pricelist with a discount on the 2 products.
- Create a coupon that apply a 100% discount on the order.
- Start a PoS session
- Add the 2 products to the order and apply the coupon.
- The order total is now 0€.
- Change the pricelist to the one with the discount.
- The order total is different than 0€.

opw-3049098

closes odoo/odoo#106835

X-original-commit: 36dc1fce19403935770eaaaf5c1177fc8c1ef2bb
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-11-30 14:05:46 +01:00
Joseph Caburnay fa20b34d74 [IMP] pos_loyalty: loyalty, gift card and ewallet programs
* Allow multiple loyalty programs.
* Improve gift card workflow: https://app.excalidraw.com/l/65VNwvy7c4X/1Xt93llULvo
* Integration with the ewallet programs: https://app.excalidraw.com/l/65VNwvy7c4X/4B9AEOSbaku

Note that we prevent refunding eWallet and gift card top up and
reward products. If for instance the user wants to refund gift cards
they'll have to transfer the gift card to ewallet by topping up the
customer's ewallet and paying with the gift card to be refunded.

closes odoo/odoo#100891

Task-ids: 2959620, 2959661
X-original-commit: fa06e3225650ed9d1a96709b0398e7f33313acf5
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-09-23 00:39:01 +02:00
roen-odoo 6f777688a1 [FIX] pos_coupon: respect promotions program max amount
Current behavior:
If you create a promotion program that applies on specific products that
have different taxes, the maximum amount of the promotion was not
respected. For example, if you had 2 products with 2 different taxes you
could have 2 discounts with the maximum amount of the promotion program.

Steps to reproduce:
-Create 2 products A (15$) and B (25$) with different taxes T1 and T2
-Create product C (30$) that we will use to activate the promotion
-Create a promotion program, based on product C, that applies
 on products A and B. It should have a max amount of 40$ and
 a discount of 100%.
-Go in the PoS application and apply the new promotion program on a PoS
 and start a new session.
-Add 2 products A and 2 products B to the order, then add product C. The promotion
 is applied but it creates 2 discount lines of 30$ and 40$ which is more than the
 maximum amount of 40$ set in the promotion program

opw-2927711

closes odoo/odoo#99778

X-original-commit: ae03982f53f382b0689befe267fd3820ceafb385
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-14 18:16:19 +02:00
Eleftherios Kritsotakis 41273923f8 [IMP] pos_loyalty, point_of_sale: settings integration with new loyalty module
After this commit, the settings of coupons, promotions,
gift cards and loyalty cards are now managed under a
single one field in PoS Settings configuration. Moreover,
this settings field is "global" and shared between the
eCommerce and Sales app.

task-2959620

closes odoo/odoo#99060

Related: odoo/upgrade#3842
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-09-07 23:10:48 +02:00
Jacky (trj) a520745230 [IMP] point_of_sale: visual improvement
Small visual changes that should improve the user experience.
The loading demo data popup has been moved to the backend.
Created an Alert Popup that is less aggressive than an Error Popup

closes odoo/odoo#83780

Task-id: 2485062
Related: odoo/enterprise#26104
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-08-08 10:50:14 +02:00
Joseph Caburnay 48aff86c42 [FIX] point_of_sale,*pos*: remove 'pos' field attribute
With this change, we are now assuming each field that starts with
'pos_' to be a 'pos.config' field that has value that will be saved
to the 'pos_config_id' record. We made that modification because by keeping
some related fields not written at the same time can trigger contraints at the
wrong moments that would lead to validation errors when not supposed to be.

Part-of: odoo/odoo#97032
2022-07-29 01:51:13 +02:00
Joseph Caburnay 75d14c2282 [FIX] pos_loyalty: reward button highlight, free product, etc
- Properly compute the free product quantity.
  - Free product that generate points not based on quantity
  - Same free product from different rewards
- Proper timing of the reward button highlight. If there are products
  that are potentially free product when added, then the reward button
  is highlighted.
- Don't reorder free product reward lines. Before, if there are multiple
  free product rewards, the lines are reordered at each ui action.
- Loyalty points are computed properly, at least when free products are
  involved.
- Introduct some tests to protect the fixes.

closes odoo/odoo#92809

X-original-commit: 3e954d26b7e1e5c41c4f5372010f0573c9adcfe9
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-07 10:16:22 +02:00
Joseph Caburnay fa111d449d [IMP] point_of_sale,*pos*: configure pos from general settings
Purpose:

- Move PoS settings in general settings to be consistent with the rest
  of Odoo (PoS being the only app where settings are split in two locations)
- Clean settings by enabling obvious settings or dropping unnecessary ones.

closes odoo/odoo#84719

Task-id: 2753430
Related: odoo/upgrade#3260
Related: odoo/enterprise#24425
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-03 16:39:51 +02:00
William Braeckman 26e79061f5 [ADD] pos_loyalty: manage loyalty in PoS
This module was moved from enterprise to community and now includes
pos_coupon and pos_gift_card aswell.

TaskId-2675382
2022-04-08 11:04:44 +02:00