In 11.0 7e724f96c5 is_product_variant has been introduced back (it was
removed in 10.0 b747b05fa). But related of _inherits are computed on the
related model so is_product_variant would always be false.
Without fix, added test fails with:
AssertionError:
Items in the first set but not the second: True, Items in the second
set but not the first: False, Product variants are variants
fixes#26961
related to opw-1814973
closes#27163
Defined as this, the label of the selection field were translated during code
import, when building the python model, not when a user access the field values
as it should (and is already the case thanks to the ORM).
Trying to translate a string when no user-context is available is not only
useless but may cause bug on services with multiple databases (e.g. a SaaS).
In a multi-worker environment, when the code is imported, the _ method will use
multiple scenarios to detect the language and get a cursor.
As we have no available cursor in the frame (method _get_cr from GettextAlias),
the fallback is made on the cursor of the request.
In a multi-worker environment, this could be a cursor linked to a database in
another language than English.
In such scenario, the selections would be translated in the language of the
other database instead of displaying it in English
opw-1881956
Have a product with a partner A as a seller, without any description whatsoever
Do a vendor bill with partner A as the partner.
Add the product onto the lines
Before this commit, the description on the line was "False"
After this commit, we fallback onto the product name if no other reference is set
OPW 1865969
closes#25857
When getting:
- product_variant_count,
- sales_count,
of a product.product, we would pollute the records to be prefetched by
all the variants when counting the number of variants.
Thus if this happened before sales_count, we would possibly compute the
sales_count for up to 1000 records when it could have been needed for
just one.
By using `.with_prefetch()`, a recordset will have its own records to be
prefetched list and will not pollute the original one.
opw-1865111
fixes#25649closes#23112 (PR with similar fix)
closes#25741
- Create a product named 'toto'
- Perform a call to `name_search`:
`self.env['product.product'].name_search('pouet', [], 'not ilike')`
Product 'toto' doesn't show up in the result list.
The domain should take into account that `default_code` can be `False`.
Note: the bug also occurs if the product is called 'trululu'.
opw-1837957
- Create a product with 2 variants (e.g. black and white)
- Create an invoice with one of the variant
The description doesn't contain the attribute name, as it would be in a
SO.
This is because the invoice uses `partner_ref`, which doesn't include
the attribute name.
opw-1839598
- Create a product named 'toto'
- Perform a call to `name_search`:
`self.env['product.product'].name_search('pouet', [], 'not ilike')`
Product 'toto' doesn't show up in the result list.
The domain should take into account that `default_code` can be `False`.
Note: the bug also occurs if the product is called 'trululu'.
opw-1837957
The 'Cost' price should be displayed in the main form view of
`product.product`, not only the simplified view.
The reason is that the field `product_variant_count` has the same value
for the product and the template, therefore it cannot be used to make
the distinction between the two models.
To do so, we need to reintroduce the `is_product_variant` field to make
the distinction between `product.product` and `product.template`.
opw-1814973
In 5c2380e9f an issue when modifying variants values was solved when an
attribute on the product variant had "create_variant" unset.
This commit forward-port what was lost of it in 11.0, that part was
probably lost because the code was previously changed when adapting to
python3.
Without the change, the added test failed creating a new variant keeping
the existing one. With this change, 'nocreate' value are ignored when
computing new variants to create.
opw-1815226
closes#23332
Take account of the user timezone to compute the price for
pricelist rules with start / end date.
Before this revision, the date used to compare to
the dated pricelist rule is always the date of today
in UTC.
For instance:
- If a user is in timezone UTC +12
- The 10% discount on the pricelist starts on December 19
- It's currently December 18 13:00
The user did not have the discount,
because it was consdiered December 18,
while the user was already in December 19.
With this revision, we take account of the context
and its timezone to compute the date of today
and return the correct price according to the
dated start and end datetime.
opw-785203
Before this commit, the smart button on the form of product category
only displayed the number of product for the current category,
whereas the list view of products (when you clicked on the smart button)
displayed all sub-categories products.
After this commit, the behavior is harmonized: all sub-categories products
should be accounted for and displayed
OPW 782905
The logic was not the same in function _compute_product_pricelist and in function
_inverse_product_pricelist.
The function _get_partner_pricelist must check the default pricelist for the company when
no pricelist is given for the specific partner(res_id) because the function set_multi doesn't
set a specific pricelist to the partner if the pricelist set and the default one are the same.
opw:779808