If user had less than 1 point, which is equivalent to 1 quantity of set
currency, on gift card and eWallet, they could not use it due to not enough point on
Gift Card and eWallet for claiming reward.
opw-3667934
closesodoo/odoo#159984
X-original-commit: 64711a9152b6bb661392882d3403c194f5990fbc
Signed-off-by: anko-odoo <anko@odoo.com>
When we use the `|` (or) version of this rule the ORM generates two
sub-queries when checking the company. This causes sub-optimal and in
some cases really bad planning for the queries and thus PG takes hours
to complete them.
Example (formatted):
```sql
SELECT "mrp_routing_workcenter".id
FROM "mrp_routing_workcenter"
LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
AND ( ("mrp_routing_workcenter"."bom_id" in (
SELECT "mrp_bom".id
FROM "mrp_bom"
WHERE ("mrp_bom"."company_id" in (1))
)
)
OR ("mrp_routing_workcenter"."bom_id" in (
SELECT "mrp_bom".id
FROM "mrp_bom"
WHERE "mrp_bom"."company_id" IS NULL
)
)
)
ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
"mrp_routing_workcenter__bom_id"."id",
"mrp_routing_workcenter"."sequence",
"mrp_routing_workcenter"."id"
```
If we use the single term version the generated query has only one
sub-query:
```sql
SELECT "mrp_routing_workcenter".id
FROM "mrp_routing_workcenter"
LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
AND ( ("mrp_routing_workcenter"."bom_id" in (
SELECT "mrp_bom".id
FROM "mrp_bom"
WHERE (("mrp_bom"."company_id" in (1))
OR ("mrp_bom"."company_id" IS NULL))
)
)
)
ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
"mrp_routing_workcenter__bom_id"."id",
"mrp_routing_workcenter"."sequence",
"mrp_routing_workcenter"."id"
```
In this version PG is able to produce a better query plan resulting in
better execution times.
Also, the `company_id` field is required on some models, so the "= False" comparison is useless.
closesodoo/odoo#159123
X-original-commit: 1b5c41f36801fb886ec591f29dba42787d698526
Related: odoo/enterprise#59378
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
Steps
-----
1. Create a loyalty card program awarding 1 point per $ spent;
2. make sure "Show points Unit" is enabled;
3. give yourself a loyalty card with 267.39 points on it;
4. create a product with a price of $0.89;
5. go to website and add it to your shopping car;
6. go to checkout.
Issue
-----
> You have 268.28000000000003 Loyalty point(s)
Cause
-----
The number comes from the `_get_real_points_for_coupon` method, which
uses `float_round` by way of `res.currency`.
The `float_round` function isn't suited for raw number display, as it
can make tiny rounding errors due to floating point arithmetic.
Solution
--------
Add a `_format_points` method to `loyalty.card` which will return a
string using the same format the `points_display` field uses.
opw-3705546
closesodoo/odoo#155652
X-original-commit: 767405a6fe8cea0407632acb57aae8bf25d8c001
Signed-off-by: Levi Siuzdak <sile@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Victor Feyens <vfe@odoo.com>
**Current behavior:**
Creating a promo type loyalty program and editing the
'products' field in the 'Among' section of the rule created by
default at the bottom of the form view before saving the
program will cause the products selected in this field to be
cleared upon saving the program.
**Expected behavior:**
Filling out this field of the default rule before saving the
overarching loyalty program should result in the same behavior
as doing so after saving the program. That is, the field should
save the user's input.
**Steps to reproduce:**
1. Create a new loyalty program in the Discount & Loyalty tab
2. Give it a name and, before saving the program, edit the
'Products' field of the default rule that is created at
the bottom of the form to have at least one value
3. Now save the program and observe that the 'Products' field
has been cleared of the previously selected values
**Cause of the issue:**
In the form view for the loyalty.program there are two
instances of the field trigger_product_ids which are set to be
invisible unless creating a specific program type. This field
is set to be related to rule_ids.product_ids in its definition
within the loyalty.program class definition. Thus, when the
user saves the program and rule concurrently, the empty
trigger_product_ids field overwrites the product_ids field
and whatever the user had populated it with is cleared.
The reason it only happens to the default rule and not ones
which are manually added before saving the program is because
in the traverse_related() method in fields.py, only the first
record of the related field is returned to be modified. In this
case, it means only the first rule's product_ids field is
overwritten.
**Fix:**
Overwrite the create() method in program.loyalty and check if
the program being created is of type 'gift_card' or 'ewallet'
then, if so, delete the trigger_product_ids key,val from the
dictionary so it will not later override the products specified
in the loyalty rule.
opw-3669953
closesodoo/odoo#155093
X-original-commit: 7ed0a773b6e0711b127f236ce665c35202d973bc
Signed-off-by: Vincent Ethan <etvi@odoo.com>
Steps to reproduce issue:
1. Select a Contact
2. Click on Smart Button "Loyalty Cards"
3. Create a new Loyalty Coupon
4. Save
5. Receive an error:
> The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead.
>
> Model: Loyalty Coupon (loyalty.card)
> Constraint: loyalty_card_program_id_fkey
Explanation:
The model given to `program_id` by the `default` attribute is not always `loyalty.program`. In the case of the issue, for example, the model is `res.partner`.
https://github.com/odoo/odoo/blob/a3201d636505dc1976d3f0ee7f8cbf65d2488966/addons/loyalty/models/loyalty_card.py#L27
Suggested fix:
The creation of `loyalty.card` from `res.partner` Smart Button is not intended, therefore we will remove this option and set the Smart Button as invisible if `loyalty_card_count` is null.
opw-3707588
closesodoo/odoo#154258
X-original-commit: 8645874ec0e7ae81f032231be4908e173d2a4043
Signed-off-by: Stroobant Paul (stpa) <stpa@odoo.com>
For a first iteration, Russian translations were done using DeepL using
1 large .pot file of all the standard modules to translate (e.g. no
localizations, no test modules, etc). Unfortunately for some reason
doing a msgmerge with the existing ru.po files didn't seem to work, so
old "Translators" metadata at top of files were lost (maybe they will be
re-added during next Transifex sync?)
Part-of: odoo/odoo#152285
Logo on pdf send to customer after generating coupon code was disorted if
it was not in certain ratio.
task-2588963
closesodoo/odoo#152245
X-original-commit: b1b94a075672067325ddcc125cbc57ae214b0a9a
Signed-off-by: anko-odoo <anko@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Problem: The test value for the expiration date was being shown on gift card reports that don't have expiration dates.
Purpose: The expiration date should only be shown if it's set for the gift card code.
It will be consistent with loyalty_report and the email template mail_template_gift_card in which both conditionally displays the expiration date.
Steps to Reproduce on Runbot:
1. Install Sales
2. Settings > Sales > Enable Discounts & loyalty programs
3. Navigate to Sales > Gift cards and create/generate a gift card code with no expiration date
4. Print the gift card report and the report will show the expiration date of 2023-12-31
opw-3686110
closesodoo/odoo#150954
Signed-off-by: Mylyna Hy (myhy) <myhy@odoo.com>
When there was no product in 'Gift Card Products' every
product was generating product equal to it's value.
Now when there is no product specified, no product will generate
gift card.
opw-3415384
closesodoo/odoo#143270
X-original-commit: 3d64ab7cc54a8bb69f98885fd037b2d48b1c2c29
Signed-off-by: anko-odoo <anko@odoo.com>
condition: install sale_loyalty only
"""
before commit:
right after archived e-wallet program, system will show python pop-up
error tuple index out of range
after commit:
able to open archived e-wallet program
closesodoo/odoo#143196
X-original-commit: 58a1c854b63a65e72b99b3466b3ef63a5e691e63
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
** before commit:
When create a free product reward, reward and sale order line
description use product's name so if many reward are variants of others,
the description will be the same. It make portal user confusing when
they chose reward in portal
**after commit:
the description will include display of product so that will contain
name of variants's attributes
closesodoo/odoo#141551
X-original-commit: 5619e8ce6b543c2b639860e8822f5d1bb4fcbeb0
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Before this PR, users encountered an issue when attempting to add rules
to Discount and Loyalty programs. An undesired validation message would surface,
preventing them from saving their changes.
In this PR, the extraneous validation has been eliminated, enabling users to
successfully save and update their existing rules and rewards.
Task-3487478
closesodoo/odoo#134261
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Steps to reproduce:
-------------------
- being in a multi-company environment;
- have one product made that is first in alphabetical
order of "Internal Reference" throughout the database (e.g. [AAA]);
- make this product specific to one of the companies
(set the "Company" field on the product template)
- go into a different company within the database
(not the one set on this product);
- create a new discount & loyalty record, and set
the "Program Type" to "Discount Code".
Issue:
------
An access rights error occurs.
Cause:
------
When creating a `promo_code` program, we use the first product
that can be sold in the default reward values.
Solution:
---------
Take into account the company in the domain that retrieves
the default product.
opw-3538516
closesodoo/odoo#139008
X-original-commit: d80c28c78bf3237e2526a6370f9c6c0b0f8dc232
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
Steps:
- Install `sale_management`
- Go to `Discount & Loyalty`
- Create a new one and set a name
- Change default program type from `discount` to `buy x get y`
- Remove the default rewards
- Add a new one (the default one)
- Click `Save & Close`
- Trigger save
Rewards is reset to default `discount` instead of `buy x get y`
closesodoo/odoo#138523
X-original-commit: 798c69f44bfde2f66826775a5a11fe5e51adb9a8
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
We move the filterable widget from loyalty to web to make it more widely
accessible to other applications. It will soon be used in the new activities
plan feature.
Following the move of the filterable selection widget to the web module, we do
some light cleanup.
Task-3390865
Part-of: odoo/odoo#137969
Before this commit, owl was in the linter's accepted global variables.
This allowed direct access to owl global object.
For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`
Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:
`import { xml } from "@odoo/owl";`
task-id 3498859
closesodoo/odoo#137517
Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
*: analytic, base_automation, loyalty, mass_mailing, project, web, web_editor, website
This commit adds many new documentation of options and their usage for
fields. This makes them more usable and customizable in Studio, and adds
documentation for developers to know the type of expected option.
Some options that might lead to issues or that are too technical have
been removed, as they are not relevant and not required in most use cases.
task-3469741
closesodoo/odoo#134858
Related: odoo/enterprise#47148
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>