Excluding non-active records decreases number of combinations generated in
_cartesian_product. The excluded combinations have to be rejected anyway [1], so
don't waste time on it.
STEPS:
* activate "Product Configurator"
* create a product with many attributes
* make some `product.template.attribute.value` inactive (ptav_active = False):
** create a sale order with that value (e.g. color "Black" in "Customizable Desk (CONFIG)")
** delete that value in `product.template` form (tab "Variants")
* add the product to a sale order
* RESULT: `_cartesian_product` doesn't generates combination with archived attribute
[1]
https://github.com/odoo/odoo/blob/f9d26509a714ecd290c42e1d58e416bb01268447/addons/product/models/product_template.py#L839-L841
---
opw-2540675
closesodoo/odoo#74310
X-original-commit: ce487c920c777735e5e7e46ee131cb18dfc5c9fc
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
Currently, pricelists can be deleted even if a pricelist rule uses this pricelist as base.
This leads to an error when the rule is used because it tries to access a deleted record.
This commit restricts the deletion of such pricelists, avoiding later tracebacks.
closesodoo/odoo#73907
X-original-commit: 8c3c7d9e85ca4353d3b8501cc5c484a3bd955754
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: vfe-odoo <Feyensv@users.noreply.github.com>
Re-introduce after discussion with AL the function that allow to specify
a custom placeholder for a specific model.
It has been removed because no more used since we use avatar mixin for
res.users and res.company. But it doesn't means that each model should add
his own mixin and controller and ... Keep it simple!
Use it for product and product template to have a default placeholder more
representative of the model.
Courtesy of xlu-odoo for this design
opw-2513801
closesodoo/odoo#73576
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Steps to reproduce:
- Create a new pricelist;
- In the Price Computation, select "Formula" then
change it to "Based on Cost";
- Change the price computation back to "Percentage (discount);
- Create a sale and set this new pricelist.
Issue:
Price discount made on the cost of the product instead to get back
to sale price as default
Cause:
When switching `Compute Price` and != 'formula', not setting back
`Based on` (base) to `Public Price` (list_price).
Solution:
If compute_price is changed and new value != 'formula'; set
pricelist `Based on` to `Public Price`.
opw-2587295
closesodoo/odoo#73263
X-original-commit: 3f409c08723827766db4b3f40d7777f485e78230
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
Before this commit, products relying on values of template fields (i.e.
image) were not considered updated when their fallback template field
was updated.
After this commit, upon update of a template image, all products that
would fallback on that template are "touched".
This avoids side-effects such as displaying an outdated template image
in the e-commerce for a given product.
task-2477438
closesodoo/odoo#71139
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
It replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).
Models -> Fields
1) sale.order -> note
2) sale.order.template -> note
Task Id: 2499504
X-original-commit: 6a345c2695129a5cd907e5e23e057871ebf9ebfa
- Rename Priority to Favorite
- Move the priority field star icon in the kanban view
- Remove the sequence field from the list view
- (website_sale) make the favorite column optional in tree view
- (website_sale) keep same order in kanban view than in list view
task-2496758
closesodoo/odoo#69657
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Regarding of the `display_default_code` context value, `display_name` is
supposed to return the product code or not, eg:
> product.display_name
> '[FURN_6666] Acoustic Bloc Screens'
> product.with_context(display_default_code=False).display_name
> 'Acoustic Bloc Screens'
But since the context was not considered when accessing this field, it would
always return the cached value, which was set from the first time that field
was read, with the `display_default_code` value used at that time.
tl;dr: `display_name` was ignoring the context once cached.
One of the critical issue was that internal code were displayed on the eshop
cart (not the eshop itself), see `name_short`.
task-2517830
closesodoo/odoo#70739
X-original-commit: b5b4d38adf1f3960cda21b795a26e67b978b2901
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
1. add packaging to PO lines
2. packaging on PO/SO lines can be propagate to MO
3. add package type to packaging
4. on picking types, we can choose to only reserve full packaging. That
means if you want 1 pallet(100 units) and you have 50 units in stock. It
won't be reserved.
5. suggest suitable packaging for PO/SO/MO line according to the product
qty
Task-2357259
PR #68654
UPG PR odoo/upgrade#2444
The attributes field.depends and field.depends_context are problematic
for sharing fields across registries, because they depend on the model's
registry class, which may vary from one registry to another. In order
to make computed fields shareable, we have to move those values away
from fields.
For the same reason, field.recursive should not be inferred, because its
value may depend on the registry, although it is generally not the case.
Moreover, the flag recursive=True is set on a field when field triggers
are determined (on the registry). A compute method may be called before
the flag is set (if no update has been done yet), and that can lead to
incorrect computations.
This happened in test TestUsers2.test_reified_groups in module 'base'.
The user groups view was apparently determined without the flag being
set, and the view depends on the recursive field 'trans_implied_ids',
which was not correctly computed.
We thus force developers to be explicit about recursive computed fields.
The code now logs a warning when the flag is not set up properly.
*: portal, portal_rating, product, sale, sale_product_configurator,
website, website_sale_comparison, website_sale_product_configurator,
website_sale_stock, website_sale_wishlist, point_of_sale
Redesign of the product page + various UX improvements.
task-2009483
Part of #66736
The compute of `product_variant_count` was highly inefficient
in batch. It is due to `with_prefetch` which remove the prefetch
(reset _prefetch_ids = _ids) of the for loop.
It was added by 05a00fa9d4
which fixed performance issue for the 11.0 about
`sales_count`. But with the new ORM (13.0) compute fields are lazy.
Performance improvements:
For the search_read of the kanban view (Menu: Sale/Products/Products)
with the default pagination (80 items):
Before: 347 SQL request and 0.31 +- 0.2 sec (Python and SQL time)
After: 110 SQL request and 0.14 +- 0.2 sec (Python and SQL time)
task-2439019
Changed the uom of product package if product_length_in_feet_param
of ir config parameter for product is not 1. Previously its value
was meter.
For following fields updated the uom -
1) packaging_length
2) width
3) height
closesodoo/odoo#64735
Taskid: 2418421
Related: odoo/upgrade#2089
Related: odoo/enterprise#15848
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
Extract the way images are set on a product into a new method to
allows having the same behavior with other variant fields.
Now also used to set an Intrastat code varying from the template one.
Task id #2369561closesodoo/odoo#65348
Related: odoo/enterprise#15099
Related: odoo/upgrade#1996
Signed-off-by: William André (wan) <wan@odoo.com>
The function `_get_possible_combinations` generates possibles combinations
for the product template attribute values (ptav) of each product template
attribute line (ptal) of a given product template. It used to iterate over
them using a cartesian product. A combination can be invalid if it
contains two incompatibles ptav. The problem is that it used to filter out
invalid combinations after generating them. It's a problem because there
can be a lot of invalid combinations to filter out before finding a valid
combination. Even before the first valid combination if the first ptav of
the two first ptal are incompatible.
The solution brought by this commit is to reject the invalid combinations
while building them rather than after. It does so by using a cartesian
product implementation with early rejection. The algorithm tests each
ptav when incorporating it in a partial combination and if it's
incompatible, it goes to the next partial combination and thus skips all
combinations starting with the invalid partial combination.
The client that reported the issue has a product template with about 25
ptal with an average of 9 ptav. The ptav of the first ptal was
incompatible with the first ptav of second ptal. It had to build and
filter out 5.76*10^15 ptav before finding the first valid ptav. If we
generate 10^6 ptav by second (it's much less) user would get first ptav
after 182 years. Now it's instantaneous.
opw-2335936
closesodoo/odoo#65809
X-original-commit: 98616c4676aa6ef5507110c0e407a640082abbaf
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Purpose of the commit is to prevent the hierarchical name of
category in search panel.
So in this commit, Override the the name_get to prevent the category
hierarchy on search panel as we already displaying parent categroy
in search panel.
closes odoo/odoo#65442
Taskid: 2417252
Closes: #65442
Related: odoo/enterprise#15550
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose of the task is to Improve the current pricelist line
form view for clarity.
SPECIFICATIONS:
- Move the price computation on top and apply on at bottom.
- Improve the formula view and calculate dynamic tips based
on formula value.
closesodoo/odoo#63733
Taskid: 2373068
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Modifying product attributes involves discarding product variants via
the method _unlink_or_archive(), which tries to delete variants, and
archive the ones for which the deletion fails. This process is very
slow when most product variants must be archived. Instead, we filter
out the variants that must be archived anyway (like the ones used in
sales or stock), in order to avoid the variants that cannot be deleted.
On a product with ~200 variants, the time goes from more than 15 minutes
(the request times out) to around 5 seconds!
opw-2440417
closesodoo/odoo#65027
X-original-commit: 63b2f85079404eafac918a74c95e27051539c133
Signed-off-by: Raphael Collet (rco) <rco@openerp.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.
Done for res.partner.bank, res.company and board models. Some override may
have been ignored because heavily linked to business code (like company
in stock).
See merge commit for more details.
Task ID-2330149
COM PR odoo/odoo#61246
ENT PR odoo/enterprise#14561
One can set a Unit of Measure precision rounding more
precise than the overall Decimal Accuracy. This can trigger the error
'It is not possible to unreserve more products', as there will be
inconsistencies on reserved quantities due to decimal roundings.
We add 2 warnings on Units of Measure and Decimal Accuracy.
Therefore, users are warned when their UOM/decimal changes can
cause inconsistencies in quants reservation.
Also, we want to prevent the issue at the root by ensuring that both the move
and the quant have the same reserved quantity.
The contrary can happen e.g. when a product is defined in Liters (rounding .001)
but used in an operation in ml (rounding .01, so e.g. 187.5ml).
The conversions between the 2 UOM can cause the differences of reservations.
In _prepare_move_line_vals we make sure uom_quantity_back_to_product_uom
is not more precise than the overall Decimal Accuracy. That way, if
the reserved quantity changes between UOM conversions, the move line created
is in the quant/product UOM, and we do not have move line's reserved quantity >
quantity in stock.
We do the same for _update_reserved_quantity (stock.move), when updating
a move line.
In _update_move_lines, because of UOM conversions, new_quantity_done
can differ from ml.product_uom_qty, which triggers the creation of an extra
move line, leading to reserved quantity > quantity in stock. To prevent
that, we compare the reserved quantities in the product UOM.
opw 2206902 (Example 1)
opw 2171541
opw 2221227
opw 2233937
opw 2198775
and many more
closesodoo/odoo#62279
X-original-commit: 478a42beb5876171afeab7df27fa69548edbf849
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
What are the steps to reproduce your issue ?
1. Go to 'odoo.com/trial' and create a database with 'account'
or
1. Start local server with a new database and with '--without-demo=all --init=account'
2. Change main currency from 'EUR' to 'USD' in settings
What is currently happening?
Error raised when trying to install 'point_of_sale'
What are you expecting to happen?
Install 'point_of_sale' normally even after changing main currency
Why is this happening?
But there is a condition which verifies that there is not already
a pricelist with the currency we want to set or with the currency
of the company. Otherwise it prevents the pricelist modification
How to fix the bug ?
Change the condition so that it allows the change of the pricelist
in the case where the currency we want to set is not the same as the
currency of the company
opw-2376457
closesodoo/odoo#61847
X-original-commit: 716e0e791da1e4647dab29959b7012e366aa7b1f
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
This variable has been unused since commit f3d6a54e36.
opw 2368733
closesodoo/odoo#61143
X-original-commit: 563253a8303723e3eb4217005bf518fdf6b3f9e3
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
The pricelist item model (product.pricelist.item) has a compute_price field,
and the necessary fields to be able to compute the price of a product.
However, these fields are never used into the model itself;
the parent model (product.pricelist) actually makes the computation,
embedded into _compute_price_rule.
Because of this, it's not possible to inherit pricelist items.
It's also a better design, on object principles.
Last, it lighten a method that is still 130+ lines long.
opw 2368733
X-original-commit: 9cd0bf740706a64e49599111304a6fb5ec6d7287
Behavior prior to this fix:
When archiving the last variant on a template, the product template
stays active (contrary to the comment indicating that `toggle_active`
will archive the related product.template if there is only one active
`product.product`).
Behavior after the fix:
When archiving the last variant on a template, the product template is
archived. When un-archiving that variant, the product template is
unarchived as well, without un-archiving the other variants.
Note: this is a remake of a fix implemented in 77e5472c041e, as that fix
did not correctly count the inactive variants.
opw-2349862
closesodoo/odoo#60641
X-original-commit: 01160ee5e7f726f3035c566a13e26825236dedfd
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
This provides a better API to search for records by name without the
formatting part (`display_name`).
This also simplifies all the overridings of `_name_search` that no
longer need to call `name_get()`. The call to `name_get()` is done in
method `name_search` in a generic way.
Issue
- Install Sales with Product Configurator
- Create a product with 2 dynamic variants:
- Color: blue, red
- Size: S, M
- Create a quotation with that product (any variant)
- Sales > Products > Products Variants
Your product variant is there
- Modify your product template and add "green"
to colors
- Sales > Products > Products Variants
Your product variant is archived
Cause
The logic which determines which variant
should not be archived is only applied
on products that don't have dynamic variants
See https://github.com/odoo/odoo/blob/820fe9a025e34e81368a189ee295b4abcf9fcbda/addons/product/models/product_template.py#L576
Solution
Do a separate logic for dynamic variants that doesn't compute
all possible combinations.
But being sure that it:
- doesn't archive when adding/removing a value
to an existing attribute line
- archive when adding/removing a new attribute line
OPW-2293346
closesodoo/odoo#55016
X-original-commit: 8517fdfa2605e8d15f5e38f2074ece7ba543d56b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Avoid concatenation of translated strings & raw values and/or other
translated values, and use the new _ API (by providing the formatting
values to ensure the fallback on the english terms in case of wrong
translation).
By including the expected values inside the string to translate, we
ensure that the formatted values are included at the right place in the
resulting translated text.
This also provides more information on the string to translate to
the translators, s.t. the chosen terms for the translations can be more
adapted to the translation context.
closesodoo/odoo#54635
Related: odoo/enterprise#11925
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Before this fix, the search on the supplierinfo had
an undeterministic result.
When testing odoo/addons/purchase_stock/tests/test_reordering_rule.py:66
`def test_procure_not_default_partner`, it may fail at line 120.
It sets 2 suppliers:
- Firstly, the `default_vendor` (let's assume id=120)
- Then, the `secondary_vendor` (let's assume id=121)
It then runs a procurement without setting the supplier and assert
that the partner of the resulting PO line should be `default_vendor`.
The return of
odoo/addons/product/models/product.py:574
`def _prepare_sellers` depends on Postgres when the supplierinfo
sequence, min_qty and price are the same for multiple records.
By adding the `id` to the `.sorted`, the result will order correctly in that
case.
opws-2272627
-2282081
-2287079
And PS-BE via CSC reported more cases without opw.
closesodoo/odoo#53951
X-original-commit: a733feb8e022084148685599840fe542ee9dafd1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Missing super call for product category deletion.
closesodoo/odoo#53699
X-original-commit: ebc75df2b3d3f80aebc2fc1d8500fa57c1755bbd
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Updating the uom_id on a product_product will eventually change also the
uom_po_id to have them belonging to the same category. Saving the update
call write() on product with a dict of two values (uom_id and uom_po_id)
As product.product is inherited from product.template, the write() on
the corresponding product_template is called but in this case 2 times
for each values. The first time, only uom_id is updated. The _check_uom
constraint is triggered and obviously failed. The uom_po_id on the
template is not yet updated.
This commit makes the sync in the beginning of write() of product.template.
Which means before calling the constraint.
This commit also makes the onchanges on uom_id acts the same between
product.product and product.template.
Task : 2197818
closesodoo/odoo#48714
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
When more than one parameter is present in a message, it helps the
translation to use named placeholder. This way, the order can be
changed. It also helps the comprehension of the message.
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))
Old syntax is still compatible but starts the migration to the new
syntax that catches error.
When importing a file to populate a pricelist applying to a product
category, it is necessary to add a leading space to ` Product Category`
name to match with `2_product_category`.
We can simply remove it.
opw-2271033
closesodoo/odoo#52722
X-original-commit: 11809ee1a12df6b967f03591adb6d11579e3e947
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Create a new company with it's currency
A default price list has been created for this company in this currency
Install the "customizable Chart of Account" under the settings tab, Accounting
By installing this CoA, Odoo creates a new pricelist, in Dollars,
that overwrites the one in the currency of the country.
Avoid creating the new pricelist if there is already a
pricelist for the current company in the company currency
opw-2221854
closesodoo/odoo#52429
X-original-commit: dc0d6af54f56bf6e576013d67cf44b5cd3608351
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Add sudo in base to allow a unpriviledged user to interact with
ir.property in a safe way usingsetters and getters.
By making them callable without sudo, we encourage to use these
methods instead of making CRUD requests on ir.property directly
For other specific search where no native method exists, add sudo
The business case is the following:
1) The Child company can order the product to the Parent company;
2) The Parent company order the product to a 3rd party supplier.
Settings:
- Enable ‘Inter-Company Transactions’ transactions with the option
‘Synchronize sales/purchase orders’ checked;
- Enable 'dropshipping'.
Set 2 companies:
- Parent company;
- Child company: which belongs to the Parent company.
Set a product 'my purchased product':
- Can be Purchased;
- Product Type: Storable Product.
- ‘Purchase’ tab:
- Set a Vendor price list line 1: which is your Parent company + set
your Child company who can buy the product;
- Set a Vendor price list line 2: which is your 3rd party Supplier +
set your Parent company who can buy the product.
- Log in as the Child company (disable the login in the Parent company,
select only the Child one);
- Place a Purchase Order for ‘my purchased product’ to vendor 'Parent
company';
- Confirm the PO.
Before this commit, an error message appears. The issue arises because
seller_ids is retrieved from the cache and not re-read as superuser.
Therefore, records are missing from the list and the correct seller is
not found.
Now, the correct vendor for the purchase order of the parent company is
selected.
opw-2261971
closesodoo/odoo#51887
X-original-commit: 0a9f0c5d2c85e80dd5dceaeacf3f04bfc8aa0be1
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Before this commit, pricelist boundaries were dates. It was not possible to get a modified price at a precise time: e.g. modify the formula at 12h00.
closesodoo/odoo#49030
Taskid: 2221094
Related: odoo/upgrade#1055
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
When no pricelist property is defined for a customer, we use a search as
fallback, without considering the current companies.
This means you can see the pricelist of company B as pricelist for a
partner, even with company A as main current company (if both company
are enabled in the multi-company widget).
Forward-Port of #46429
X-original-commit: 68040c92c8e09218641d823d690e0ce36dcdef30
Since https://github.com/odoo/odoo/commit/7d8df4bec192e5a2ff3341dcf43d59e06a57f9a9, the groups
managing pricelists features have been updated.
But the onchange feature enabling pricelist on multi-currency activation was wrongly
adapted, it was only activating advanced pricelists, iff basic pricelists were enabled.
The wanted feature is to activate pricelist (basic pricelist features: group_product_pricelist)
when multi-currency is enabled.
Also add an implied_group on multi_currency group to enforce this behavior.
closesodoo/odoo#49633
X-original-commit: f862f9650395b02f6a43c57cdf232a309fa6948e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>