Commit Graph
241 Commits
Author SHA1 Message Date
Nicolas Lempereur 07cdd24f30 [FIX] product: is_product_variant true if variant
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
2018-09-24 09:45:52 +00:00
Raphael Collet d39d583b21 [FIX] product: partner property_pricelist load in batch for pos
Reimplement the compute method of the field to make it work in batch.
2018-09-14 14:25:00 +02:00
Martin Trigaux a47f7ee0e4 [FIX] product: do not translate at code import
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
2018-09-14 11:20:38 +02:00
Christophe Simonis 219d2296d6 [MERGE] forward port branch saas-15 up to c4ee29345a 2018-07-23 15:45:08 +02:00
Christophe Simonis c4ee29345a [MERGE] forward port branch saas-14 up to 9ee882564f 2018-07-23 14:57:03 +02:00
Christophe Simonis 9ee882564f [MERGE] forward port branch 10.0 up to 6e71cf8a71 2018-07-23 14:21:06 +02:00
Lucas Perais (lpe) ee746b52cd [FIX] product: fallback onto name for product.partner_ref
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
2018-07-19 09:25:33 +02:00
Nicolas Lempereur 05a00fa9d4 [FIX] product: variant num w/o prefetch pollution
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 #25649
closes #23112 (PR with similar fix)
closes #25741
2018-07-13 10:52:33 +02:00
Christophe Simonis 4479aac52f [FIX] product: correctly set partner_ref
Oversight of previous forward-port
2018-06-12 16:53:44 +02:00
Christophe Simonis e3658d6f56 [MERGE] forward port branch saas-15 up to d44cd77884 2018-06-12 16:31:54 +02:00
Stephane Le Cornec 05f8bbd635 [FIX] product: use given argument in name_search override
Do not force to use the comptued one. Make an AND between both.

Closes #22396
2018-06-12 16:09:08 +02:00
Christophe Simonis d44cd77884 [MERGE] forward port branch saas-14 up to 284ed9216c 2018-06-12 12:19:14 +02:00
Christophe Simonis b6496f8b38 [MERGE] forward port branch 10.0 up to 9032617120 2018-06-11 19:20:38 +02:00
Martin Duvergey abe7e6c376 [FIX] product: add missing break statements in for/else constructs
The code of the product was always the default one, not the one of the seller

Closes #24905
2018-06-11 17:47:38 +02:00
Christophe Simonis 810603f4ef [MERGE] forward port branch saas-14 up to 55ce6aff10 2018-05-02 14:49:58 +02:00
Christophe Simonis 55ce6aff10 [MERGE] forward port branch 10.0 up to 79bbd1dcb8 2018-05-02 13:52:12 +02:00
Nicolas Martinelli 79bbd1dcb8 [FIX] product: name search not ilike
- 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
2018-05-02 12:58:52 +02:00
Nicolas Martinelli 5ac9d8e57f [FIX] product: variant in partner_ref
- 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
2018-05-02 12:39:16 +02:00
Nicolas Martinelli d88c3706df [FIX] product: name search not ilike
- 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
2018-04-26 15:07:01 +02:00
Goffin Simon a36ff26ce0 [FIX] point_of_sale, sale_stock, stock_account: POS Anglo-Saxon Accounting
In average price or in FIFO, the stock move cost related to the picking of the POS Order
must be used to compute the price.

opw:1829842
2018-04-04 16:16:59 +02:00
Christophe Simonis e8f630e44d [MERGE] forward port branch saas-15 up to 7a45296cf1 2018-03-21 18:20:22 +01:00
Christophe Simonis 7a45296cf1 [MERGE] forward port branch saas-14 up to 78dced6bc2 2018-03-21 16:49:15 +01:00
Christophe Simonis 78dced6bc2 [MERGE] forward port branch 10.0 up to c2b3ad1899 2018-03-21 15:55:26 +01:00
Christophe Simonis 0cefaad370 [MERGE] forward port branch 9.0 up to 2c5fe07fc7 2018-03-21 11:35:58 +01:00
Nicolas Martinelli 7e724f96c5 [FIX] product: display Cost price of product
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
2018-03-15 13:35:54 +01:00
Nicolas Lempereur 60974227cf [FIX] product: create_variant forward-port 5c2380e
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
2018-02-27 12:06:49 +01:00
Christophe Simonis 72508cc241 [MERGE] forward port branch saas-16 up to 7792755946 2018-02-14 18:26:57 +01:00
Christophe Simonis 7792755946 [MERGE] forward port branch saas-15 up to d24bdbde81 2018-02-14 17:18:59 +01:00
Christophe Simonis d24bdbde81 [MERGE] forward port branch saas-14 up to 9d0de61114 2018-02-14 16:34:13 +01:00
Christophe Simonis 9d0de61114 [MERGE] forward port branch 10.0 up to 73c2ac451a 2018-02-14 16:04:23 +01:00
Raphael Collet e9d944f960 [FIX] product: product with single value for a "nocreate" attribute
The use-case is: update a product template by setting an attribute with
create_variant=False and a single value.
2018-02-14 15:29:43 +01:00
Christophe Simonis 2dbc1edef9 [MERGE] forward port branch saas-16 up to b503e79722 2018-02-05 13:42:10 +01:00
Christophe Simonis b503e79722 [MERGE] forward port branch saas-15 up to 81003c82e0 2018-02-05 13:08:32 +01:00
Christophe Simonis 81003c82e0 [MERGE] forward port branch saas-14 up to f22cf5f711 2018-02-05 12:36:48 +01:00
Christophe Simonis f22cf5f711 [MERGE] forward port branch 10.0 up to e5f2e6d390 2018-02-05 12:02:02 +01:00
Christophe Simonis e5f2e6d390 [MERGE] forward port branch 9.0 up to b08185fc66 2018-02-05 11:30:42 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Christophe Simonis 0af13af5de [MERGE] forward port branch saas-15 up to ddd293065e 2018-01-02 15:36:25 +01:00
Christophe Simonis ddd293065e [MERGE] forward port branch saas-14 up to ba2a83ddfa 2018-01-02 15:02:26 +01:00
Christophe Simonis ba2a83ddfa [MERGE] forward port branch 10.0 up to e336dc38ca 2018-01-02 13:56:49 +01:00
Denis Ledoux f3da958fa1 [FIX] product: price computation with dated pricelist rules and tz
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
2017-12-18 18:23:22 +01:00
Graeme Gellatly a9a1895b31 [FIX] product: correct seller selection
Choose the date in the user's tz
Compare the quantities using float_compare to avoid rounding issues during UoM
conversions

Closes #21359
2017-12-06 15:54:24 +01:00
Christophe Simonis f96a797fe6 [MERGE] forward port branch saas-16 up to b8540eefe3 2017-12-06 11:59:38 +01:00
Christophe Simonis a8d01cbf4e [MERGE] forward port branch saas-15 up to a447da75fd 2017-12-04 20:12:19 +01:00
Christophe Simonis a447da75fd [MERGE] forward port branch saas-14 up to e7d174a142 2017-12-04 19:25:51 +01:00
Christophe Simonis 426e269c22 [MERGE] forward port branch 10.0 up to 067a241ea8 2017-12-04 16:24:24 +01:00
Lucas Perais (lpe) 4aef443135 [FIX] product: product category smart button: sub categ too
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
2017-12-04 15:42:06 +01:00
Goffin Simon 661dab1ed6 [FIX] product: Keep the stable behavior
Revert of this commit: 7f989b94b0
because it changes the behavior in stable version.

opw:779808
2017-11-14 22:35:57 +01:00
Goffin Simon 7f989b94b0 [FIX] product: Impossible to get the right pricelist in multi company
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
2017-11-14 16:59:13 +01:00
Christophe Simonis 8f1e2044cd [MERGE] forward port branch saas-16 up to 810b6aa760 2017-10-31 16:29:07 +01:00