The company is used to compute currency of:
- discount_fixed_amount
- discount_max_amount
- rule_minimum_amount
If currently we don't set a company, we have an error when using the
company.
opw-2458950
note: forward-port in master set the company field as required setting
it as required in the view.
closesodoo/odoo#66231
X-original-commit: d260dddcdeddecd2bc0649d948f5e0cc30607e09
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
The purpose of this task is to reflect the coupon discount perfectly
from sale order to invoice. This issue is already fixed in 13.0 in
commit: bb5d999 but during refactor of coupon it was removed due to
module split.
So in this commit, improve the default invoicing policy of coupon product.
The default invoicing policy should always be by ordered quantity.
Otherwise, if the user changes the default invoicing policy to
"delivered quantity", coupon won't be applied to the invoice.
closesodoo/odoo#65845
Taskid: 2303244
X-original-commit: 98a3ca3274e9829666a773d5fe79f2e695524f51
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Steps:
- Install eCommerce
- Go to Website > Products > Promotion Programs
- Create a promotion program with a filter Based on Customers and a promotion code
- Save
- Edit the new program and clear the filter Based on Customers
- Save again
- Log out and go to the shop
- Add an article to your cart and click "View Cart"
- Click "I have a promo code"
- Apply the promo code you created earlier
Bug:
The promo code is not accepted.
Explanation:
When the filter Based on Customers is cleared, `[]` is written on the program rule. This makes the app search for a partner with id = 4 (Public User). Since this user is not active, the search returns no results and, therefore, forbids the user from using the promo code.
This works flawlessly when you create a promotion program with no filters as they are initialized with `NULL` and a `NULL` filter always returns `True`.
opw:2419796
closesodoo/odoo#63822
X-original-commit: d31a86cead03623c375f4162324a6d1872cad6a3
Signed-off-by: backspac <backspac@users.noreply.github.com>
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
mail_template_sale_coupon is specific to sale_coupon so we are moving
it back to sale_coupon module. Additionally, we add a way of selecting
a mail template when generating coupons for customers.
On instances with a lot of coupons programs, performance issue arise while using eccommerce (adding item in basket ant opening it in particular).
In the client case, he have ~2000 of them.
Opening the basket with 1 product take:
Before this commit: ~10s
After this commit: ~2s
( pyflame is available in the ticket attachment )
`_get_valid_products` use the v13 `filtered_domain` method
Average execution time:
Before change: 0.001 s
After change: 0.0001 s
=> 10x times gained
The average execution time of `_is_valid_product` is 0.002 s (20 times slower than `_get_valid_products` for the same result).
=> All use of `_is_valid_product` were replaced by `_get_valid_products`
In this commit targeting master, we also completely remove
`_is_valid_product` as it effectively is no longer used and there are no
stable compatibility requirements.
OPW-2323599
closesodoo/odoo#56460
X-original-commit: c3a9738e25dbd773e3ee7c2175e62219346ef764
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
_("Foo %s", bar)
to progressively migrate the code to the new syntax.
A few calls were not technically incorrect but still detected by the
linter.
_("Foo" +
"Bar")
has been converted to
_("Foo"
"Bar")
as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).
closesodoo/odoo#53683
Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
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
closesodoo/odoo#51574
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This refactoring extracts parts of `sale_coupon` module to create a more
generic module called `coupon`. This new module can be extended in
different sales modules to implement functionalities specific to modules
that extend it.
An initial step to prepare the creation of coupon module. The main goal
is to just move the logic from sale_coupon to coupon. To come up with
less diff as possible, this rename/move step is beneficial for this
purpose.