Commit Graph
8 Commits
Author SHA1 Message Date
Abdelouahab (abla) ddbe814cd5 [FIX] product_matrix : fix _grid_header_cell
To reproduce
============

- Make sure you have a product with variants with grid entry enabled.
- Make sure there is "value price extra" on some of the attribute values of the product.
- Make sure multicurrency is enabled and there is a pricelist using other than the main currency of the system, to compute the final price from product sales price.
- Then try to create a new sales order, using that pricelist, adding the product to it.

A traceback is raised.

Purpose
=======

the method `_convert` expects the `company` argument to be a `res.company` and not an `int`

Specification
=============

to solve the issue we use `company` instead of `company.id`

opw-2897688

closes odoo/odoo#96333

X-original-commit: aa5076941c48b660007be0bda3eb73e965bea931
Signed-off-by: abla001 <abla@odoo.com>
2022-07-19 21:22:06 +02:00
Xavier Morel 618562802e [IMP] [sale_]product_matrix: remove t-raw
Using `sale_product_matrix`'s tour as `product_matrix` doesn't
actually have any test for this.

Remove t-raw from the product_matrix(.extra_price) template, by moving
the formatting to the client side (unclear why it was done by the
server in the first place).

Also fixes a bug where a negative price_extra would have *two* `-`
signs: one before the currency, and one after the currency: the price
being formatted should be abs'd to avoid a negation being generated by
the monetary formatting. Also uses non-breaking spaces everywhere
where the server-side formatting mixed breaking and non-breaking
spaces. Keeps from the original the peculiarity that the extra price
should always have a sign positioned before prefix currency signs.

Also changes the calling conventions of `product_matrix.extra_price`:
instead of being called with a formatted `price` it's now called with
the entire cell object.
2021-07-20 05:41:36 +00:00
Jorge Pinna Puissant 27283cac80 [FIX] product_matrix: error raised on order grid with foreign currency
- Create a price list with a foreign currency;
- Create a product with some variants;
- Configure the variants and make at least one of the variants with
  extra price;
- Set the 'Sales Variant Selection' with 'Order Grid Entry';
- Create a new quotation with the foreign currency price list;
- Add the product just created to the quotation.

Before this commit, an error is raised, because the currency convert
need a valid company id.

Now, the order grid entry is shown.

opw-2329658

closes odoo/odoo#58415

X-original-commit: bf325b60d24b7045e8bfb3f16be2476889368926
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-09-24 11:38:19 +00:00
Sébastien Theys 22a11a6f4d [REF] product, *: save product.template.attribute.value on variants
* account, hr_expense, mrp, sale, sale_product_configurator, stock_account,
  website_sale, website_sale_comparison

Before this commit, the `product.attribute.value` were stored on the variants.
This required filtering of attribute lines to find the appropriate matching
`product.template.attribute.value` that were used in most of the business code,
such as when computing the `price_extra`.

This also prevented to have multiple attribute lines for the same attribute,
which is needed to handle use cases such as grape varieties for wine products.
This will be done in the following commit.

After this commit, the combination of `product.template.attribute.value` will be
directly stored on the product variant.

Other changes
=============

Add `combination_indices` on product, which allows to quickly find a variant
matching a combination (1 simple indexed equality query as opposed to 1 query
with as many joins as there are attribute lines), and to add an easy
SQL constraint to ensure active combination uniqueness.

Add active field on `product.template.attribute.line` and
`product.template.attribute.value`, with the same behavior as variants:

They become archived if they can't be unlinked. This allows to keep the database
consistent, such as archived variants correctly keeping all their values, sales
order lines keeping their custom and no_variant. This is done with the help of
`ondelete=restrict` on the corresponding m2m fields, and the `unlink` methods
falling back to archiving when `unlink` is restricted.

Part of task-1912579

PR: #32946
2019-08-26 13:01:13 +00:00
Victor Feyens 3c6437710a [IMP] *_product_matrix: UI 2019-08-20 14:02:29 +00:00
Victor Feyens 591cb8bd8f [FIX] product_matrix : multiple extra prices 2019-08-20 14:02:29 +00:00
Victor Feyens e21656413a [FIX] product_matrix : templates with one attribute line.
Don't show "Not Available" as Line header when there is only one
attribute line on the product.template.

closes odoo/odoo#35586

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-08-09 09:06:10 +00:00
Victor Feyens e6c2975e76 [ADD] (sale/purchase)_product_matrix 2019-08-07 12:50:09 +00:00