Commit Graph
160607 Commits
Author SHA1 Message Date
Xavier-Do ae000f07e1 [FIX] loading: check ir_module existence
When instantiating a new registry, this piece of code is called

    try:
        odoo.modules.load_modules(registry, force_demo, status, update_module)
    except Exception:
        odoo.modules.reset_modules_state(db_name)
        raise

For a new database, load_modules will create the table ir_module_module
in the same transaction as everything else. This means that if any error
occurs, the transaction is rollbacked and the table ir_module may not
exist.

`reset_modules_state` will try to access ir_module_module table leading
to another error and an unecessary and confusing error log.

2023-04-26 12:05:34,823 616958 ERROR ? odoo.sql_db: bad query: UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')
ERROR: relation "ir_module_module" does not exist
LINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN...
               ^

    2023-04-26 12:05:34,823 616958 ERROR ? odoo.modules.registry: Failed to load registry
    2023-04-26 12:05:34,824 616958 CRITICAL ? odoo.service.server: Failed to initialize database `test-base`.
    Traceback (most recent call last):
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 90, in new
        odoo.modules.load_modules(registry, force_demo, status, update_module)
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 386, in load_modules
        raise Exception('An error')
    Exception: An error

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 1302, in preload_registries
        registry = Registry.new(dbname, update_module=update_module)
    File "<decorator-gen-14>", line 2, in new
    File "/home/xdo/osrc/master/odoo/odoo/tools/func.py", line 87, in locked
        return func(inst, *args, **kwargs)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 92, in new
        odoo.modules.reset_modules_state(db_name)
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 622, in reset_modules_state
        cr.execute(
    File "/home/xdo/osrc/master/odoo/odoo/sql_db.py", line 311, in execute
        res = self._obj.execute(query, params)
    psycopg2.errors.UndefinedTable: relation "ir_module_module" does not exist
    LINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN...

With this commit, we check the ir_module_module table existance avoiding
an exception and revealing the minimal traceback.

2023-04-26 12:11:21,218 617810 INFO ? odoo.modules.loading: skipping reset_modules_state, ir_module_module table does not exists
2023-04-26 12:11:21,218 617810 ERROR ? odoo.modules.registry: Failed to load registry
2023-04-26 12:11:21,218 617810 CRITICAL ? odoo.service.server: Failed to initialize database `test-base`.
Traceback (most recent call last):
  File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 1302, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "<decorator-gen-14>", line 2, in new
  File "/home/xdo/osrc/master/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
  File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 90, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 386, in load_modules
    raise Exception('An error')

closes odoo/odoo#119820

Exception: An error
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-04-27 06:10:18 +02:00
Guillaume (gdi) f845d5365d [FIX] website: ignore the scheme for page indexing
When a user sets up a domain name on Odoo, we consider that he has a
configuration that makes only one site visible. To do this, the standard
solution is to have the following redirections:
- http://example.com => https://example.com
- https://www.example.com => https://example.com
- http://www.example.com => https://example.com

It happens that users enter something other than https://example.com in
the setting to define the domain names of their websites. If this is the
case, [this other commit] would cause an error:
- The page indexing bot went to https://example.com but since this was
not what was set in the settings, a no index was added so that the page
was not referenced.
- As soon as the indexing bot went to http://example.com,
https://www.example.com or http://www.example.com, it was redirected to
https://example.com.

As a result, the client ended up with a non-indexed website.
The purpose of [this other commit] was just to prevent double indexation
of websites (the https://example.odoo.com and the https://example.com).

After this commit, the pages will be indexed even if the scheme is not
the same as the one specified in the settings. The same goes for the
www. which is also ignored.

Note that this can have an undesirable effect if the client has a bad
configuration and has several sites exposed (https://example.com and
https://www.example.com for example). If this is the case, he will end
up with a site that is indexed twice.

[this other commit]: https://github.com/odoo/odoo/commit/3739d74afe824554b37b1b52ed32ada33692c01a

task-3110888

closes odoo/odoo#119819

X-original-commit: c75b35b24c868a821089cafd990c15357cf737e7
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-27 06:10:16 +02:00
thsh-odoo b8f847e03b [FIX] crm: improve layout of conversion modal
When converting a lead to an opportunity and merging with existing
opportunities, the list view showing opportunities is very tiny.

This is caused by the field not having the correct colspan, as its label is
hidden with the "nolabel" attribute.

This commit fixes it by assigning a colpan of 2.

Task-3179173

closes odoo/odoo#119790

X-original-commit: 6a003a12c92d215f8123538473eeb23a36e9ec7e
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-27 06:10:07 +02:00
Didier (did) 8a55e1b4df [IMP] mail: populate res.partner admin with 100 mail.message
Insert 100 messages on the admin res.partner for testing purposes.

closes odoo/odoo#119789

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-27 06:10:05 +02:00
Sébastien Theys ad58e0fdd8 [REF] mail: move discuss.channel code to its own folder (controllers)
This commit focuses on removing all references to discuss.channel from
controllers of mail module.

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#119523

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-27 06:10:02 +02:00
Michael (mcm)andMathieu Duckerts-Antoine a79765ed33 [IMP] web: support of properties in domain selector
Before this commit, users could not query properties
with the domain selector. Now, all the properties are
listed when selecting a properties field.

task id: 3283212

closes odoo/odoo#115270

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-27 04:31:00 +02:00
Alexandre Kühn 187ad14840 [REF] bus: prettify bus files
closes odoo/odoo#119530

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 02:44:42 +02:00
Adrien Guilliams (adgu) 72e9034f9f [IMP] pos, l10n_fr_pos_cert: change price_manually_set behaviour
The price_manually_set variable was used to largely, we fix it
by adding a price_automatically_set variable. The price_manually_set
is now used when changing the price through the numpad, whereas
price_manually_set is used to indicate that the price is not
the price set in the database.

closes odoo/odoo#119362

X-original-commit: aa4f346d27aa28c23f8ee02fe73b892a1f5ef2dc
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-04-27 02:44:40 +02:00
det 244b8502d2 [IMP] account: helper to generate invoices via send&print
https://github.com/odoo/odoo/commit/955091e707df1206ccda8314f1f182e2a37a8362
changed the way we want to generate invoices.

This commit provides an helper method to be used in others modules to
properly generate and send invoices following the send&print flow.

task-id:3253019

closes odoo/odoo#119759

X-original-commit: 8dbf4c8390d9d0e4e2050b0ca318fcb2ec9dc3b0
Related: odoo/enterprise#40330
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-04-27 00:52:20 +02:00
qdp-odoo d563481306 [FIX] purchase: vendor bill autocomplete check for duplicated lines
Failing use case:
Create a vendor bill and use the auto-complete field to select a purchase order multiple times.
The purchase order gets added to the vendor bill multiple times, this doesn't happen in V15 and was never intended.

The reason is simply that the code was checking on self.line_ids which get only populated after the record is saved and its invoice_line_ids are synchronized. Before that, only the field invoice_line_ids is filled witht new_ids.

opw - 3196149

closes odoo/odoo#119758

X-original-commit: 29d5862d447dd369432b345e43d5875d3b2a4474
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-27 00:52:17 +02:00
Loan (LSE) a71bfd5306 [FIX] website: delete visitors by batch in cron
Before this commit:
The scheduled action will repeatedly time out if the number of visitors
to remove is too high. In the case of the client, he has ~ 4 millions
inactive visitors to remove. This might happen after a bot spam attack.

After this commit:
The visitors are removed by batch of 1000, reducing the number of old
visitors with time

opw-3256349

closes odoo/odoo#119757

X-original-commit: b69917ec0e508f8354d831525c5c48ee79b5967a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-27 00:52:15 +02:00
Benjamin Vray 2c5096823b [FIX] website: fix animations on rtl pages
Steps to reproduce the issue:

- Open a website page in edit mode.
- Drag and drop several snippets onto the page.
- Add a 'Fade In Right' animation to an element on the page.
- Exit edit mode.
- Change the website language to Arabic to display the scrollbar on the
left.
- Test the animation.
- Bug: the scrolling (using the mouse wheel) becomes stuck or very slow
during the animation.

The issue only occurs with Chrome or Edge browsers and seems to be a
browser display issue. It happens only when animated elements overflow
to the left.

This commit fixes the problem by adding an 'overflow: hidden' to the
main element during RTL page animations. This is not the best solution
because the animated elements become non-visible outside the main
element, creating a difference, for example, with the 'Framed' page
layout.

opw-3260399

closes odoo/odoo#119766

X-original-commit: 69184ea84c78de33d47f1e952530cceb568c937b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-04-26 23:01:15 +02:00
Jinjiu Liu 25be2d15c2 [FIX] web_editor: don’t delete table cell when its left cell has content
Reproduction:
1. Create a 1 by 3 table, input something in the first cell
2. Go to the second cell, hit backspace
3. The second cell is deleted and the third cell is moved to the second
cell

Note: in 15, we don’t have the table selector to remove a row of the
table but that is another issue

Fix: when we try to delete the table cell and the offset is 0, nothing
should be done. Also added a test to make sure the cell is unchanged
when we try to delete in an empty cell which has a cell with content
at the left. Also we skip the rejoin block step if there's a table cell
element is invoivled because the cells are not deleted and rejoining
them is not needed

Task-3171904

closes odoo/odoo#119765

X-original-commit: f62275ddb3967ff769cddcde070b4688d36dc4dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-04-26 23:01:12 +02:00
odoo 36ce1611ed [FIX] project: fix line break between the partner name & city issue
Description of the issue/feature this PR addresses:
In kanban view of field service, there is a break line between partner name and
partner city.

Current behavior before PR:
partner name and partner city are in different line.

Desired behavior after PR is merged:
partner name and partner city are in same line.

Fix:
in kanban view of project module, partner city is inherit from the industry_fsm
module. Style is added in both the fields(partner name and city), due to which
line break is occurs. so style is removed from both the fields and added to the
parent <span> tag of the fields. <t> tag is converted into <span> tag so that
style can be applied.

task-3252521

closes odoo/odoo#119760

X-original-commit: f35b534e6e86d3b5848f3e9cb6aa4d6e0b0c1854
Related: odoo/enterprise#40331
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-26 23:01:07 +02:00
Julien Castiaux 44d60e3e7e [IMP] requirements: drop support for py3.7
All major systems (debian stable, ubuntu lts, windows) support py3.8
and all dependencies used by Odoo come with wheels for that version.
Most developers at Odoo SA uses 3.8 already and runbot is using ubuntu
jammy (which comes with py3.10) to test the current 16.0/master.

closes odoo/odoo#119492

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-04-26 19:49:10 +02:00
Sébastien Theys b1772094b1 [REF] mail: move discuss.channel code to its own folder (models)
This commit focuses on removing all references to discuss.channel from
code located in /models of mail module.

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#119413

Signed-off-by: Debondt Didier (did) <did@odoo.com>
2023-04-26 19:49:08 +02:00
Chong Wang (cwg) b92415023d [IMP] core: prefetch all translations
a new context `prefetch_langs=True` allows ORM to prefetch all translations of
translated fields while fetching.

For example
The activated languages are 'fr_FR' and 'nl_NL'
In the database the value is '{"en_US": "English", "fr_FR": "French"}'::jsonb
after fetch with `prefetch_langs=True` the raw cache value will become
{'en_US': 'English', 'fr_FR': 'French', 'nl_NL': 'English'}

closes odoo/odoo#116947

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-04-26 18:12:08 +02:00
Rodrigo 9e12878cc2 [CLA] signature for RodrigoBM
closes odoo/odoo#119756

X-original-commit: 025507b0cd860b2c05298f1bf3a3fb83bba7fd6e
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-26 17:06:36 +02:00
Rodrigo ae4c249882 [IMP] account: improve tax name search
This commit allows the exact search of a text that is searched between dashes.
Examples:   0EUM      => VAT 0% EU M.
            21M       => 21% M , 21% EU M, 21% M.Cocont and 21% EX M.
            21 M"    => 21% M and 21% M.Cocont.
            21" M"co  => 21% M.Cocont.

X-original-commit: ad2682c513c82052539cf99a54994b035b2afe6d
Part-of: odoo/odoo#119756
2023-04-26 17:06:35 +02:00
Yolann Sabaux d7ce6d9136 [FIX] purchase: prevent unnecesary change of currency
Steps to reproduce:
- put the currency of the bill to eur
- change the partner with a partner with no purchase currency set

Issue:
The bill is re-set to usd

Note:
addendum to https://github.com/odoo/odoo/pull/116852

opw-3233527

closes odoo/odoo#119753

X-original-commit: 51ff9c6026b8f9079aba7c9e26891f62c782761d
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2023-04-26 17:06:32 +02:00
Yolann Sabaux 57542c6ee3 [FIX] purchase: enable correct currency on onchange partner_id
Steps to reproduce:
- company currency = USD
- set a partner P with a `property_purchase_currency_id` in EUR
- create a bill with Azure partner and set an bill line
- change to partner P
issue -> the currency of the line has not been change
- change to Azure
issue -> no change about the currency

Cause:
- We update the move.currency_id but not the line_ids.currency_id
- after setting Partner P, we try to set a partner that no `property_purchase_currency_id`, we do not enter in the condition

opw-3233527

X-original-commit: 213e22c63f6259e2e69193b7d6a7022d8b6eab20
Part-of: odoo/odoo#119753
2023-04-26 17:06:31 +02:00
Achraf 20e4bd9bb3 [FIX] google_calendar: Change logger type from error to exception
In sentry we receive like 2k syncing issue from google_calendar.

This commit converts `_logger.error` to `_logger.warning` because we don't
need an erro for that

sentry-4121123364
https://online.sentry.io/issues/4121123364

closes odoo/odoo#119742

X-original-commit: e797712561113f098edc1346995cecd7e96ad362
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2023-04-26 17:06:28 +02:00
Stanislas Gueniffey 4b4ea80787 [IMP] web_editor: improve focus() for LinkDialog
Previously, LinkDialog always focused on the first editable input field.

This commit introduces a new option in the LinkDialog constructor,
`focusField`, that allows to designate a specific field to focus on.

This option is now used to focus on the second editable input field when
the first one is already filled (for example, from the user selection).

task-3224551

closes odoo/odoo#119699

X-original-commit: 70649465c35736ae5a8b918817bfd0f598600852
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-04-26 17:06:25 +02:00
Adrien Widart (awt) e9528d8741 [FIX] stock_landed_costs: set AML's account on its creation
To reproduce the issue:
1. create a product category with inventory valuation set as Manual
2. create a landed cost product using above category
3. enable anglo saxon accounting in accounting settings
4. create a vendor bill with this product and click save

Error: An error is displayed because of a missing account

When creating the AML, `_compute_account_id` tries to find the
appropriate account. However, for a landed cost, it always use the
the stock accounts, even if they are not defined. We should rather
recycle `/stock_account._compute_account_id` which already handle
such a situation.

OPW-3251714

closes odoo/odoo#119564

X-original-commit: 9416be3cbe630ed693a0285f203e1de9f45acc7a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2023-04-26 17:06:13 +02:00
Adrien Widart (awt) 4bccbb175f [FIX] {stock_,}account, stock_landed_costs: set categories properties
When a product category valuation is set to `real_time`, we use the
stock accounts. However, in the code, to know which account we
should use, we do: "use stock accounts if defined, else use basic
ones" (the best should be "use stock accounts if `real_time`" but
this refactoring task will be done in master). So, here, we need to
ensure that stock accounts are not defined when the valuation is manual.

This is the case when installing `stock_account` module: the
valuations will be set to manual, so we need to force the stock
accounts to `False`. Same when creating a new company, we also need to
ensure that the stock accounts are not defined. This explains the
changes in `_post_load_data`

About changes in `_check_valuation_accouts`, the explanation is in
the method body: the defined values directly depends on the value of
`property_valuation`

Note about test modification: for the tests in `stock_landed_costs`
module, we set the categ to auto so the stock accounts are defined.
Otherwise, when validating the landed costs, it will lead to an error
https://github.com/odoo/odoo/blob/9cd316f038dc95051814ede9474f8f15f7d165df/addons/stock_landed_costs/models/stock_landed_cost.py#L396-L397

OPW-2746384

X-original-commit: 2780c37cfdb8560ac7c725fd27f4fe272f1d3072
Part-of: odoo/odoo#119564
2023-04-26 17:06:13 +02:00
Jeremy Kersten f854a0d4ea [FIX] website_crm_partner_assign: fix url in email Forward to partner
Bug exists since a long time ago, but because url is empty, nobody
reported it before today since the consequence is just to don't have
any link.

On our prod we have some automation/customization that make this bug
visible.

opw-3257270

closes odoo/odoo#119554

X-original-commit: 5a5ee4a73ede391877bfef51a0aafcefa682e856
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-04-26 17:06:09 +02:00
tsm-odoo 2ba5818fac [FIX] bus: fix non-deterministic bus tests
Since [1], some bus tests were failing in a non-deterministic
way. This PR fixes the issue.

[1]: https://github.com/odoo/odoo/pull/119525
Fixes runbot errors: 20755, 20756, 19933.

closes odoo/odoo#119807

X-original-commit: c52670c9e91c369410422afacfbd9080d432e8bd
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-04-26 15:06:48 +02:00
Denis Ledoux 15e2aebcf4 [FIX] snailmail: accurate error message when no access to the attachment
This revision follows
- odoo/odoo@5e81850ea6
- odoo/enterprise@e484b4da0c
2023-04-26 13:53:54 +02:00
Olivier Dony c4ec6a9eaf [FIX] l10n_ae: fix overlapping text under invoice amounts
As of https://github.com/odoo/odoo/pull/107714, the invoice layout
structure changed, and the hook on a `clearfix` class now ends up
targetting a different `div` inside the layout.

This causes the exhange rate info for non-AED invoices to be crammed
under the invoice totals where it does not fit at all, so everything
overlaps to the point of being unreadable.

Fix: target a more reliable element based on the newly introduced id
`right-elements`.

closes odoo/odoo#119769

X-original-commit: 74055b8e65acbbdfb48a876412974b48cfdc6e8a
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-04-26 12:44:42 +02:00
Habib (ayh) 65044ad205 [FIX] account: bank balance confusion
Due to performance issues, the computation of the balance in GL was changed (odoo/odoo#103697)
Since it is computed in `_get_journal_dashboard_bank_running_balance` as the last statement balance (balance_end_real) + transactions (account.bank.statement.line since the last statement), we rename the label on the journal dashboard to "Running Balance".
Also, fix the order clause of the "Last Statement" balance as it has a problem when there are 2 statements on the same day.

OPW-3265511

closes odoo/odoo#119764

X-original-commit: 383f52ac2b75a839469323a1e71b4c2ea76f8393
Related: odoo/enterprise#40334
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
2023-04-26 11:25:53 +02:00
Maximilien (malb) 9bb7c573eb [FIX] account: table on invoice misplaced
In 16.2, we made a task (https://www.odoo
.com/web#id=3097097&cids=1&menu_id=4720&action=333&active_id=967&model=project
.task&view_type=form) to improve the layout of invoice. But the l10n_ec
localisation was wrongly impacted due to a xpath. This commit correct that by
adding an id on payment terms and the enterprise pr will change the xpath.

opw-3097097

closes odoo/odoo#119672

X-original-commit: 579c9f615db06f0581c3b6802cb695fafc8682cb
Related: odoo/enterprise#40291
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-04-26 09:36:47 +02:00
Denis Ledoux aee3af0abe [FIX] core: access to ir.attachment without res_model/res_id
This revision restores the behavior of 16.0 regarding
the access to attachments with no `res_model`/`res_id`
set.

It was changed unexpectedly during the refactoring
of `read`/`fetch`.

Basically, the below used to raise an AccessError in 16.0:

Create an attachment without res_model/res_id and access it
as another user
```py
attachment = self.env['ir.attachment'].create({'name': 'foo'})
attachment.invalidate_recordset()
attachment.with_user(self.env.ref('base.user_demo')).datas
```

While it no longer raises the AccessError in saas-16.2

The reason is that the override of `_read` calling
`check` has been removed in saas-16.2:
https://github.com/odoo/odoo/commit/e962860c6f0d8ec9e50bb376e1faab5c7bc69374#diff-ab3dadc37163820f8e863edb1dd216f8b0e7ccf19cf4e2052577a7bae7ddd7e8L606-L608

in favor to do the check in `_search`:

https://github.com/odoo/odoo/commit/ae31aebf095392d8c91f49ac279e1949997dc245

But there is a difference of behavior between the checks in `check` and `_search`
regarding attachments without `res_model`/`res_id`:

https://github.com/odoo/odoo-security/blob/bc538f6944461a642bac0f757ec96d7f8cc14c9a/odoo/addons/base/models/ir_attachment.py#L454-L465

https://github.com/odoo/odoo-security/blob/bc538f6944461a642bac0f757ec96d7f8cc14c9a/odoo/addons/base/models/ir_attachment.py#L566-L573

The goal of this revision is to have an unified behavior regarding the treatment
of attachments without `res_model`/`res_id` in both `check` and `_search`.

closes odoo/odoo#119768

X-original-commit: 82c36285b897b72a956da0585ebd62f4c2d33784
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2023-04-26 07:53:03 +02:00
Camille Spiritus 67669db8d5 [FIX] account/l10n_ch: QR-Bill - remove border outside of printing zone
In Switzerland, it is mandatory, when a QR bill is printed, to use a line to separate both the QR part from the rest of the page and, within the QR zone, the receipt from the payment part.

This was done using dotted lines on the bill.

However, while generating the PDF caused no problem, the snailmail provider can't print the bottom, far left and far right borders since those are outside of the printing zone.

After further research it does however seem that those are not mandatory, unlike the two separations aforementioned.

Removed those to allow for snailmail printing.

opw-3223714

closes odoo/odoo#119728

X-original-commit: 1326ad2a21e2d9aade1ad2ff4444e595c1caabad
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-04-25 22:15:54 +02:00
Hansun (hale) 11986ede8e [FIX] sale_timesheet: revenue aggregated wrongly
1. Install [Timesheet], [Sales]
2. Settings > Time Encoding > Encoding Method > Days/Half-days
+ Make sure the company has more than 1 employee from Employee app
3. On Products, edit Service product type to have:
- invoicing policy: based on timesheets
- create on order: project
- uom: Days
4. On Sales app, create a SO and add a service with a price
- automatically a project will be created
5. On Timesheet app, create a project linked to the SOL
6. Create a task and set timesheet 1 day
7. Go to [Timesheet] > [Reporting] > [By Employee]
8. Group by SOL and dipslay the MEASURE 'Timesheet Revenues'

Issue: Revenue is multipled by the unit measure of day in hours

Impacted version: 16-master
opw-3255928

closes odoo/odoo#119707

X-original-commit: 8898452d1dd5b4ae8332fd369b0cb6211ee62fc4
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-04-25 21:11:16 +02:00
divy-odoo e4cca1ff10 [FIX] website: keep language selector flag size ratio
There was an issue before this commit where some flags (basically all
the ones which are not tribands) would appear "broken".
This is the case for the China one where the symbol on the flag would be
squashed.
Using `object-fit` css property will keep the original flag ratio.

task-2929438

closes odoo/odoo#119683

X-original-commit: 5d6559218926a4c2f055bd55f113c7bfc83cd5b8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-25 21:11:08 +02:00
MerlinGuillaume ab429a4444 [FIX] web: keep datepicker open on mobile devices
On some mobile devices (eg Samsung Galaxy S22), the datepicker
immediately closes when trying to apply a custom date filter

Steps to reproduce:
1. Install Sales
2. Open Sales
3. Click on the search icon then on the filter icon
4. Click on 'Filters' and add a custom filter on field creation date
5. Click on one of the dates
6. The datepicker opens and then closes immediately

Solution:
Do not hide the datepicker when a scroll is made on mobile devices

Problem:
When opening the datepicker, the keyboard would show up, scrolling the
view which triggers the closing of the datepicker

opw-3166801

closes odoo/odoo#119682

X-original-commit: bd6ed025fae33ff3b0444d34142e1577a457b77f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-04-25 21:11:05 +02:00
Pierre Masereel a19d96da7d [FIX] website: migrate popover in BS5
Since we've changed Bootstrap version from 4 to 5 the way to create a
popover has changed.

So we adapt it to the new way to declare popovers in the website form

closes odoo/odoo#119680

X-original-commit: 0cff1dc2967cafeb8964ed0802c309d3bb7f7525
Signed-off-by: Masereel Pierre <pim@odoo.com>
2023-04-25 21:11:03 +02:00
Vincent Larcin e7afea2434 [IMP] project,hr_timesheet: improve project and task search views
This commit brings a few improvements to the project.project and project.task
search views.

Task-3264820

closes odoo/odoo#118515

Related: odoo/enterprise#39766
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-25 21:10:39 +02:00
Michael (mcm) b45974773a [REF] *: remove dom_ready module
This commit removes the module "web.dom_ready" and
adapts the modules that imported it.
This module was used to wait for the content to be
loaded to manipulate the dom after that.
The goal is to remove async modules and simplify the
module loader in the future.

task id: 3265979

closes odoo/odoo#119158

Related: odoo/enterprise#40051
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 20:06:43 +02:00
Kevin Baptiste 9122884698 [IMP] hr(_contract): remove non needed information from public employee
The employment type and first contract date were made available on the
public employee, however those fields but don't need to be publicly
available.

odoo/upgrade#4539
task-3252610

closes odoo/odoo#118333

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-04-25 18:25:50 +02:00
roen-odoo 45be644319 [FIX] point_of_sale: Add sales description to pos invoice
Current behavior:
If you add a sale description to a product, it will not be added to the
invoice created from the PoS.

Steps to reproduce:
- Add a sale description to a product
- Create a PoS order with this product
- Create an invoice from the PoS order
- The sale description is not added to the invoice

opw-3221481

closes odoo/odoo#119516

X-original-commit: 37538c876f30fb1b3a9368f12a16edb1806777f8
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-04-25 17:23:14 +02:00
Benjamin Vray 872e2f20ef [FIX] website: fix editor message missing in empty wrap
Steps to reproduce the bug:

- Open an empty page (e.g. the home page) in Website edit mode.
- The "DRAG BUILDING BLOCKS HERE" message is missing in the '#wrap'.

Since the commit [1], we have made modifications to the
'%o-editor-messages' mixin, which is used on the '#wrap' element, to
hide the editor message if the element is not the only child. However,
another commit [2] was added afterwards, which introduced a new div
called '#o_shared_blocks' next to the '#wrap' element. As a result, the
'#wrap' element is no longer the only child, and the message is never
displayed again.

To fix this, we took the rule out of the mixin to only use it where we
need to (for '.oe_drop_zone').

[1]: https://github.com/odoo/odoo/commit/6ee778fdbcd92dbefd08c8551ea654d352ad0dc0
[2]: https://github.com/odoo/odoo/commit/6007264afb83dcfed1693d72179cb156ff2254b6

task-3270409

closes odoo/odoo#119621

X-original-commit: d4b7a9e877804cd6bbdc0d15b1ab1c03561a4a86
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-25 15:20:57 +02:00
Mathieu Duckerts-Antoine 959b57bcce [FIX] web: domain selector: parse -1
Before this commit, a domain of the form "[(.., .., -1)]" would be
incorrectly represented in the domain selector as .., .., undefined.
The root cause was that py_js view the sub expression -1 as the
application of the operation - to 1 and thus create an AST of type 6 for
it. The domain selector did not expect to get such an AST but did not
crash either. Here we make it extract the intended value from the AST
for -1. More complex expressions like 3-1 are still not supported.

closes odoo/odoo#119620

X-original-commit: f9604da60c6650ad46aafe08e9fad118654a149b
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-04-25 15:20:54 +02:00
Alexandre Kühn cdf456ea00 [FIX] mail: properly handle discuss active_id 'discuss.channel_'
Before this commit, when loading discuss app with
`active_id=discuss.channel_1` in URL, the discuss app did not
auto-select the conversation.

This happens because the code did not parse model and id part of
"discuss.channel_1": it split into `discuss.chann` and `l_1`,
instead of `discuss.channel` and `1`. This comes from splitting
the same way as legacy `mail.channel`, starts with 13 characters,
although there are now 16 characters in `discuss.channel`.

This commit fixes the issue by simplify the way the active thread
of discuss is deduced from active_id.

closes odoo/odoo#119559

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-25 15:20:49 +02:00
Victor Feyens f4ea6d3226 [FIX] *: strict api for main orm methods
Enforce strict types for returned values for
* create
* write
* unlink
* default_get

to make those methods more consistent and reliable.
Also make sure they can be called with empty self/values,
i.e. that they follow the same behavior as the base methods
defined in the main orm Model.

closes odoo/odoo#116809

Related: odoo/enterprise#38880
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-25 15:20:43 +02:00
Louis Wicket (wil) 03aada713a [IMP] mail: hold shift to select emoji without closing the picker
Clicking on an emoji from the emoji picker while holding down the Shift
key now prevents the emoji picker from closing, allowing users to easily
select multiple emoji in one go.

Task-3288704.

closes odoo/odoo#119598

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-25 14:07:38 +02:00
Xavier ALT badc8fb90d [FIX] hr_timesheet: fix KeyError a timesheet on task wo/ analytic set
To reproduce on runbot:
- go a to an existing task
- clear the "Analytic account" field
- add a timesheet line
- save

It then crash with the following error:

```
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/data/build/odoo/odoo/http.py", line 1698, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/data/build/odoo/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/data/build/odoo/odoo/http.py", line 1725, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/data/build/odoo/odoo/http.py", line 1922, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/data/build/odoo/addons/website/models/ir_http.py", line 234, in _dispatch
    response = super()._dispatch(endpoint)
  File "/data/build/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/data/build/odoo/odoo/http.py", line 715, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/data/build/odoo/addons/web/controllers/dataset.py", line 28, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/data/build/odoo/addons/web/controllers/dataset.py", line 24, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/data/build/odoo/odoo/api.py", line 461, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/data/build/odoo/odoo/api.py", line 448, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/data/build/enterprise/industry_fsm_stock/models/project_task.py", line 101, in write
    result = super().write(vals)
  File "/data/build/enterprise/helpdesk_fsm/models/project_task.py", line 45, in write
    res = super().write(vals)
  File "/data/build/odoo/addons/project_sms/models/project_task.py", line 25, in write
    res = super().write(vals)
  File "/data/build/enterprise/project_enterprise/models/project_task.py", line 288, in write
    res = super().write(vals)
  File "/data/build/odoo/addons/hr_timesheet/models/project.py", line 385, in write
    res = super(Task, self).write(values)
  File "/data/build/odoo/addons/project/models/project.py", line 2050, in write
    result = super().write(vals)
  File "/data/build/odoo/addons/mail/models/mail_activity_mixin.py", line 241, in write
    return super(MailActivityMixin, self).write(vals)
  File "/data/build/odoo/addons/rating/models/rating_mixin.py", line 101, in write
    result = super(RatingMixin, self).write(values)
  File "/data/build/odoo/addons/mail/models/mail_thread.py", line 311, in write
    result = super(MailThread, self).write(values)
  File "/data/build/odoo/odoo/models.py", line 3813, in write
    field.write(self, value)
  File "/data/build/odoo/odoo/fields.py", line 4168, in write
    self.write_batch([(records, value)])
  File "/data/build/odoo/odoo/fields.py", line 4189, in write_batch
    self.write_real(records_commands_list, create)
  File "/data/build/odoo/odoo/fields.py", line 4369, in write_real
    flush()
  File "/data/build/odoo/odoo/fields.py", line 4325, in flush
    comodel.create(to_create)
  File "<decorator-gen-368>", line 2, in create
  File "/data/build/odoo/odoo/api.py", line 410, in _model_create_multi
    return create(self, arg)
  File "/data/build/odoo/addons/hr_timesheet/models/hr_timesheet.py", line 142, in create
    vals_list = self._timesheet_preprocess(vals_list)
  File "/data/build/enterprise/helpdesk_timesheet/models/analytic.py", line 61, in _timesheet_preprocess
    return super(AccountAnalyticLine, self)._timesheet_preprocess(vals_list)
  File "/data/build/odoo/addons/hr_timesheet/models/hr_timesheet.py", line 331, in _timesheet_preprocess
    account = account_per_id[account_id]
KeyError: False

The above server error caused the following client error:
null
```

closes odoo/odoo#119597

X-original-commit: b86fa6a72cc5eaeb0245cf2092eefde09226aa12
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-25 14:07:35 +02:00
Didier (did) 95b6b91fca [IMP] mail: better typing for composer and use Ref typedef
This PR complete the type definition for the props of the composer and replace
the custom Object by Ref type in the relevant place.

closes odoo/odoo#119593

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-25 14:07:30 +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
Joseph Caburnay 8d50daeefa [REF] point_of_sale,*: minimize the use of legacy web modules
*: l10n_fr_pos_cert,portal_rating,pos_adyen,pos_epson_printer,pos_loyalty,
   pos_mercury,pos_restaurant,pos_restaurant_adyen,pos_restaurant_stripe,
   pos_sale,pos_six,pos_stripe,web

This is part of the continuous effort of refactoring pos addons towards using
more modern modules and programming patterns (such as services). After this
commit, point_of_sale addons are now left with the use of the legacy
`web.concurrency` module because of the `MutexedDropPrevious`. It's okay to keep
it because it's relatively an independent module compared to other legacy web
module.

The following summarizes the changes in this commit.

- import `_t` from `@web/core/l10n/translation`.

- convert `PosDB` to js native class

- remove use of `format` in `TicketScreen`
  - To determine the cached orders are up-to-date, we now deserialize the dates
    coming from the server using web's `deserializeDateTime` function. Then,
    instead of initiating `cacheDate` as native js Date, we use the luxon's
    `DateTime` which is supported by the web date utility methods.
  - There is no need for the `format` function from `web.utils` legacy module.

- convert `PaymentInterface` to native class

- remove use of `web.config` module

- remove use of `web.time` module
  - use `serializeDateTime` from web.

- remove use of `web.rpc`

- remove use of `web.utils` module
  - introduce simple check for email address input
  - Replace use of `web.utils.Markup` with `@odoo/owl.markup`.
  - 'web.utils'.{round_decimals,round_precision,float_is_zero} copied to
    '@web/core/utils/numbers'.{roundDecimals,roundPrecision,floatIsZero}.
    - These helper functions are not removed from the web addon because they
      are also used from other addons that are not linked to pos.
    - `floatIsZero` is now computed by directly comparing the result of
      `roundDecimals` to zero. This works because rounding a decimal number
      which will result to zero will exactly give zero.

- remove use of `web.field_utils`
  - Replace `web.field_utils.parse.float` with
    `@web/views/fields/parsers.parseFloat`.
  - Replace `web.field_utils.format.float` with
    `@web/views/fields/formatters.formatFloat`.
  - Replace `web.field_utils.format.date` with
    `@web/core/l10n/dates.formatDate`.
  - Replace `web.field_utils.format.datetime` with
    `@web/core/l10n/dates.formatDateTime`.

- convert `PrinterMixin` and dependents to native class
  - `PrinterMixin` is converted to `BasePrinter`.
  - `Printer` is converted to `HWPrinter` (extending `BasePrinter`).
  - `EpsonPrinter` retained its name and is converted to extend `BasePrinter`.
  - Moreover, we also removed the convoluted `PrintResultGenerator`, replaced by
    simply creating object with the following signature:
    ```js
    { successful: boolean; message?: { title: string, body?: string } }
    ```

- remove use of `web.Session`

- replace use of `qweb.render`
  - We use `renderToElement` as replacement to templates that produces valid
    html.
  - Note that `renderToElement` is introduced in `@web/core/utils/render` module
    which is extracted from the original `renderToString` method.
  - For the epson printer template, we kept the xml layout and manually add
    required xml element to contruct the xml that will be sent to the epson in
    making print requests.

- use `Mutex` from `@web/core/utils/concurrency`

- remove use of `Markup` when rendering receipt info (`ticket`) in order to
  render new lines.

- Remove use of `jquery` in `htmlToImg`.

closes odoo/odoo#117231

Related: odoo/enterprise#39078
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-25 14:07:09 +02:00