Commit Graph
4879 Commits
Author SHA1 Message Date
Victor Feyens 1682deacc5 [FIX] product: archived product without attributes
Steps to reproduce:
1. Create a product "My Test Product" (no attribute)
2. Create a quotation, select the "My Test Product" product and confirm the sale order
3. Go back to product and add an attribute "Size" with values "L", "XL"
4. Create another quotation, select the ""My Test Product" product => crash

We consider archived combination of attributes as forbidden combination in
the configurator, but when the archived product doesn't have any attribute,
the `archived_combination` was an empty list, which wasn't supported well
by the product configurator logic (client-side).

To quickly fix this issue, we can simply stop sending empty archived combination
(i.e. when the archived product had no attributes).

opw-3410383

closes odoo/odoo#127335

X-original-commit: ca1ac1a115fe06a0a2d2de0fb131a58019f73631
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-07-06 16:23:56 +02:00
Akim Juillerat e6a688815f [FIX] product: Add missing api.depends to _compute_product_price_extra
Field `product.product.lst_price` is not recomputed after changing
`product.template.attribute.value.price_extra`.
Computation of `product.product.lst_price` is not triggered because
`product.product.price_extra` is not recomputed because of the missing
decorator.

closes odoo/odoo#126968

X-original-commit: c7034cb9973532da8011f5fc78d50d859b704500
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-30 15:41:52 +02:00
Rémy Voet (ryv) c5cb357d90 [IMP] *: add dependencies to display_name field
The previous commit introduced an optimization to reduce the number of
queries and fields fetched when we call `name_search`. But it works much
better when the dependencies of `display_name` contain field names used
in the calculation (on the same record/model).

Then, to improve the performance and the cache coherency, add `depends`
and `depends_context` depending on the custom `_compute_display_name`.
Add only the first level of dependencies (never traverse relational
field) because only these have a positive impact on the previous
optimization and the cost is very low (see `modified`).
About `depends_context`, we don't include `lang` because (when `_` is
used by example) it is unlikely to get the same display_name in the same
request with two different lang.

closes odoo/odoo#122085

Related: odoo/documentation#4639
Related: odoo/enterprise#42599
Related: odoo/upgrade#4780
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-06-28 17:41:19 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
Tejas Modi 4d9da8b9eb [IMP] product: rename labels in product list view
In this commit, I have make responsible optional hidden and rename some labels
in product list view.

TaskID - 3150983

Part-of: odoo/odoo#116799
2023-06-20 19:08:56 +02:00
Victor Feyens b31a6aec1c [IMP] product,(event_*)sale: clarify (& deprecate) pricelist context
The whole contextual price of products relies on multiple context keys:
* uom
* pricelist
* quantity
* date

The related logic has already been partly removed/deprecated on products,
but the computation of discounts for events/event booths are still relying
on that logic, though imperfectly.

This commit makes sure this hacky logic (relying on those contextual keys)
is as clear and reliable as possible.
We factorize and harmonize the remaining use cases, with a dedicated constant
and specific methods, making sure:
* currency conversion
* price & discount computations
are coherent, while clearly explaining that it should not be used for
any new feature/logic/code.

We also restrict context updates as much as possible (there won't be
any discount when the pricelist is configured to hide the discount from the customer)

closes odoo/odoo#123848

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-20 15:58:03 +02:00
Ivàn Todorovich 800147ce9f [IMP] product: price computation performance
This commit improves the performance of `_is_applicable_for`, by:

1) Leveraging the `product.category.parent_path` field.
2) Use `applied_on` for the `if` conditions, which is ~100% faster than using
   the many2one fields due to the related record initialization.

These micro-optimizations are important because of the way `_is_applicable_for`
is used.

See: https://github.com/odoo/odoo/blob/0a5d84289/addons/product/models/product_pricelist.py#L169-L193

Which, for demostration purposes, could be simplified to:

```
for product, qty, partner in products_qty_partner:
    for rule in items:
        if not rule._is_applicable_for(product, qty_in_product_uom):
            continue
```

On a database with 470 products, and about the same number of pricelist items,
these optimization result in a ~30% speedup when computing prices for all
products at once. It may be even better depending on how many nested product
categories are used in the database and in the pricelist rules.

closes odoo/odoo#125670

X-original-commit: 3619f77c73092e800aab10f0df09ca5775545da3
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-20 00:24:03 +02:00
momegahed fb00c98a72 [FIX] product: product name overflow is hidden
Steps to reproduce:

1 - activate "Print GS1 Barcodes for Lots & Serial Numbers"
2 - create a product P tracked by lot
3 - print the "Lot/Serial Number (PDF)" from the stock.lot form/list
view

Bug:
contrary to previous versions, the current template doesn't allow the
field to overflow into multiple lines

Fix:
change the css class `o_label_4x12` as it is only used in usecases
where overflow show be allowed

OPW-3336476

closes odoo/odoo#124557

X-original-commit: a5924bfe11cd9324e2ba056e0ac1d449aed730c8
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
2023-06-13 11:27:54 +02:00
Demesmaeker 39a7cdca21 [FIX] product: price computation based on cost
- Standard price (cost price) is there for variants and for product template when there are no
variant, as it has no sense the have one otherwise. Templates with variantS have a cost of 0.
- On the website, product shown are the product templates, but you select and then buy the product
product (variants).
- The pricelist can be set to make a discount based on the cost.

==> If such a pricelist is used, the product templates having more than 1 variant are shown with a
price of 0 until you can select the wanted variant

opw-3232621

closes odoo/odoo#124594

X-original-commit: 561eba8f2adece4c21ea46c1bd050779ea3dc676
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-06-12 12:41:45 +02:00
niyasraphy 98cd8f90ad [IMP] product: hide all products label when no product is linked to tag
When no product is linked to a given tag there is no need to display
a void many2many. Indeed tags are configured mainly from products and
this field is used as a reminder of its usage.

closes odoo/odoo#124342

X-original-commit: 42ab359785fb38c098a524d03535c3aa6cca1173
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-08 21:52:49 +02:00
Valeriya(vchu) 09583d1563 [IMP] product, website_sale: add chatter to pricelist
add chatter to product pricelist to improve collaboration. Track
currency, company, country groups, discount policy and website fields.

task-3316528

closes odoo/odoo#121244

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-08 19:15:17 +02:00
Victor Feyens 4e6db76aba [IMP] product,sale: extract computation of price before discount
So that we can in the future harmonize more easily the discount
computation between sale, point_of_sale, e-commerce, ...

closes odoo/odoo#123849

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-06 13:10:31 +02:00
paso-odoo bafc5610b0 [FIX] product: fix negative rounding method for pricelist
If applied, this commit will solve the issue of the rounding method
AssertionError while configuring any negative value in pricelists.

Steps to produce:
- Open Sale > Products > Pricelists > Create/Open any Pricelist.
- Add a new line in Pricelist Rules.
- Set computation as 'Formula'.
- In the Rounding Method field configure any negative value i.e. -1.56.
- Error will be raised.

Fix this issue by preventing the user from entering the negative value in
Rounding Method.

Sentry-4208813474

closes odoo/odoo#123539

X-original-commit: f7b0eddf3124b15bb223379a513965fa2a017851
Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
2023-06-05 07:04:50 +02:00
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00
Rémy Voet (ryv) 4e0eed85d6 [FIX] core: maximum recursion because of active fields.
In specific situation, unlink can lead to raise a `RecursionError`:
- The model `A` has a many2one `b_id` field toward a model `B`.
This field is set with `ondelete='cascade'`.
- The model `A` has one **store** related field **no-sudo** named
`a_related` (`related='b_id.b_other_field`).
- With `ir.rule` on model `A` with a domain containing `a_related`

You have one record B `b_1` with 20 records A linked to it
(`a_1, ..., a_20`). When you try to unlink `b_1`:

Stack:

  File "...", line 543, in ...
    b_1.unlink()
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 3594, in unlink
    self.env.flush_all()

=> At this point, `a_1, ..., a_20` have already been deleted from the
database because of the 'cascade' deletion. But the ORM doesn't have
any information about this, and `a_related` (for `a_1, ..., a_20`) are
flagged to be recomputed (because it depends on `b_id.b_other_field`)

  File "/home/odoo/Documents/dev/odoo/odoo/api.py", line 732, in flush_all
    self._recompute_all()
  File "/home/odoo/Documents/dev/odoo/odoo/api.py", line 728, in _recompute_all
    self[field.model_name]._recompute_field(field)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 6165, in _recompute_field
    field.recompute(records)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1348, in recompute
    self.compute_value(record)

=> `self.compute_value(recs)` raised a `MissingError` before recalling
`compute_value` with only the first `record` (but others are still in
the prefetch)

  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1368, in compute_value
    records._compute_field_value(self)

=> `a_related` of `record` is removed from to_compute, but only the
first record, not the rest of the records present in the prefetch set.

  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 4194, in _compute_field_value
    fields.determine(field.compute, self)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 100, in determine
    return needle(records, *args)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 689, in _compute_related
    values = [first(value[name]) for value in values]
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 689, in <listcomp>
    values = [first(value[name]) for value in values]
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 5860, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 2772, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1186, in __get__
    recs._fetch_field(self)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 3162, in _fetch_field
    self._read(fnames)

=> `_read` tries to read the first record + others from the prefetch set

  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 3215, in _read
    self.with_context(active_test=False)._flush_search([], order='id')
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 4607, in _flush_search
    self.env[model_name].flush_model(field_names)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 5560, in flush_model
    self._recompute_model(fnames)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 6134, in _recompute_model
    self._recompute_field(field)

=> This is where the recursion starts, record compute will move forward
one by one. But sadly, the stack grows very fast, and with only a few
(already deleted) records to recompute, the issue will be generated.

  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 6165, in _recompute_field
    field.recompute(records)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1348, in recompute
    self.compute_value(record)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1368, in compute_value
    records._compute_field_value(self)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 4194, in _compute_field_value
    fields.determine(field.compute, self)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 100, in determine
    return needle(records, *args)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 689, in _compute_related
    values = [first(value[name]) for value in values]
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 689, in <listcomp>
    values = [first(value[name]) for value in values]
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 5860, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 2772, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/Documents/dev/odoo/odoo/fields.py", line 1186, in __get__
    recs._fetch_field(self)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 3162, in _fetch_field
    self._read(fnames)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 3215, in _read
    self.with_context(active_test=False)._flush_search([], order='id')
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 4607, in _flush_search
    self.env[model_name].flush_model(field_names)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 5560, in flush_model
    self._recompute_model(fnames)
  File "/home/odoo/Documents/dev/odoo/odoo/models.py", line 6134, in _recompute_model
    self._recompute_field(field)

How to fix it:
Move the logic of the MissingError of `_recompute_field` inside the
`recompute` directly.

X-original-commit: c2aac02ac4f8c5cc4a9324134535393bd97338ce
Part-of: odoo/odoo#122147
2023-05-25 16:29:26 +02:00
Louis Wicket (wil) 04189318cc [I18N] *: update master translations
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.

This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).

closes odoo/odoo#121629

Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-22 17:52:07 +02:00
clesgow a9bf6ba57f [FIX] product: display barcode field on new products
Following 459760c, the `barcode` field wouldn't appear on a new product
form until the form was saved at least once.
This was due to the new product not having any variants until it was
saved.
In the case of the product not having any variants, we check if it does
have a least one attribute at the same time (which would be the case for
dynamic attributes).

closes odoo/odoo#121925

X-original-commit: 5f3db6683ab191cb68af4c8d6bb2e86a5b114ee1
Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-05-22 15:09:11 +02:00
Brieuc-brd fa60bac197 [IMP] *: app icons : add viewBox attribute
Prior to this commit, the SVG's viewBox attribute was missing, which
prevented svgs from being scaled.

This commit fixes this issue.

task-3326633
Part of task-3326263

X-original-commit: 30300c373ad1c63a6cf8b035cae0785a09c6933f
Part-of: odoo/odoo#121886
2023-05-22 13:54:08 +02:00
Martin Trigaux 077bbd0b0b [I18N] *: export master source terms
closes odoo/odoo#121563

Related: odoo/enterprise#41140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-17 10:34:00 +02:00
Elisabeth Dickinson 45b9e04db4 [IMP] *: status buttons fix
Part-of: odoo/odoo#116641
2023-05-12 22:59:23 +02:00
Damien Bouvy 1e706d3069 [IMP] web, *: milk adaptations
*: hr_holidays, stock, sale, product, web, sale, purchase, stock,
   website, survey

Adapt some custom control panels (mainly for custom reports) to the
milk controlpanel.

hr_holidays:
Move the buttons to create a new time off or a new allocation to the
"create button" slot and transform it into a dropdown (creating
allocation requests is clearly a secondary action, not a primary one)

stock:
3 lines does not fit, must be on 2 lines

Part-of: odoo/odoo#116641
2023-05-12 22:59:19 +02:00
Elisabeth Dickinson b2ef35a431 [IMP] *: replace .bg-color by .text-bg-color on ribbons
Also remove unnecessary CSS on ribbons.

Part-of: odoo/odoo#116641
2023-05-12 22:59:16 +02:00
Brieuc-brdandElisabeth Dickinson 21d87a3da5 [REF] *: milk graphical assets
- apps icons
- base: replace demo avatars Mitchell, Marc and Joel
- mail: replace odoobot avatar

Part-of: odoo/odoo#116641
Co-authored-by: Elisabeth Dickinson <edi@odoo.com>
2023-05-12 22:59:14 +02:00
Preksha Chouhan 19aef6396c [FIX] product: prevent getting value of domain from other method
While creating a new product in product category with barcode value in inventory
module, `_check_barcode_uniqueness` method is called. In which variable 'domain'
is passed, and getting wrong value.

Steps to Produce:-
1) Go to Inventory then configuration
2) Click on 'Product Categories' under products
3) Click/Create Product Category
4) Click stat button 'product'
5) Create a product
6) Then add barcode value
7) Click on Save
8) Trace-back will be generated

Reason:-

While creating new product from product category when user add the barcode value
in product form, the '_check_barcode_uniqueness' method is called. In this
method the value of 'domain' is getting updated by reference from variable
'domain' from method '_search' present in the same model.
This results in a traceback with the message

'Invalid field product.packaging.categ_id'.

Applying these changes will resolve this issue.

sentry - 4073963761

closes odoo/odoo#121072

X-original-commit: ce9889e314ae696773ce040f662569e281abe700
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2023-05-11 10:40:58 +02:00
clesgow 459760c422 [FIX] product: hide barcode when with dynamic variants
Steps to reproduce:
- Inventory -> Configuration -> [Products] Attributes
- Create new Attribute with 'Variants Creation Mode' set to
'Dynamically' with a few values
- Inventory -> Products -> Products -> New
- Set the new dynamic attribute to the product and save
- If you try to set a barcode, the field will empty itself at each save

When a product is created with 'Dynamic' attributes, the variants will
only be created once the combination of attributes is used. So initially
there is no variant, hence nowhere to set the barcode.
So we avoid letting the attribute being set when there is still no
variant.

Part of task-3218314

Part-of: odoo/odoo#119381
2023-05-09 21:04:03 +02:00
Julien Mougenot 10dc896c1e [REF] *: Adapt views to Owl DateTimePicker
This commit follows the addition of the OWL date picker and intends to:

- update views calling daterange widgets to use the new syntax (and
remove the end date field from the view in most cases);

- change the remaining components extending the previous DatePicker and
DateTimePicker components.

Part of task 3121497

Part-of: odoo/odoo#112171
2023-05-05 13:52:22 +02:00
Damhaut Florian (flda) cee32aa16e [FIX] product: Improved error message for pav deletion
What are the steps to reproduce your issue?
- Create a product with more than one attribute.
- Let say color White, black and purple
- Create a 'draft' invoice for the purple product variant
- Remove the 'purple' attribute value from the product
- It will archive that variant (because the account.move linked to it)
- Try to delete the attribute value from menu Sales > Cofinfiguration > Attribute

What is the current behavior that you observe?
- technical error message

What would be your expected behavior in this case?
- non-technical message for end-users

Solution :
- Change both message to tell user he cannot delete the value if the value has been referenced somewhere else.
opw-2623583

missing forward-port of db1e52f0234f73e1bda22a411baba7b1f0994d5a

closes odoo/odoo#120495

X-original-commit: 0c8c43d50a574d73d9d5ac925eb16faf730a76ba
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-05-04 12:15:21 +02:00
Alexandre Kühn 9f115fce17 [FIX] mail,*: fix style in 1st column of activity view
Task-3290752

closes odoo/odoo#120189

X-original-commit: a97c86a2b962f56955e3c16b7ad99cabb0b13b9c
Related: odoo/enterprise#40564
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-05-03 17:24:58 +02:00
Rémy Voet (ryv) 302c7baa87 [REM] core,*: remove name_get_uid parameter from _name_search.
`name_get_uid` is unused (at least since v14) and the
documentation about it, is wrong.

closes odoo/odoo#117819

Related: odoo/enterprise#39483
Signed-off-by: Rémy Voet <ryv@odoo.com>
2023-04-28 16:04:27 +02:00
Demesmaeker 4c701ab1fc [FIX] product: only activate pricelists when enabling pricelists
Following 83c52575d0 we activated or created pricelists as soon as a
currency was activated/created/deleted, for every company that might already have another
pricelist setup done, which was quite confusing.

With this fix, we ensure this will only happen:
- at company creation
- when enabling the pricelist feature
- when enabling the multi-currency setting (only the first time, unless the pricelists were
disabled manually afterward)

closes odoo/odoo#120039

X-original-commit: 4c0146d939e40e9433794802388cf06147e716f2
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-04-28 09:53:12 +02:00
niyasraphy 1e7127c92e [FIX] product: traceback on deleting category
before this commit, when deleting a product
category from a db where expense category
is already deleted before this commit [1]
is raising exception

after this commit, exception wont be shown
in existing db where expense category is
deleted.

1 https://github.com/odoo/odoo/commit/09e4b2fb586ac83adb984672e027ce6dd62affb2

closes odoo/odoo#119754

X-original-commit: 20b5518110b233ba3b59158a8362db04b9a89aad
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-04-27 10:13:10 +02:00
Julien Carion (juca) eaacaf122d [IMP] web, *: Add autoresize hooks
This commit adds two autoresize hooks for text inputs and textareas to
make it adapt their size (width for text inputs, height for textareas)
depending on their content.
The commit therefore solves the issue of several form view task titles
being restricted to 1 line while it can be annoying if the title is too
long. The autoresizeTextarea feature was moved from TextField to the
autoresizeTextarea hook and the autoresizeInput feature was moved from
the AutoresizeInput mail component to the autoresizeInput hook.
The TextField component has a new option for disabling linebreaks.

task-3138826

closes odoo/odoo#117355

Related: odoo/enterprise#39493
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 14:07:15 +02:00
Pierre Masereel 44f5881511 [FIX] product: give correct currency when computing based pricelist
When your pricelist item price is based on an other prcicelist in
another currency, the wrong currency is given to the function
_get_product_price. we sould give the currency of the base_pricelist
instead of the target one.

Here is a example:
We have a priclist in INR based on a pricelist in USD. And the company
currency is euro.

When we go for the first time in '_compute_base_price', where we'll call
_get_product_price to get the price from the base pricelist (the $ one)

We get as src_currency the USD and target the INR. Since we are calling
_get_product_price with INR as currency, when _get_product_price will
call _compute_base_price, we'll get EUR as src_currency and INR as
target.

This will lead to apply on the EU price (the one on the product) the
rate of EUR->INR then apply over it USD -> INR. Instead of EUR -> USD
and then USD -> INR

closes odoo/odoo#119505

X-original-commit: 8ace9942368688dc1183133f451ea788a03e0f14
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Masereel Pierre <pim@odoo.com>
2023-04-25 06:39:49 +02:00
Valentin Chevalier 17fc488e08 [IMP] product,sale(_product_configurator): refactor in OWL
The product configurator dialog was still in legacy code as it was not
required for the migration of the views to OWL. Now that we're moving
forward with the removal of other parts of the legacy code, this dialog
had to be converted as well.

Some parts of the logic have now been rewritten in OWL, getting a better
share of the logic between the server and the client.

The product configurator in e-commerce still uses the old implementation
and will be refactored in another task.

task-3056806

closes odoo/odoo#106511

Related: odoo/enterprise#39525
Related: odoo/upgrade#4550
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2023-04-24 08:38:11 +02:00
Rémy Voet (ryv) 234db70d86 [IMP] *: Use the new API of _read_group for backend use
Part-of: odoo/odoo#110737
2023-04-19 21:58:27 +02:00
Adesh JolheandManisha Tulsiyani 23cf931808 [IMP] hr_,sale_(timesheet, project),purchase: generic improvements for the project
Purpose of the commit is to do the generic improvements for project.

So in this commit did the following changes:
 - adding a label 'last update' to the stat button in project form view.
 - indicate 'my project' in the tab instead of 'project sharing view in portal' in project sharing.
 - set the first non-folded stage of the project as default on newly created tasks.
 - remove user confirming the SO as the default project manager.
 - hide fields service_tracking, service_upsell_threshold if sale_ok is false.
 - set purchase_method to purchase by default if product is of service type.
 - remove the : next to the totals labels and decrease the font-size for values of 'total hours'
   and 'remaining hours' in timesheets notebook in project task form view.

task-2897867

closes odoo/odoo#96548

Related: odoo/enterprise#29774
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Co-authored-by: Manisha Tulsiyani <matu@odoo.com>
2023-04-04 11:01:59 +02:00
Adrien Widart (awt) 03ab3a4352 [FIX] product{,_expiry},stock: print labels of GS1 lot
When printing the label of a lot, the datamatrix may overlap the
product/lot name and will overlap the 'best before' date.

To reproduce the issue:
1. In Settings:
   - Barcode Nomenclature: GS1
   - Enable "Print GS1 barcodes for lots [...]"
2. Create a product P:
   - Name: a long name
   - Type: Storable
   - Barcode: 1111111111113
   - Tracking: USN
   - Expiration Date: True
   - Dates > Expiration Date: 1 days
3. Process a receipt with 1 x P
   - The serial number should be long
4. Print Labels
   - To Print: Lot/SN Labels
   - (Confirm)
   - Format: 4 x 12

Error: the datamatrix overlaps the product name, the serial number,
and the 'best before' date

For the product/lot names, we can only improve the situation. If the
user define a too long name, the issue will still happen and nothing
can be done

For the dates, we can shorten the labels. That way, the dates will
always be correctly displayed

OPW-3193836

closes odoo/odoo#116541

X-original-commit: f175897cefd1db149e94a50882d9e7babfc6293d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2023-03-24 19:21:46 +01:00
Louis Wicket (wil) 0c53d28133 [IMP] *: remove "French spacing"
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#116167

Related: odoo/enterprise#38542
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-03-24 12:50:13 +01:00
Martin Trigaux 1be5eae8ef [I18N] *: remove nl_BE files
They dates from < 2027 and are quite outdated. Favour the nl
translation instead.
n_BE is not on Transifex so it was not possible to correct bad
translations.

closes odoo/odoo#115845

X-original-commit: d04c8b7e484db8306d858c891a7a2b11885fdcd9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-03-20 16:51:30 +01:00
niyasraphy 87fdb9aca2 [FIX] product: fix typo in subtract
fix typo in substract

substract -> subtract

closes odoo/odoo#115615

X-original-commit: 0c9cb441312959164be9ec939c88ddd456f4d6c6
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2023-03-17 10:38:07 +01:00
Tiffany Chang (tic) b40c72da7e [FIX] product: print all product labels when multiple tracked products
Steps to reproduce:
- Create 2 SN tracked products
- Create a receipt of the 2 products, with a demand qty of 2+ of
  each product
- Create the SNs of the incoming products + validate picking
- Print Labels > 2x7 or 4x12 (with or without price) > confirm

Expected result:
2+ labels per product printed, 1 for each SN

Actual result:
Only 1st label of the 2nd product is printed, all of labels of the 1st
product are printed

Issue:
The "quantity" in:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L155-L156

is structured as:
  {product, [(barcode_to_print, qty_to_print), ...], ...}
or in this case:
  {product2: [(product2_sn1, 1), (product2_sn2, 1), ...], product1: [(product1_sn1, 1), (product1_sn2, 1), ...]}

So there was a miscounting where:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L162-L164

Would set the current_quantity to 0 (since only 1 per SN barcode)

And:
https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L155-L156

would register the not (current_quantity=0) as true and quantity={product1: (...),...}
as true => move onto the next product rather than checking if there
are any more (barcode, qty) tuples to print, i.e. never reach:

https://github.com/odoo/odoo/blob/da30b41022c4f05b3abfdc3e64519d8438d25745/addons/product/report/product_product_templates.xml#L166-L167

for product2 and therefore never reach its (sn,qty) labels beyond it's
first one.

Note that this issue does not occur for the dymo or zpl labels because
they follow different, less complicated templates

opw-3199095

closes odoo/odoo#114972

X-original-commit: 54e587b272a52972a0f615a29005dcb6fdb6992f
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-03-14 15:52:16 +01:00
Louis Wicket (wil) 9afe7c74c9 [IMP] *: remove "French spacing" 👺
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#114533

Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-14 15:52:10 +01:00
Achraf 9154c2192d [FIX] product: Allow users to edit pricelist report
Steps:
- Open studio
- Go to 'Reports' tab
- Select 'Pricelist' report
- Error message

opw-3207593

closes odoo/odoo#115089

X-original-commit: abf3c725b17f16ec5b57ddbcf1639d60194b8bea
Signed-off-by: Achraf <abz@odoo.com>
2023-03-14 08:52:43 +01:00
Mathieu (mano) d8958a45ba [FIX] web: checkboxes design & consistency
The main objective of this commit is to make checkboxes consistent
and fix their spacing issues.

Prior to these changes, the checkboxes on the `product_view` were
too close to their neighboring option labels, making it difficult to
know which checkbox to tick.

The new changes fixes inconsistencies in general such as undesired
hovering effects and the cursor behaviors on disabled inputs.

This commit also removes the margin in the checkbox template since the
padding from the checkbox wrapper compensates for the spacing between
the checkboxes and their respective labels.

Tweaking the selector in `settings_form_view.scss` to ignore boolean
field inputs allows us to get rid of max-width and margin overrides
introduced in commit b90059e936.

Most checkboxes were already falling under their labels on mobile, but
this change impacted those that were not. To address this issue, we
decided to consistently change the position of the checkboxes left to
their labels for small devices in form view.
This required slight adjustments to the `form_group.xml` template.

Still in form_view, for some of the specific checkboxes such as
`o_checkbox_optional_field` the changes in `form_controller.scss` are
made to mimic the new behavior for mobile sized screen.

However, if they are using the form_group template, their behavior
is unchanged at the moment.

Finally, even if these changes makes it better for most of them, some
checkboxes in `settings` still require some minor adjustments and will
be addressed in task-3113372.

task-3094083

closes odoo/odoo#114612

X-original-commit: ddb7574f97f11e69f0304c8bd8d55c2c53ab53fd
Related: odoo/enterprise#37887
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-03-10 12:31:11 +01:00
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
Raphael Collet 6ef3772847 [IMP] *: optimize code with search_fetch() and fetch()
closes odoo/odoo#112126

Related: odoo/enterprise#36782
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-03-05 15:12:57 +01:00
Raphael Collet c161177cb7 [IMP] core: _name_search() now takes explicit order and limit parameters
This API is much more sensible for making subqueries.  Specifically, one
can generate a subquery without the clauses LIMIT and ORDER BY.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 136eb34f07 [IMP] core: _search() no longer uses a default order
This simplifies the use of subqueries by avoiding some costly default
order on the model or the idiotic order='id'.  Method _flush_search()
has been adapted accordingly.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 7e6cff5479 [IMP] core: search() and _search() no longer have parameter count
The parameter in search() is redundant with method search_count(), and
was making the calls less readable.

The method _search() is aimed at always returning a Query object.  The
method can therefore never return an integer, hence the removal of the
parameter.  This does not actually remove any functionality from the
method; counting result is simply given by using it differently.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Maruan Aguerdouh (magm) a80033415a [FIX] product: fix product dymo labels printing long titles diplayed
Steps to reproduce:

- Go to a product with a long name
- Inside the product page go to "print labels"
- Choose "Dymo" as label type and print.
(For barcode you need to add a barcode number to the product.)

Issue:

The product name is not displayed correctly on the label because
is too long.

Solution:

Removing the fixed height int he label seem to have good behavior with
sizing the text.

opw-3120807

closes odoo/odoo#114097

X-original-commit: 37b49c6ced839cd82b77819845a52ba2cf8c4ab8
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-03-02 11:23:47 +01:00