This revision is related to 93d4db9d1e.
Usually, for models with an image, the original `image` is stored
in the field `image`, and then the resized value are in the fields
`image_medium` & `image_small`.
In the specific case of the product variant, this is not the case,
the original image is stored in the field `image_variant`,
and the `image` field uses as well the method `_get_image_variant`.
The `image_get_resized_images` must therefore return the "big image"
as well, which is returned with the key `image`, by default.
This is done using the method argument `return_big`.
This is possible to set an image for a specific variant
When this was the case, the image displayed was always the
image within its original size, it wasn't resized
to small and medium sizes.
opw-657055
This revision adds the possibility to use the key
`default_category_id` in the context to set
the UoM category when quick creating a new UoM,
like it's the case everywhere else with the
`default_*` keys passed in the context.
Closes#4407
The function "name_search" defined on "product.template" made a search on
"product.product" name to give the "product.template" which matched with the
search. The number of results given by the name_search on "product.product" is
generally limited to 8. The problem was when for example there were 8 variants ("product.product")
with a name begining by "AA" for the same "product.template" T1 and another "product.product"
with a name begining by "AB" linked to T2. In this situation, if a name_search was made on "product.template" with a name="A",
the result got was just the the name of T1 linked to the 8 variants instead of the name of the
two templates (T1 and T2) due to the limitation.
opw:647066
Using the new API takes better advantage of the cache than calling `read()`.
In the list of products, `name_get()` now generates 2 queries instead of 144!
The product view forces the decimal accuracy to 3 digits on weight and
weight_net, but the accuracy can actually be set using the 'Decimal Acuracy'
feature so it must not be forced here.
"product.product" model inherits from "product.template" model then
all the float fields in "product.product" include those from "product.template".
A list is used to conserve the order of the fields.
Fixes#2067
opw:639766
This is related to revision 73432ffe9f.
The inherited view adding
the purchase pricelist field on the partner form
no longer worked for user being in the purchase pricelist group
but not in the sale pricelist group, since the field was added
after the sale pricelist field, which was no longer in the view
for these users.
This revision partially revert the above revision, but
add the purchase pricelist group in the groups of the view,
so the view is loaded only if the user is part of one group
or the other.
opw-639685
If the whole view relates to a specific group,
apply the group on the view itself instead of
each view part (each fields, each page, each div,...),
so the view is loaded / added to the base view
only if the user is in the right group.
So the view is not loaded uselessly
and the fields are not read for nothing
(performances & security).
Indeed, when a group is applied on a field itself, the field content
is read, but hidden, therefore reading the content of the field
uselessly, and potentially leading to accesses issues
if the user hasn't the rights to read the field.
(e.g. reading a property when not having access to the model
of the proprty, pricelists on partners for instance)
opw-634402
When the product is a consumable, avoid to use real-time valuation, by adapting
the onchange in the views and making the valuation field invisible when the
product is a consumable / service.
Double list comprehension is a nice try but does not work in python.
prod_ids was a list containing only the first variant, so getting the
product-specific pricelists only for the first variant of the first template.
Fixes#2900
If a product as only one variant, using the product.product or the
product.template in the pricelist configuration should have the same effect.
This is particulary important for the ecommerce where template without variants
do not show the product. Having a pricelist for that product had no effect on
the price used in the e-commerce.
Fixes#2900, opw 615153
Before this rev.,
if you had two child categories with the same name, e.g.:
- Chocolates / Orange
- Fruits / Orange
In the product list, searching for category "Fruits / Orange"
also returned the products from category "Chocolates / Orange",
because it fetched all products which had "Orange" in the category.
This rev. corrects this (in the above example, it returns
only products from category "Fruits / Orange".
The code is particularly complex. A proper solution would be
to store the complete name field (but this cannot be done in
stable releases, such as 8.0).
Besides, it handles the fact a product category child can have
' / ' directly in its name (it's not only the category tree separator).
e.g., you could have a category name called 'Fruits / Orange' directly
not only in the complete name.
opw-628793
This rev. is related to 489a96c257
It wasn't possible anymore to perform an import of
a product.template field in a model
(e.g. mrp.bom), while it should be the case.
In the context of an import,
the operator of the name_search is '='.
Therefore, in this super call, the operator was '='
and the name was '' (empty).
In such a case, ('name', '=', '') is added
to the search domain by the base name_search method
(in models.py),
leading to the domain
[('id', 'in', template_ids), ('name', '=', '')]
which will lead to no results.
Forcing 'ilike' as domain is correct, as the actual
name_search, with the correct operator,
has already been performed in the lines above, the
point of this second name_search is to get
the right order along with the right name_get.
opw-632089
In the form view of a unit of measure,
if the unit of measure was of type
"Bigger than the reference unit"
The help in the tooltip of the ratio field was wrong
Besides, this help message was contradictory
with the formula written just below the field.
opw-631672