Commit Graph
161175 Commits
Author SHA1 Message Date
Touati Djamel (otd) 2a5e079ef7 [FIX] mrp: unbuild a manufacturing order with a tracked product
Steps to reproduce the bug:
- Create a storable product “P1”:
    - Tracked by SN
    - BoM:
        - Component:  1 unit of “C1”

- Create a Mo to produce one unit of “P1”:
    - Confirm the MO
    - Set a new serial number “SN1” and qty done for “C1”
    - Mark as done
    - Click on “unbuild” button

Problem:
An user error is triggered: “This lot ‘SN1’ is incompatible with this
product ‘C1’

When you click on the "Unbuild" button, the `lot_id` of the finished
product is added in the context with the key `'default_lot_id'`:
https://github.com/odoo/odoo/blob/dd60647ce41547ecd00bbde45ddf564a7ada91c7/addons/mrp/models/mrp_production.py#L1977
Therefore, when creating the `stock.move.line` for the component,
even if the “lot_id” is not in the vals, we will get the “lot_id” from the context:

https://github.com/odoo/odoo/blob/d04a5b5c8c7dc13e4e911a29d1944e90587e2883/odoo/models.py#L4136

https://github.com/odoo/odoo/blob/d04a5b5c8c7dc13e4e911a29d1944e90587e2883/odoo/models.py#L1961

Then, we do a field validation via a constraint, but as the product "C1"
is not compatible with the product in lot "P1", an error is triggered:

https://github.com/odoo/odoo/blob/b9334c53b84228c00ab100ffd28620b3c923c4e6/addons/stock/models/stock_move_line.py#L94-L95

opw-3284525

closes odoo/odoo#120981

X-original-commit: 2ee59a523e12b79c1338467bcf7577a1c9b63d11
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 21:18:08 +02:00
Alvaro Fuentes 6f6fb10511 [FIX] mail: allow to create a manual blacklist model
Issue 1: before this patch it was impossible to create a manual model
marked as "Is blacklist". The reason is that a blacklist model
implicitly need an `email` field, but such field is impossible to add in
a manual model: the field must start with `x_`.

Solution: append `x_` to the implicit email field. Note, in principle
the user gets an error if `x_email` is not present. Solved by adding the
field when creating the custom model. Ideally we should show some hint
in the interface to make it more user friendly. That is out of the scope
of this patch.

Issue 2: when we have a manual model that is mail blacklist it's
impossible to create its model class. We get an error because the MRO is
not correct. The reason is that we are adding `mail.thread.blacklist`
_after_ `mail.thread` in the `_inherit` list. That list is used to
generated the `__bases__` of the model class[1]. According to Python's
MRO rules[2], since `mail.thread.blacklist` appears after `mail.thread`
as parents of the custom model class this order _must_ be respected. But
`mail.thread` must appear _before_ `mail.thread.blacklist` because the
latter inherits from the former. This is a contradiction and the MRO
algorithm cannot succeed. To put it in a simple example:
```py
class A: pass
class B(A): pass
 # This fails:
 # class C(A, B): pass
 # The right order is:
class C(B, A): pass
 # Equivalent to:
class D(B): pass
 # C and D have the same MRO linearization excluding themselves
assert D.mro()[1:] == C.mro()[1:]
```
Example traceback:
```
Traceback (most recent call last):
  File "/home/odoo/src/odoo/14.0/odoo/service/server.py", line 1201, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 464, in load_modules
    registry.setup_models(cr)
  File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 263, in setup_models
    env['ir.model']._add_manual_models()
  File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 430, in _add_manual_models
    Model = model_class._build_model(self.pool, cr)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 585, in _build_model
    ModelClass.__bases__ = tuple(bases)
TypeError: Cannot create a consistent method resolution
order (MRO) for bases BaseModel, mail.thread, mail.thread.blacklist, base
```

Solution: check if a model inherits from `mail.thread.blacklist` first.
There is no need to add `mail.thread` if inheriting
`mail.thread.blacklist` because the inheritance is already implicit.

This issue was observed during upgrades. We convert custom models and
fields into manual to allow upgrading without custom code. This causes
issues because the MRO error appears when a custom model inherits mail
blacklist.

[1]: https://github.com/odoo/odoo/blob/02f820fb0eaddbb3a4269a0967184c8aaf52c363/odoo/models.py#L585
[2]: https://www.python.org/download/releases/2.3/mro/

closes odoo/odoo#120977

X-original-commit: 8848bb57ff7f086d801178c582d7f6371eeb8479
Signed-off-by: Christophe Simonis <chs@odoo.com>
Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
2023-05-10 21:18:03 +02:00
prye-odoo c4dc4735c4 [FIX] delivery: prevent trace back while partner has no zip
In delivery address, `country name` and in shipping method, `country name`
will be same and no zip in delivery address.  While creating new sale order
along with product and clicking on "Add shipping",  error will be generated.

Steps to Reproduce
-Install `sale_management' and 'delivery' modules
-Go to the settings and enable the 'Customer Address'.
-Go to the settings and enable 'Shipping Methods' and configure it.
-Select a shipping method and  go to the 'Destination Availability' tab and
 set to the 'Countries' and set to 'Zip Prefixes'.
-Create a new customer and add the delivery address of the customer in
 res.partner.
-The delivery address and shipping method of the 'Countries" or 'Country'
 name should be the same.
-Set the  'Zip Prefixes'
-Set the delivery address of zip code null.
-Create a new quotation and add to the customer and delivery address
-Add to the product in the sale order line.
-Click on the 'Add Shipping' or 'Update Shipping Cost' button.

A trace back will be generated.

Applying this commit will resolve this issue.

sentry-4147077852

closes odoo/odoo#120968

X-original-commit: 60d5c7d5668da542e251d7d6fb8774043cfddea8
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 20:15:38 +02:00
oco-odoo 8dae77e6df [FIX] account: properly handle negative repartition lines in _compute_is_refund
Partial revert of b15116179e71040ffa01bb35161e32b16aac477d .
This fix introduced a new bug: when creating an write-off with taxes from the bank reconciliation widget, signs were all inverted in the tax report, because that commit was forcing the values of tax_tax_invert in a wrong way.

The proper fix is to fix the computation of the is_refund field in community, so that negative repartition lines are taken into account ("debit" is a refund for a "sales" tax only for positive repartition lines, for example).

Community part is in https://github.com/odoo/odoo/pull/120152

closes odoo/odoo#120924

X-original-commit: 67e789074cb00b9db6e3fd83ef92ed712b28edfb
Related: odoo/enterprise#40856
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2023-05-10 20:15:30 +02:00
oco-odoo b96dc99f03 [FIX] account: tax computation: when forcing the tags on caba taxes, also force the account
Cash basis taxes use a distinct transition account on their tax lines; the tax account set on the repartition lines is only used when the payment is received, on the cash basis move.

In enterprise, the bank reconciliation widget allows setting a tax on the manual write-off done for a statement line. When doing so, we expect the tax to behave just like on an invoice. For cash basis taxes, this means the "final" tax account has to be used instead of the transition one ; it wasn't the case.

OPW 3255511

X-original-commit: 991fa46081296c3560bd7ca195996693a81a46b8
Part-of: odoo/odoo#120924
2023-05-10 20:15:29 +02:00
David Monnom (moda) 55ec4f75bc [FIX] point_of_sale,pos_restaurant: fix order btn
Before this commit, the Order button wasn't displayed due to an
incorrect comparison with a `LazyTranslatedString` object
(`this.props.actionName`). This commit resolves the issue by ensuring
proper comparison of `this.props.actionType` with the string "payment".

Step to reproduce:
- create a pos_config (bar)
- active a printer on it
- open the PoS bar
- select a table and add some product
- The orderline are green but there's not order button.

opw-3300533

closes odoo/odoo#120846

X-original-commit: a04f8ebdfb724c74531f38927a655e6aae86bc26
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-05-10 20:15:26 +02:00
Maximilien (malb) c395f3984e [IMP] l10n_kz: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allows for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116381

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 20:15:23 +02:00
Maximilien (malb) a4f0bc6243 [IMP] l10n_za: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allows for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116379

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:15:20 +02:00
Maximilien (malb) b2173e245f [IMP] l10n_ve: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allows for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116377

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 20:15:17 +02:00
Maximilien (malb) 1ed4d4b84f [IMP] l10n_th: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allows for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116374

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 20:15:14 +02:00
Maximilien (malb) 947aa048f3 [IMP] l10n_nz: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allows for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116372

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:15:12 +02:00
Maximilien (malb) b5a5890cff [IMP] l10n_il: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116365

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:15:07 +02:00
Maximilien (malb) 6ef72b57bf [IMP] l10n_hn: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116362

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 20:15:04 +02:00
Maximilien (malb) 7fd476ef29 [IMP] l10n_et: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#116360

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:15:02 +02:00
Maximilien (malb) 730918a240 [IMP] l10n_ke: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#115521

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 20:14:59 +02:00
Maximilien (malb) 5bb972b986 [IMP] l10n_lt: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#115487

Task-id: 3052677
Related: odoo/enterprise#38285
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:14:56 +02:00
Maximilien (malb) b3ec5a5f09 [IMP] l10n_fi: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#115478

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:14:51 +02:00
Maximilien (malb) b4ba1aaf03 [IMP] l10n_ro: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#115272

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 20:14:48 +02:00
FrancoisGe 21d3b73c2f [FIX] web: change action from a dirty form view
Before this commit, if we try to change the action from a form view
a new record in an x2m and the new action fails to mount, then the new
record in the x2m will always have a virtual id even if it has already
been saved on the server side.

Why:
When you try to exit the form view, the form view will save the record
and not read the record because you leave the view (in the beforeLeave).
But in our case, we fail to mount the new action and so we will stay on
the form view without it doing a read to know the id of the record added
in the x2m. So the view thinks that the x2m still contains a virtual record.

Solution:
Going back to action should rebuild the whole compound. To cause this,
we'll restore the last controller.

How to reproduce:
- Going to a form view with an x2m field and a widget performing a doAction
- Add a line to the x2m
- Click on the widget to change the action
- New action fails to mount, it returns an error
- Close the error dialog
- Edit another field
- Save the form view

Before this commit:
    The new line in the x2m is duplicated.

After this commit:
    The new line in the x2m is unique

opw-3193765

closes odoo/odoo#120765

X-original-commit: 72f68e2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-05-10 19:17:17 +02:00
Martin Maes 596f6bab3d [FIX] mrp: MO planned when all WO are planned
This pr fixes a bug where a validation error occurs in the timesheet
wizard.
Indeed, when the user enter manually a start or end date in a workorder,
the whole MO becomes "plan".
The problem here was that if the user opens the wizard of another
workorder (on the same MO) that has no start/ end date set, and then if
he saves (no matter if he changed something), it will trigger a
validation error because the start and end date of the workorder is
required in that view if the MO is planned.

closes odoo/odoo#120386

X-original-commit: c9728858aa46e6cb1a3d39cbc8da8e175007e456
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-05-10 19:17:15 +02:00
Martin Maes 266fa04aa1 [FIX] mrp: Timer not working
On the manufacturing order, modifying the timer value does save it's value
in db but does not actualise it in the front.

The "rerun" condition is already checked in MrpTimer and does not need
to be checked in MrpTimerField

closes odoo/odoo#120385

X-original-commit: a8cfa1d26ef84aa6690d3cfa8b98b6cecf4f27d9
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-05-10 19:17:12 +02:00
ravb-odoo 571c08256f [IMP] project: remove assign_me button and clock icon from task form view
Description of the issue/feature this PR addresses:
Before this commit assign_me button and clock icon from start button is shown in
project task , project sharing as well as helpdesk ticket.

This commit remove assign_me buttom and clock icon from start button in project
task, project sharing and helpdesk ticket.

task-3292056

closes odoo/odoo#120378

Related: odoo/enterprise#40630
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-05-10 19:17:07 +02:00
Aurélien Warnon 728ceccca1 [IMP] base: introduce "_is_portal" on res.users
This commit introduces a "_is_portal" method complementary to the existing
"_is_internal" and "_is_public".

The goal is to ease usage through the code base and be able to easily
distinguish our 3 main use cases: public, portal and internal users.

Task-3056280

closes odoo/odoo#120827

Related: odoo/enterprise#38575
Related: odoo/upgrade#4575
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-10 19:16:57 +02:00
Renaud Thiry 3bbabf5618 [IMP] event: use overridable getters for ics file
Currently the summary and description in event ics file generation
are set directly, with a condition in case the event is an appointment.

We make these two ics 'fields' use a getter so that it can be
overriden inside appointment instead.

In addition we remove the special formater for 'online events'
as it is only used for appointments, which does not use it anymore
as of this task

task-3232952

closes odoo/odoo#116211

Related: odoo/enterprise#38570
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-10 19:16:52 +02:00
Maximilien (malb) c30bb08eba [IMP] l10n_hu: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#115268

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 19:16:49 +02:00
Maximilien (malb) cd5765c170 [IMP] l10n_au: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#114838

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 19:16:47 +02:00
Maximilien (malb) b2f651e4de [IMP] l10n_br: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#114755

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 18:16:24 +02:00
Maximilien (malb) 441856cb30 [IMP] l10n_eg: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#114700

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 18:16:21 +02:00
Maximilien (malb) f78f28e837 [IMP] l10n_sa: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#114696

Task-id: 3052677
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-05-10 18:16:19 +02:00
Maximilien (malb) 1d8d3a45f3 [IMP] l10n_it: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes name so that it's more clear for the users

closes odoo/odoo#114694

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 18:16:16 +02:00
Maximilien (malb) 505691e5de [IMP] l10n_ch: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes names so that it's more clear for users

closes odoo/odoo#114673

Task-id: 3052677
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-05-10 18:16:14 +02:00
Maximilien (malb) 86a0bafda8 [IMP] l10n_de: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we have changed the Taxes names so that it's more clear for users

closes odoo/odoo#114653

Task-id: 3052677
Related: odoo/enterprise#37914
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 18:16:08 +02:00
Maximilien (malb) 13dbc79065 [IMP] l10n_mx: taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the taxes names so that it's more clear for users

closes odoo/odoo#114571

Task-id: 3052677
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-05-10 18:16:06 +02:00
Maximilien (malb) 0a4f831c6f [IMP] account: generic taxes
We want to invigorate a Tax Name Taxonomy so that tax names are as codified as possible. This allow for a better display on Invoice Description, and allowed us to implement a smart name_search.

In this PR, we change the tax name of generic taxes

closes odoo/odoo#114537

Task-id: 3052677
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-10 18:16:03 +02:00
Xavier Bol (xbo) 5b2d1d846a [FIX] project: display the current stage when the state is changed
Before this commit, when the user changes the state, the followers
receive a notification about this change. Since the label of the
state is no longer customize by stage, the followers cannot know
in which stage the task is before clicking on the link to go to
the task form view. And so, if one of those followers has to
check the task in a specific, he has to click on the link in
the notification to know in which stage the task is.

This commit fixes the issue by adding the curent stage in the
notification to inform the user who received the notification
in which stage the task is when the state has been changed.

task-3284597

closes odoo/odoo#120959

X-original-commit: d78c79d9a9f8ac108251c57c732cfb5b71b53fd5
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-05-10 16:37:11 +02:00
Benoit Socias 86c392d393 [FIX] website: apply page search on most specific pages only
Since [1] when the fuzzy search was introduced on website pages, the
filtering on most specific pages only happens at the end of the search
operation. Because of this, the search happens on pages that would be
excluded anyway, the limit might be wrongly applied and the count might
be wrong.

This commit makes the page search begin by keeping only the most
specific pages, then performing the actual search within those pages.

Steps to reproduce:
- Install `website` only and drop a search snippet.
- Search "ax".

=> No results found, but the "All results" link is displayed.

[1]: https://github.com/odoo/odoo/commit/7559626c54e34b41e1549e28276a650accec6986

task-3203794

closes odoo/odoo#120950

X-original-commit: 9725a14be22ad0f20bb6591054b60d91663ca88f
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-05-10 16:37:05 +02:00
Tiffany Chang (tic) 8f4b86bf82 [FIX] stock: allow "Print" of MRP reception report
During the OWL refactoring of the reception report, the "Print" button
was hardcoded to only work for pickings. Unfortunately this means the
button did NOT work when the report was opened for a MO.

This is due to the report printing being dependent on the report's
context values which can either be `default_picking_ids` or
`default_production_ids` (and this is by design to avoid additional file
extensions to handle both cases).

When this button was used in the previous legacy_web_report's
client_action, the entire action's context + data used to be passed as
part of the Print action:

https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/stock/static/src/legacy_web_report/client_action.js#L109-L119

The `data` and `context` is then stringified and added into the
reportURL:

https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/static/src/webclient/actions/action_service.js#L1042-L1050

But passing of the data isn't necessary in this case, and most of the
context's content is not needed since the backend is still receiving +
apply the current user's context thanks to the action_service:

https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/static/src/webclient/actions/action_service.js#L1079

always providing it to the backend

https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/controllers/report.py#L87

Therefore, to avoid an extra long report URL of all of the report's
data/context, this fix has been designed to capture only the necessary
context value and manually build the print URL accordingly.

Noticed during task: 3046178

closes odoo/odoo#120935

X-original-commit: 5d66b73cddce1aae2c52f0a0ec8f9885be67b7ae
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 16:36:59 +02:00
Tiffany Chang (tic) 5dbd6e69b4 [FIX] stock: disable reception "Assign All" when nothing to assign
In the case of draft pickings/MOs, the reception_report_main
component's "Assign All" button was NOT disabled, which could result
in an IndexError if the button was pushed. Note that this issue does not
occur for the "Assign All" button within a table because the button is
correctly not shown at all when there are no assignable lines within it.

Noticed during task: 3046178

X-original-commit: 403d1ba5839d6073ee6321e77863f928336158ba
Part-of: odoo/odoo#120935
2023-05-10 16:36:59 +02:00
Tiffany Chang (tic) 0a74e47af9 [FIX] stock: "Print Labels" non-int qtys in reception report
Steps to reproduce:
- activate Reception Report in settings
- create outgoing picking for a product (qty > qty in stock)
- create an incoming picking for the same product with a non-int qty
- confirm the incoming picking + click on "Allocation" smartbutton
- assign product to outgoing picking + click "Print Labels" (either at
  top of report or within the table of outgoing moves)

Expected result:
Labels and created + printed

Actual result:
ValueError because int() is called on a non-int value within the label
template

Note that the the `onClickPrint` within the reception_report_line.js
already correctly did the Math.ceil rounding on the qty

Noticed during task: 3046178

X-original-commit: 69c557a5c0b407333be45cd7434448fc36de899e
Part-of: odoo/odoo#120935
2023-05-10 16:36:59 +02:00
Bruno Boi 2ddc7348f2 [FIX] web: optional viewMode in x2m field
Before this commit, when having a x2many field invisible in a view, and displaying
it anyway in studio, there was a crash because some variable was undefined.

This originated from commit f22961a, which did not account
for the fact that viewMode is an optional props.

After this commit, the util function used by the x2m field and where the
crash occur has been refactored.
Moreover, the x2m field template has also been slightly refactored.

closes odoo/odoo#120918

Taskid: 3305808
Related: odoo/enterprise#40852
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-05-10 16:36:51 +02:00
roen-odoo a25d20ee3e [FIX] pos_sale: correctly update move qty when settling a pos order
Current behavior:
When settling a pos order containing 2 different product, the qty of the
2 products would be modified even if you only deliver one of them
through the pos order.

Steps to reproduce:
- Create 2 product A and B
- Create a sale order with 1 product A and 1 product B
- Open a PoS session, and settle the order you just created
- Deliver only 1 product A
- Close the PoS session
- Go the the sale order delivery, you will see that the qty are not
  correct

opw-3227053

closes odoo/odoo#120898

X-original-commit: c1f905111060fff6e6bdfae1849e1a633a88ae02
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-05-10 16:36:49 +02:00
luvi 9575aba9ca [IMP] mail, *: add hover title to the activity button
*: project, web

This commit adds the title and aria-label attributes to the activity
button. This makes the hover display the summary or an explaination
about the button, especially when there is no text displayed next to
the button (in Kanban view).

In the state selection field, a title has been added when hovering
the state in kanban, allowing to see the current value. The project
task state selection has also been adapted to have that title attribute
set on the toggler.

task-3207639

closes odoo/odoo#120871

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-05-10 16:36:45 +02:00
Xavier-Do a6f8de2cf2 [IMP] base: speedup routing map
When generating the routing map, `Rule.add` will call
`Rule._compile_builder` twice, representing almost one third of the
routing map generation time. `_compile_builder` is actually stored
in `Rule._build` and `Rule._build_unknown` for latter use, in the
`Rule.build` method.

The `Rule.build` method is used to transform a rule, lets say
`/forum/<model("forum.forum"):forum>` in `/forum/basics-of-gardening-2`

Even if a deeper investigation could be interresting, it looks like it
is only used for `is_frontend_multilang` routes and `_enumerate_pages`,
used in the `sitemap` and `search_pages`.

The proposed solution si to make this part lazy, in order to call
_compile_builder on demand, once per rule. This will speedup the initial
routing map generation and postpone the heavy work when we need it,
only for the part we need most of the time.

On a database with all modules installed, generation of the routing map:
Before: ~600 ms
After: ~200 ms

An alternative implementation was also overriding the Rule.build method
instead of having a callable LazyCompiledBuilder, this implementation
was choosen since it is less dependant off the werkzeug implementation.

closes odoo/odoo#120542

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-05-10 15:19:47 +02:00
Xavier-Do 7fda050abd [IMP] core: imcrease re.MAXCACHE
`re` is using an internal cache for regexes with a default size of 512
This is correct for small apps running on small infrastructure
but as a simple example, the routing map will compile ~1100 regex in a
row. This means that generating two routing map in a row don't benefit
from this cache at all. It looks reasonnable to increase this limit
globally for odoo.

This is visible when generating two routing map in a row.

After this change:

Generating routing map for key None
Routing map web generated in 0.194s
Generating routing map for key 1
Routing map website1 generated in 0.196s

After this change:

Generating routing map for key None
Routing map web generated in 0.200s
Generating routing map for key 1
Routing map website1 generated in 0.062s

Part-of: odoo/odoo#120542
2023-05-10 15:19:47 +02:00
Mahdi cheikh rouhou (macr) 63d54abe4b [FIX] account : correct button title invoice email manually
Sending invoice in emails to customers now display View Journal Entry in
v16.2 instead of view Invoice.
Steps to reproduce the error :
1- Install accounting
2- Go to accounting/customers/invoices
3- Create an invoice and send it by email to the customer
4- View The email on mailhog

The reason of the error was becayse we didn't provide model_descirption
to the function of sending the email, so it will take the one by default
whch is Journal Entry.

opw-3289880

closes odoo/odoo#120480

X-original-commit: 21cab7ffa6a71a67b64d3a7e7a62a6599127343d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
2023-05-10 15:19:43 +02:00
Adrien Guilliams (adgu) a253eb65fb [IMP] pos_sale: Possibility to apply fixed amount on downpayment
Until now, it was not possible to apply fixed amount on downpayment.
Users were forced to compute the percentage to apply on a
downpayment on the side when the wanted to apply a fixed downpayment.
This is no more the case.

This commit also changes a bit the NumberPopup in the PoS.
The NumberPopup can now have a subtitle, a suffix to its input (usefull
for symbols like currency or percentage) and in the case of a percentage,
can have an indication under the confirm button about how much the
percentage means in other unit (like a percentage of a price).

The commit also removes the previous downpayment lines on the new
order line in the ProductScreen as they were not showing
useful information.

closes odoo/odoo#118594

Task-id: 2836904
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-10 15:19:37 +02:00
yhu-odoo 1eb2e7c814 [IMP] {,mrp_,stock_}account, *: add default stock accounts and production cost
account

1. We introduced a new Production Cost account that can be set on
locations with Production type. When products move into/out of a
production location. The account entry will be post on this account
instead of previous Stock in/out account.

2. On the accounting setting page, we can now set the default values for
all stock accounts. Users can also disable automatically accounting for
stock there.

Task-3046333

closes odoo/odoo#113973

Related: odoo/enterprise#37653
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 15:19:32 +02:00
paso-odoo bffa4377ff [FIX] account: fix the issue of unsupported operand in payment terms
If applied, this commit will solve the issue of the payment terms 'Example Date'
issue while we keep that blank and try to save the Payment Term.

Steps to produce:
- Open any Payment Term.
- Remove the example date.
- Add a line in Due Terms and click on save button.

Added a default value while the example date is not getting.

sentry - 4065889321
see - https://tinyurl.com/2caru9dd

closes odoo/odoo#120234

X-original-commit: 980aa78c0d9228cba665066d08ea7cd2f83e0097
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
2023-05-10 13:21:52 +02:00
Adrien Schoffeniels ece5f26c10 [FIX] web: use copy of fields when using a kanban model
Since commit [1], properties can be displayed in list views. However,
when switching from a kanban view showing the properties to a list view
that should be showing the same properties, these are not shown.

This happens because the model in the kanban controller currently uses a
reference of the fields. When loading the list view, the properties are
thus already in the fields, and they are skipped when trying to apply
them.

This commit solves the issue by working with a copy of the fields in the
kanban controller, as the list controller does since commit [1].

[1]: https://github.com/odoo/odoo/commit/70619d0e6a23f955265c99aa6b25924357e46223

Task-3284508

closes odoo/odoo#120128

X-original-commit: 4ccb018ef1d301d2e52fea05b4949d77049be3ca
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-10 13:21:49 +02:00
Julien Carion (juca) 787c6ff32a [FIX] web: Handle access rights in readonly fields
This commit adapts the behavior of all readonly fields
to take access rights into account when deciding whether the field
should be editable or not.
Steps to reproduce: give minimal access rights to Marc Demo user,
log in as Marc Demo, go to crm, make sure no one is assigned as
salesperson in a record and check if the add user icon is available.
Also applies to every kanban view fields (like priority,
many2many_avatar, ...)

opw-3265086

closes odoo/odoo#119818

Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-05-10 13:21:47 +02:00