Commit Graph
608 Commits
Author SHA1 Message Date
Ivan Yelizariev 2da2f5d5dc [FIX] product: speed up _get_possible_combinations
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

closes odoo/odoo#74310

X-original-commit: ce487c920c777735e5e7e46ee131cb18dfc5c9fc
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-07-27 11:05:17 +00:00
Stephan Keller 58dd5fc2b2 [IMP] product: validate date_start and date_end for pricelist items 2021-07-15 09:31:44 +00:00
Florent de Labarreandvfe-odoo 002cac0701 [FIX] product: restrict deletion of used pricelists
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.

closes odoo/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>
2021-07-16 15:59:33 +00:00
Jeremy Kersten 4d3b29c7b7 [IMP] web, product: reintroduce _get_placeholder_filename on model
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

closes odoo/odoo#73576

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-14 14:57:17 +00:00
Nasreddin Boulif (bon) 88ae867203 [FIX] product: reset Based on on change pricelist Compute Price
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

closes odoo/odoo#73263

X-original-commit: 3f409c08723827766db4b3f40d7777f485e78230
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-07-05 18:52:17 +00:00
Benoit Socias 07caac0a0a [FIX] product: touch impacted products upon updating product templates
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

closes odoo/odoo#71139

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-07 09:29:37 +00:00
dht-odoo bea5790713 [IMP] sale, product: improves field type from text to html
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
2021-06-07 05:21:40 +00:00
Romain Derie 01788decbb [IMP] product, website_sale: small improvements on priority field
- 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

closes odoo/odoo#69657

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-06-03 12:26:09 +00:00
Romain Derie e3295ed8ab [FIX] product: correctly consider context key for display_name
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

closes odoo/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>
2021-05-12 11:54:06 +00:00
fw-bot 84fb0987f2 [FIX] stock, purchase: performance in Replenishement report
Forward port of #70351

closes odoo/odoo#70557

Related: odoo/enterprise#18215
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-05-10 08:54:32 +00:00
yhu-odoo 688d655305 [IMP] {purchase, sale}_stock, product: packaging revamp
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
2021-05-06 13:36:28 +00:00
Raphael Collet 34d6f87d54 [REF] core: put field.depends on registry and make field.recursive explicit
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.
2021-05-03 12:33:29 +00:00
Benjamin Vray 3e03bd9a39 [IMP] website_sale, *: redesign the product page for e-commerce
*: 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
2021-04-01 14:56:36 +00:00
Rémy Voet (ryv) 9253643fd0 [FIX] product: fix performance tree/kanban views product
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
2021-03-30 09:27:05 +00:00
JF Aubert 687c206010 [IMP] product: Favorite Products
Set products as favorites
Filter your favorite products
Sort results on
  . favorites
  . alphabeticals

closes odoo/odoo#61852

Task: 2373850
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-03-24 12:48:32 +00:00
Andrea Grazioso (agr-odoo) 6cb4a5dacf [FIX] product: avoid traceback when accessing a product.product record
This reverts commit ed17f560fa which
introduced a check not needed anymore as the field measure_type does not
exist any more since:
https://github.com/odoo/odoo/commit/52ed0be17e80aa6bcc24d59620dd3462b6d577c3

opw-2482554

closes odoo/odoo#68114

X-original-commit: 0c77a856c35558331f43ea8b2e0c391965d3a705
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-03-18 16:56:28 +00:00
Pratima Gupta acd67ab477 [IMP] uom: added mm uom for length of product package
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

closes odoo/odoo#64735

Taskid: 2418421
Related: odoo/upgrade#2089
Related: odoo/enterprise#15848
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-03-22 05:00:01 +00:00
Nicolas (vin) fdd93cbb76 [REF] product: Generalise the setting of variant fields
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 #2369561

closes odoo/odoo#65348

Related: odoo/enterprise#15099
Related: odoo/upgrade#1996
Signed-off-by: William André (wan) <wan@odoo.com>
2021-03-02 15:08:25 +00:00
Adrien Horgnies 1705a40a9d [FIX] product: generate variant combinations faster
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

closes odoo/odoo#65809

X-original-commit: 98616c4676aa6ef5507110c0e407a640082abbaf
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-02-16 13:18:34 +00:00
Barad Mahendra f379e2e373 [IMP] product: prevent the hierarchical category name in search panel
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>
2021-02-16 13:35:26 +00:00
Kamesh Patel 52b87b6948 [IMP] product: Improve pricelist item form view
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.

closes odoo/odoo#63733

Taskid: 2373068
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-02-03 15:41:27 +00:00
Ivan Yelizariev f9fb24f1b5 [FIX] product, sale, stock: speed up discarding product variants
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

closes odoo/odoo#65027

X-original-commit: 63b2f85079404eafac918a74c95e27051539c133
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-25 18:32:23 +00:00
Adrian Torres 679185f3e8 [IMP] *: replace all raises inside unlink by api.ondelete
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
2020-12-04 09:16:16 +00:00
Victor Feyens caeda18bec [IMP] base, various: support batch creation
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
2020-12-03 10:18:36 +00:00
Fanny He ccb6b26336 [FIX] product, decimal_precision, stock, mrp: Prevent quant reservation issue
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

closes odoo/odoo#62279

X-original-commit: 478a42beb5876171afeab7df27fa69548edbf849
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-11-24 19:06:39 +00:00
Victor Feyens 4f825cbfce [IMP] *: remove useless returns in constraint methods
Constraint methods are not expected to return anything.

* Code cleanup
* Reduce "wrong" constraints definitions due to future c/c.

Task Id: 2328664
COM PR: https://github.com/odoo/odoo/pull/55525
ENT PR: https://github.com/odoo/enterprise/pull/12250
2020-11-20 10:04:27 +00:00
Achraf (abz) 6d78c58ceb [FIX] product: Change public pricelist currency when changing main currency
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

closes odoo/odoo#61847

X-original-commit: 716e0e791da1e4647dab29959b7012e366aa7b1f
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-11-17 12:01:33 +00:00
nans 2c7f9f7553 [FIX] product: remove unused confusing variable
This variable has been unused since commit f3d6a54e36.

opw 2368733

closes odoo/odoo#61143

X-original-commit: 563253a8303723e3eb4217005bf518fdf6b3f9e3
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-02 11:54:10 +00:00
nans 922dbe7de0 [IMP] product: extract pricelist item price computation into its model
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
2020-11-02 11:54:10 +00:00
Nicolas Galler fbd24823e7 [FIX] product: archiving last variant must archive product template
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

closes odoo/odoo#60641

X-original-commit: 01160ee5e7f726f3035c566a13e26825236dedfd
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-23 14:32:09 +00:00
Raphael Collet 1f48130d2b [REF] core: _name_search() now returns a list of ids
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.
2020-08-18 13:02:41 +00:00
Antoine Prieels 0c3fe8736d [IMP] point_of_sale: Product configurator
Configure products with create_variants = 'never' from the POS

closes odoo/odoo#54956

Taskid: 208205
Related: odoo/upgrade#1522
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-07-30 13:08:24 +00:00
jvm-odoo 054894c35c [FIX] product: fix dynamic product variant archiving
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

closes odoo/odoo#55016

X-original-commit: 8517fdfa2605e8d15f5e38f2074ece7ba543d56b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-07-27 17:27:14 +00:00
Victor Feyens e8893f84ab [IMP] *: translations improvements
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.

closes odoo/odoo#54635

Related: odoo/enterprise#11925
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-07-23 12:13:19 +00:00
jev 19a504b627 [FIX] product: deterministic seller selection
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.

closes odoo/odoo#53951

X-original-commit: a733feb8e022084148685599840fe542ee9dafd1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-02 08:11:07 +00:00
Victor Feyens b93b2824d8 [FIX] product: deletion of product category
Missing super call for product category deletion.

closes odoo/odoo#53699

X-original-commit: ebc75df2b3d3f80aebc2fc1d8500fa57c1755bbd
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-06-25 16:18:19 +00:00
William Henrotin f979e3e093 [FIX] product: editing uom on product.product
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

closes odoo/odoo#48714

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-06-18 11:35:38 +00:00
Martin Trigaux 80e97e98ce [IMP] *: use named placeholders in translated message
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.
2020-06-18 13:03:34 +02:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
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.
2020-06-18 13:03:34 +02:00
Nicolas Martinelli 6aebf5d359 [FIX] product: import pricelist
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

closes odoo/odoo#52722

X-original-commit: 11809ee1a12df6b967f03591adb6d11579e3e947
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-06-09 14:38:21 +00:00
Andrea Grazioso (agr-odoo) 95324638c7 [FIX] product: on CoA choose do not create pricelist if already present
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

closes odoo/odoo#52429

X-original-commit: dc0d6af54f56bf6e576013d67cf44b5cd3608351
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-06-08 08:15:06 +00:00
Martin Trigaux a4472b104b [FIX] *: use sudo when accessing ir.property
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
2020-05-26 15:50:11 +02:00
Martin Trigaux 4afa747fa1 [IMP] *: make ir.property methods private
Should only interact with them via python code in a controlled
environment, no direct call with RPC
2020-05-26 15:50:11 +02:00
Jorge Pinna Puissant 8deac894f8 [FIX] product: error when automatic selecting PO vendor
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

closes odoo/odoo#51887

X-original-commit: 0a9f0c5d2c85e80dd5dceaeacf3f04bfc8aa0be1
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-05-26 11:37:55 +00:00
Arnaud Joset b3149d84a0 [IMP] product: pricelist convert boundary dates to datetime
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.

closes odoo/odoo#49030

Taskid: 2221094
Related: odoo/upgrade#1055
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-09 14:52:31 +00:00
Victor Feyens 6fd2d9b898 [FIX] product,website_sale: partner pricelist fallback
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
2020-04-16 11:48:56 +00:00
Victor Feyens d6893ae727 [FIX] product,sale: When multi-currency is enabled, pricelists should also be enabled
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.

closes odoo/odoo#49633

X-original-commit: f862f9650395b02f6a43c57cdf232a309fa6948e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-04-16 08:36:03 +00:00
Raphael Collet 5ab51dee7b [FIX] *: useless old API field parameters 2020-04-07 09:25:08 +00:00
Victor Feyens e576f8eb33 [REM] product: rental field
Old leftover, potentially misleading w.r.t Rental enterprise
application.

closes odoo/odoo#47999

Related: odoo/upgrade#963
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-26 10:27:57 +00:00
Victor Feyens 57e477e8e3 [FIX] product: the pricelist discount_policy should be required 2020-03-26 10:27:57 +00:00