Commit Graph
157958 Commits
Author SHA1 Message Date
Andrea Grazioso (agr-odoo) a660e8ab3e [FIX] purchase_stock: price difference currency conversion date
Have a product P configured with:
* Product Type: Storable Product
* Product category:
    * costing method: standard
    * Inventory Valuation Automated
    * Price Difference Account: "500000 Cost of Goods Sold"
* Cost $100

Activate Multicurrency:
* USD main currency, CZK foreign currency
* On CZK set the rates
    * date1, Unit per USD: 30
    * date2, Unit per USD: 25 (date2 > date1)
    * date3, Unit per USD: 26 (date3 > date2)

Create a purchase order:
* Date: date2
* Currency: CZK
* Order line:
    * Product P
    * Quantity 10
    * Unit price 3000
Confirm, receive product on date2 (svl needs to be in date2)
Create the vendor bill with:
* Bill date: date 1
* Accounting date: date 3
Confirm the bill

Issue

Check the bill journal items. Price difference account is debited with 4000 czk.
This amount is not correct.
The valuation layer price unit is 100$
At the receipt date the price unit should be 2500czk
The price unit difference 3000-2500 = 500czk
Price difference 500*10 = 5000czk
The issue occur because the price difference unit is converted at bill
accounting date, resulting in 4000czk

opw-3063809

closes odoo/odoo#111199

X-original-commit: bbc0b003f6ff08a50196e07b66083ee7e8896150
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-27 14:03:32 +01:00
qsm-odoo 5a8c7a17b2 [FIX] web_editor: remove dead code linked to ready_to_save
Commit [1] removed the last listener to the 'ready_to_save' event and
commit [2] removed the trigger of that event once and for all afterwards
... but it kept local code related to awaiting the operations the event
induced. This commit removes that dead code.

[1]: https://github.com/odoo/odoo/commit/00080f4b736c84eedd3f15e99004c1473cb78f37
[2]: https://github.com/odoo/odoo/commit/10af6e83bf318db7fe245038f0c66d68b9fa7957

closes odoo/odoo#111167

X-original-commit: 36c69b851771225ddd31a09d606dcac3c9e910e5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-27 14:03:27 +01:00
Tommy (tong) 25dbddc945 [IMP] payment_asiapay: update api_url based on country
Issue:

Merchant account created inside Philippine will use PesoPay,
created inside Thailand will use SiamPay, and created inside
Indonesia will use BimoPay. Currently. only PayDollar is
available.

Cause:

Missing PesoPay, SiamPay and BimoPay.

Solution:

Add a brand setting on payment provider to allow user to select
which branch will be used.

More:

- What is PayDollar, PesoPay, etc. to AsiaPay?
PayDollar, PesoPay, SiamPay, BimoPay is the same system under AsiaPay
but is for different countries to apply.
PesoPay is for the PH market
SiamPay is for the TH market
BimoPay is for the ID market
while PayDollar is for all other market likes HK, CN, MO, TW, SG, MY,
IN, VN, NZ and AU

- Why are there multiple endpoints for a given API?
Below reasons are from AsiaPay side
Local regulators requirements for BimoPay
Branding purposes to localize for the users for PesoPay and SiamPay.

- Why didn't we integrate all these endpoints in the first version of
our AsiaPay implementation?
We got in touch with AsiaPay after our first integration. Therefore
after partnership established with AsiaPay, they provide more
integration guides on the whole development

- If many customers ask for these endpoints?
Right now, there is no customers asking for these endpoints. However
if they register AsiaPay under certain countries, they have to use
the other endpoints otherwise they will not able to use AsiaPay on Odoo at all.

task-3073748

closes odoo/odoo#110357

Related: odoo/documentation#3423
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-01-27 14:03:24 +01:00
Thomas Lefebvre (thle) ea96e51e9e [FIX] hr: duplicate employee without keep the same contact
Steps to reproduce:
- create an employee and fill in the email address;
- duplicate this employee;
- change the email address of the new employee.

Issue:
The email address is changed on both employees.

Cause:
When we duplicate an employee, we keep the same contact.
By modifying the email address, we will modify the contact's email address.
Then we "synchronise" all employees with their contact
using the contact information.

Solution:
When an employee is duplicated, a new contact must be created.
Therefore it is necessary to avoid copying the `work_contact_id` field.

opw-3144129

closes odoo/odoo#111201

X-original-commit: 1582f6834bee2123f8703b2ae52996b0978e2311
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-01-27 12:58:46 +01:00
Aaron Bohy 865bd89eba [FIX] web: fix record test failing randomly
Before this commit, the changed test sometimes failed because the
autocomplete dropdown wasn't opened yet when we tried to click on
one of its items. Setting the autocomplete delay to 0 doesn't
remove the setTimeout, but overriding the setTimeout method from
browser like this commit does ensures the callback (i.e. the
dropdown opening) is called directly.

Fixes runbot error 15715

closes odoo/odoo#111178

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-01-27 11:53:07 +01:00
Victor Feyens 509b30853e [FIX] web: field wrongly considered as always invisible
If a field is present twice in a view, the field information
stored in the relational model `activeFields` holds and consider
only the latest xml node found.

Therefore, a field is sometimes considered alwaysInvisible
when it is visible and editable.  This means that you might click
on the 'Save' button and get a server error because a required field
is not set when you should the required field should have been
highlighted and requested before making a `create` rpc request.

This commit makes sure that for the alwaysInvisible logic,
both nodes are considered.

closes odoo/odoo#110959

X-original-commit: 3d490a264b2fe837f9dc5138f8605f5466b7c312
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-27 10:47:41 +01:00
snd a073438cce [FIX] mrp: set default qty_producing
When opening a work order and the quantity_producing is set at 0 by default, and since it is not possible to record 0 as done, the user always gets an error message when trying to carry on without manually editing that quantity producing field. This is not very user friendly as a manual input there on any device is burdensome.
This fix automatically sets qty_producing to be equal to qty_remaining in workorders for non-unique serial products when opening a workorder if the quantity is zero.

task 3113153

closes odoo/odoo#111156

X-original-commit: ff96659e7f8d4a239ff641d1b3541226ae3cb9e5
Related: odoo/enterprise#36369
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Diez Stéphane (snd) <snd@odoo.com>
2023-01-27 09:18:14 +01:00
Aaron Bohy 7416cdca33 [FIX] web: debug: View Metadata dialog: format dates in user tz
Before this commit, the creation date and last modification date in
the metadata dialog (in debug, in any form view, click on the debug
item, then View Metadata) were displayed in UTC, whereas they
should be formatted in the user timezone. This commit fixes the
issue.

closes odoo/odoo#111153

X-original-commit: 104e17211be9098b48eac842d65b1c378af5c05a
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-01-27 09:18:06 +01:00
William Braeckman 43ba296046 [FIX] calendar: fix invalid function call
This commit fixes a function call that was trying to call on `this`
while the function is imported and not assigned to the object.

closes odoo/odoo#111138

X-original-commit: b01be3ea8f77d42d5162648a078f09328491c102
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-27 09:18:01 +01:00
Thomas Lefebvre (thle) 7337d9ef11 [FIX] hr_holidays_attendance: check overtime deductible during write
Steps to reproduce:
- install Time Off and Attendances apps;
- making sure an employee doesn't have extra hours;
- create a time off type which is "Deduct Extra Hours" (A);
- create a time off type which is not "Deduct Extra Hours" (B);
- create a time off with the type (A);
- save;
- edit the time off with the type (B);
- save.

Issue:
The time off is modified and it is possible to approve it.

Solution:
Check that the employee has enough extra hours
if the type of time off used is "Deduct Extra Hours".

opw-3141108

closes odoo/odoo#111166

X-original-commit: 2a1db0d803ea04a6d94f3d07ba3ea7ddcb24828e
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-01-27 08:17:52 +01:00
Thomas Lefebvre (thle) a3e6b5caae [FIX] hr_holidays: use the language format to display dates
Steps to reproduce:
- go to Time Off app.

Issue:
Dates in the dashboard do not respect the language format.

Cause:
We give a date format to the `format_date` function.
This function applies this format and not the language format.

opw-3138369

closes odoo/odoo#111130

X-original-commit: 432f146884d0a8b302b8f322f775087da027152b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-01-27 07:18:00 +01:00
bat-odoo 31463afc8c [IMP] l10n_in_edi_ewaybill: Send E-waybill button only show in Indian company
Currently, the `Send E-waybill` button show in all company no matter what
company is installed.

So In this commit, we check whether the invoice company country code is `IN` or not,
based on that we hide/unhide the `Send E-waybill` button.

closes odoo/odoo#111017

X-original-commit: 4aadca32da4e983f707b0f9eaa812b530c971666
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Bhavin Patel (bat) <bat@odoo.com>
2023-01-27 05:43:39 +01:00
tsm-odoo 180a7783d1 [FIX] bus: do not use dbuuid
Before this commit, the dbuuid was added to the session info in order
to reset the last known notification id.

This is not necessary since #103025. Indeed, if the last notification
passed to the server is superior to the last one, the last notification
default to 0.

This commit removes this information from the session info.

closes odoo/odoo#111154

X-original-commit: 80c2d32009e07bef05cce0b53221c6a8ca024fb0
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-27 02:41:48 +01:00
Stefan-Calin Crainiciuc (stcc) 62a71da538 [FIX] mass_mailing*: made demo mailing editable
*: _sale, _crm

Steps to reproduce:

- install Email Marketing
- duplicate an existing demo template
- edit > drag a block from the editor onto the email

Issue:
`Traceback: Uncaught Promise > Cannot read properties of undefined
(reading 'droppable')`

This happens because the email templates are not editable, which means no dropzones can be attached to them.

Solution:
Add classes 'oe_structure' and 'o_editable' to one div in the
templates so that at least one dropzone can be created.

opw-3050732

closes odoo/odoo#111161

X-original-commit: 5f19f9c33656d8b38e827383e0dc8d65e5ebad2a
Signed-off-by: Stefan-Calin Crainiciuc (stcc) <stcc@odoo.com>
2023-01-26 22:09:53 +01:00
Odoo's Mergebot a0abc53b50 [FW][IMP] l10n_generic_coa: add (and fix) tests for invoice composer
This merge is a manual FW of odoo/odoo#110728

In this merge we add tests as done in 16.1. They are updated to match some
recent changes done in the mail composer. This includes notably the usage
of 'res_ids' field, rewriting of values generation, renaming of some
fields, ... See odoo/odoo#99482 for more details.

We also provide some fixes, following the merge of this composer cleaning.
Finally it also prepares ground for the update of composer to use editable
stored fields.

Task-3149286 (Account: cleanup account.invoice.send wizard)
Task-2088884 (Mail: Use editable computed stored fields in composer)

closes odoo/odoo#110919

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-01-26 22:09:47 +01:00
Thibault Delavallée fd513bd25b [FIX] account: make sending of invoice send emails deterministic
Using a set for langs means ordering is not deterministic. Having deterministic
processes is better for debug and testing. Use a sorted to ensure ordering
of langs iterable.

Task-2088884 (Mail: Use editable computed stored fields in composer)
Task-3149286 (Account: cleanup account.invoice.send wizard)

X-original-commit: odoo/odoo@d903424
Part-of: odoo/odoo#110919
2023-01-26 22:09:47 +01:00
Thibault Delavallée 9e45df02aa [IMP] l10n_generic_coa: add tests for invoice composer
Purpose is to add some tests for the invoice composer, both unit tests
and performance tests. Some cleaning is coming for 16.2 better avoid
(too much) regressions.

Task-2088884 (Mail: Use editable computed stored fields in composer)
Task-3149286 (Account: cleanup account.invoice.send wizard)

X-original-commit: odoo/odoo@978d50d
Part-of: odoo/odoo#110919
2023-01-26 22:09:46 +01:00
Thibault Delavallée a3e404e17e [IMP] mail: improve test tooling
Add some information and values propagation in some custom asserts in mail
test tooling.

Task-2088884 (Mail: Use editable computed stored fields in composer)

Part-of: odoo/odoo#110919
2023-01-26 22:09:46 +01:00
Thibault Delavallée e08854093e [FIX] account, mail: better batch mode support
Mail composer does not support direct assignment of res_ids for rendering
using active_ids context key anymore when res_ids or res_domain are present.
With this commit we allow to force the rendering on some specific IDs in the
composer using a temporarily 'composer_force_res_ids' context key.

This will be removed once languages are better supported in the mail composer
which is the source of that small hack in the invoice composer.

Followup of odoo/odoo#99482

Task-3149286 (Account: cleanup account.invoice.send wizard
Task-3046371 (Mail: Better Language Support in Composer)

Part-of: odoo/odoo#110919
2023-01-26 22:09:46 +01:00
Alvaro Fuentes f385cd62de [FIX] hr_recruitment: set view priority
The view `hr_job_search_view` needs an xpath anchor set on the view
`view_job_filter_recruitment`. Since both views have default priority
the order they are applied depends on their ID. In a normal install
process the views are created in the right order, but there are cases
where the IDs are not on the right order.

Steps to reproduce:
1. Install hr_recruitment in 15.0
2. Remove the view pointed by view_job_filter_recruitment
3. Update to 16.0

We get an error:
```
ValueError: Element '<xpath expr="//filter[@name=&#39;my_favorite_jobs&#39;]">' cannot be located in parent view
```

closes odoo/odoo#111140

X-original-commit: 1e77fabfa087fbeedab974645646bc1761c07468
Signed-off-by: Christophe Simonis <chs@odoo.com>
Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
2023-01-26 19:56:10 +01:00
Victor Feyens 7781d94cf9 [FIX] acc_pay_*_patch: correct payment status on invoices portal
The logic of following acc_pay code if there was a tx and following
account code if there was no tx was no wrong but was simplified too much,
losing 'Reversed' and 'Cancelled' state if there was any tx linked to
the invoice.

closes odoo/odoo#111139

X-original-commit: 8ae3413e42e2591934593d61a899df88fadbba45
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-01-26 19:56:07 +01:00
Lucas Lefèvre 76c68d79dd [FIX] spreadsheet_dashboard_sale: fix incorrect amounts
closes odoo/odoo#111137

X-original-commit: 9ea01b14a96c984a763e285b934d5440b6d2895a
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-01-26 19:56:05 +01:00
Lucas Lefèvre 9999fe649e [FIX] spreadsheet_dashboard_*: exlude drafts and cancelled records
Some amounts were wrong because quotations were included, even though
they do not make revenue.

opw 3121450
task 3130829

X-original-commit: 0fa2510c34a41e9e91131909a0b24af25aa770fc
Part-of: odoo/odoo#111137
2023-01-26 19:56:04 +01:00
Nicolas Bayet 2a0e8d1993 [FIX] web_editor: fix _getEditorOptions traceback
Before this commit, a traceback would be thrown when no options were
passed to `_getEditorOptions` because of a code mistake using the
variable `options` rather than `finalOptions`.

Also, this error revealed that the `this.options` of the wysiwyg could
be wrongly reset if no argument `options` was passed to `resetEditor`.

task-3149085

closes odoo/odoo#111100

X-original-commit: 475775d3dfc230c06c7a2b127b67bc22543e8a27
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-01-26 19:55:58 +01:00
Christophe Simonis 04487da7c5 [FIX] core: merge scripts found in --upgrade-path
Don't limit on the first directory found in the upgrade-path.

It follow the same behavior regarding scripts found in the `maintenance`
directory and the ones in the local `upgrades` directory of modules.

opw-2868713

closes odoo/odoo#111087

X-original-commit: d2e6c9d5010ab8092eff37775e92b486f89d28fc
Signed-off-by: Christophe Simonis <chs@odoo.com>
2023-01-26 19:55:55 +01:00
mehjabinfarsana 418c46be03 [FIX] sale: Traceback on clearing quotation date in sale order form
before this commit, in sale order form view, while clearing the quotation date it was showing Traceback error. field is already required in the model level, so removing the conditional required attribute from the view

after this commit, the quotation date is required

closes odoo/odoo#111066

X-original-commit: f8db67897c1b533a591eaf48ae18b625b1dd4d33
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-01-26 18:51:37 +01:00
Martin Maes e084b5dcf9 [FIX] mrp: Workorder timer not updating
This PR addresses a bug introduced in odoo/odoo/pull/109776
The user can indeed modify the timer, but because a started timer is a readonly field,
the timer does not update.
Using isDirty allows to check if the user really modified the timer.

closes odoo/odoo#111064

X-original-commit: 9aa8752da18ed679d7ddae93682c045204083104
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-26 18:51:34 +01:00
xO-Tx 84a445a8e0 [FIX] web_editor: prevent clicking on the page while saving
To reproduce the issue:
- Website page (e.g. "Contact us") > Edit mode > save.
- Try to click on the page right after the save (and before the preview
is blocked) > traceback.

In this specific case, clicking in the page will activate the targeted
snippet and initializes its "SnippetEditor" while destroying the
options and cleaning the DOM, leading to wrong behaviors.

The goal of this commit is to fix this issue by simply ignoring the
click on the page during the save process.

opw-3119347

closes odoo/odoo#111030

X-original-commit: 6bf3823c2996af4ec0534ff69471887ac43a8ddf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-26 18:51:26 +01:00
Ahmad Khanalizadeh a62d2c694f [FIX] point_of_sale: not show discount note for price increase
Before this commit, if if the discount policy of the pricelist is set
to "show public price & discount to the customer" and then the unit
price of a product is changed frompoint of sale, a note is added to
the invoice, that shows a "price discount".

This also happens in case of a price increase, which should not happen.

opw-3121143

closes odoo/odoo#110969

X-original-commit: b7b642cf797090c68f659a23a5e11e4fc47ecc43
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
2023-01-26 18:51:21 +01:00
Eteil Djoumatchoua (etdj) 8827e20383 [FIX] web: Get the correct list of actions on hr.leave form view
Steps to reproduce:
- Go to base Runbot and install Time Off.
- Go to Time Off > List View and select a list view item (checkbox).
- Go to Action and notice there is no Archive option.
- Go to the form view and go to Action > Archive.
- See error about not being able to archive leaves.

Issue:
We can see the action archive but we can not run it

Expected behaviour:
We shouldn't be able to see that action archive

Cause:
When computing the value of archiveEnabled we use the wrong variable "activeFields".

Solution:
Give the good one, "this.props.fields"

opw-3079475

closes odoo/odoo#110836

X-original-commit: 122fa724e1f15e8c28a29bbe8a80c089ff954956
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-26 18:51:18 +01:00
Adrien Schoffeniels 5c8312a038 [IMP] crm: harmonize layout of activities reporting button in teams
Purpose:
========
The "Activities" button in the reporting section in the dropdown menu
of teams kanban cards is the only button that has a different layout than
the other buttons in this dropdown, and this layout makes the button
difficult to read when the dark mode is activated.

This commit makes the button have the same look as the other ones, by
removing an unnecessary div wrapping this button, and removing the custom
style attribute.

Task-3137791

closes odoo/odoo#110736

Related: odoo/enterprise#35962
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-01-26 18:51:10 +01:00
Julien Van Roy f2a64b03e1 [IMP] sale,website_sale: add hooks to the checkout flow
Add hooks before rendering the `website_sale.cart` and
`website_sale.extra_info` templates. This allows to pass flags to
trigger style variation in the checkout wizard (add an extra step). In
addition, add the country_code to the sale_order view form, since it
will be needed everytime we add l10n_* fields in this view (with attrs
based on `country_code`).

Related: https://github.com/odoo/enterprise/pull/35050/commits/fce5e682946cfa7d9e19c0c3c6abfab3dcbcc54a.

task-3089169

closes odoo/odoo#108181

Related: odoo/enterprise#35050
Signed-off-by: Laurent Smet <las@odoo.com>
2023-01-26 18:51:01 +01:00
Julien Van Roy 0499bc1687 [IMP] website_sale: allow the checkout wizard to have any number of steps
Previously, the columns of the checkout wizard were hardcoded (3 columns
or 4 if the extra step is enabled). Using a bootstrap grid allows us to
support any number of steps. This is convenient, for instance, when we
need to specify some country specific fields in an additional
information tab.

related to task-3089169

Part-of: odoo/odoo#108181
2023-01-26 18:51:01 +01:00
Anita (anko) f5eec1d539 [FIX] sale,purchase,account: Duplicating document_tax_totals
If user would add addictional field in one of reports it could break other
reports as other models do not share all the same fields. Now modules inherit
template and create their version of field.

task-2858097

closes odoo/odoo#106140

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-01-26 18:50:58 +01:00
Anita (anko) acb192eafb [IMP] payment: require name and image for payment method
Payment methods without image or without name does not make any sense.
Previously created payment methods without a name will be
given default name and ones without an image will be deleted.
Payment icon can no longer be created or edited from payment
provider form view.

task-2853424

closes odoo/odoo#105909

Related: odoo/upgrade#4043
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-01-26 18:50:52 +01:00
Florian Damhaut 415d1299f2 [IMP] sale: split populate for usage in sale_subscription
This commit split the function confirming SO in populate with
the purpose of adding populate method for subscription SO,
recurrent product, recurrence and pricing in odoo/enterprise#33305

closes odoo/odoo#104269

Signed-off-by: Arnaud Joset <arj@odoo.com>
2023-01-26 18:50:47 +01:00
luve-odoo ac0395a1e8 [FIX] product : UI product.product form was broken
UI improvements for the form of product.product model.

task-3043184

closes odoo/odoo#111052

X-original-commit: d8bc64e6cf04291370e577abe8c58303ae4a9741
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-26 17:33:49 +01:00
Simon Genin (ges) f5c5e51917 [FIX] web: tooling: fix support for older tooling
Older tooling used prettier config files. The issue was that the
disable command of the tooling was also changed to not remove those
files as they shouldn't exist anymore.
But changing from 16 to master without manually triggering a tooling
"disable" would then left the prettier config and mess with the addons
eslint whitelist.

closes odoo/odoo#110582

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-01-26 14:19:06 +01:00
Florian Vranckxandxmo-odoo 7dc2190fa4 [IMP] test_lint, * : SQL injection detection
This commit brings a new way to detect sql injection.

Previously, this test was meant to push developers to use the second argument of cr.execute(query,args) for parameters.

However, this also meant that the test will always be green as soon as the second argument is used.

This commit aims to change that by tracking the source of information of all variables used to build a query. Parsing of the AST in reverse, starting from the query variable itself.

However these are some current limitations:
  -The hierarchy of Odoo modules is currently not taken into account. If two functions have the same name, they will both be evaluated to find if their return value is part of the query
  -Object mutation is not supported and is not evaluated
  -Whitelisted values are too wide in order to reduce the amount of false positives.

Even if this test is blocking, it can be disabled by adding #pylint: disable=sql-injection at the end of the line.

closes odoo/odoo#101237

Related: odoo/enterprise#35697
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: xmo-odoo <xmo@odoo.com>
2023-01-26 14:19:00 +01:00
Arnold Moyaux eaf45ab9ca [FIX] sale_stock: user default on warehouse
Use case:
- Create a user default value to set the warehouse as empty
- Create a SO

The SO warehouse is filled. It happens because there is an
extra check to add the warehouse based on the user preference
or first company's warehouse.

However the user default could be use to prevent that behavior
and force the user to choose a warehouse (15.0 behavior)

This commit always respect the user default if it's set.
Also remove a strange condition that could set warehouse of
wrong company

closes odoo/odoo#111033

X-original-commit: 3afb0bae0b48dc152908a2a39b0de7e2f966b54c
Signed-off-by: Adrien Widart <awt@odoo.com>
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-01-26 12:19:17 +01:00
vlst 4b6ae93133 [FIX] pos_restaurant missing access token
closes odoo/odoo#110932

X-original-commit: 8e018aa07c9fbfc88b3b4a84840fa02e29c4acd5
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-01-26 12:19:15 +01:00
Martin Trigaux d3b3a30c84 [FIX] mail: remove group when unchecking the box
When activating the option "Restrict Template Rendering" the employee
group no longer gets the group automatically via the Implied Groups
field. However this did not have much effect because
- all the existing employees still had the group
- new users had the group via the template user

Remove the group with active_test=False to include the Default
Template User in the list.

Before this commit it was a bit confusing that new users still got the
group by default, even after deactivating the option in the settings.

closes odoo/odoo#110900

X-original-commit: ea0f674ac15964aaeb3def31758cec558b354a99
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-01-26 12:19:12 +01:00
roen-odoo f28877c481 [FIX] pos_sale, sale, sale_mrp: Correctly compute kit quantities in PoS
Current behavior:
When you imported a sales order with a kit in the PoS, the kit quantity
was not correctly computed.

Steps to reproduce:
- Create a product kit with atleast 1 component with a different UoM
  than the kit
- Update the quantities on hand of the component
- Create a sales order with the kit
- Import the sales order in the PoS
- You will have a traceback

Note : There is no traceback if both components and kit uses same UoM,
but the quantity of component was not correctly computed.

opw-2983703

closes odoo/odoo#110714

X-original-commit: 3000515a1c96c203e644e3d2cf783fe9efd0e45e
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-01-26 12:19:09 +01:00
Walid HANNICHE (waha) 7e0e711e31 [FIX] stock_account: SVL unit price precision
Steps to reproduce:
- Increase decimal accuracy of product price (eg: to 4)
- Create a product with fifo automated valuation and price of 280.8475
- Confirm a sale order of that product and Confirm stock picking
- Create a return on the stock picking

Bug:
rounding error on the stock valuation

Fix:
do not round unit price on currency rounding

opw-2988071

closes odoo/odoo#110112

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-26 10:16:55 +01:00
Kevin Baptiste 2a5b80a6d4 [IMP] hr,resource: automatically compute number of hours
- Automatically compute the average number of hours per day on
   resource.calendar;
 - Don't allow to change the working hours of an employee when they have
   a current running contract;
 - Seperate smart buttons on resources to distinguish Material / Human.

 task-3102517

closes odoo/odoo#109768

Related: odoo/enterprise#35718
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-26 10:16:53 +01:00
Luis Torres 35959e9b0d [IMP] l10n_pe: New identification types requested by the SUNAT
By Sunat regulations a new type of identity document will be accepted:
License Permit Temp. Perman. This applies to a Boleta made to a foreign
customer and also to the operator of the vehicle when creating delivery
guides.

Legal ref:

Website: https://cpe.sunat.gob.pe/node/88
Document with Catalog Update No. 8:
https://cpe.sunat.gob.pe/sites/default/files/inline-files/AjustesValidacionesCPEv20210727%28ultimo%29.xlsx

closes odoo/odoo#108506

X-original-commit: 027bd9b0a1ea93744cc92a88efc1a77d142df23b
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-01-26 10:16:47 +01:00
Jeremy Kersten c4443e31b0 [FIX] hr_holidays: don't remove nothing on new user creation
This commit avoids potential concurrent updates if you create 2 users
simultaneously.
The method is called by an override of the method create from res.users.

In production, we have concurrent update because it writes to the group
no matter if someone is to remove or not. And orm will do a query in all
cases to update the write_date, ...
Now we only execute a query if somebody need to be removed.

closes odoo/odoo#111031

X-original-commit: 5a0cf8bc8a9747e18eca5ddd3f135eb0cfcfd13d
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-26 08:18:56 +01:00
Habib (ayh) 29cc267fc1 [FIX] account, purchase: stacktrace when no currency is selected
The tax totals computation requires a currency to be provided. When a user removes the currency deliberately and tries to add a line, an uncaught error is thrown.
The currency_id is required, and the user will not be able to save the move anyway.

To reproduce:
New Invoice or Purchase
Clear the currency field
Add a line
Stack Trace

After this PR:
tax totals are computed based on the journal currency or company currency when not available

No task, discovered thanks to #110920

closes odoo/odoo#111021

X-original-commit: f74f9bc04ed8f18746eb509f3c8dc598b1618230
Signed-off-by: William André (wan) <wan@odoo.com>
2023-01-25 21:53:44 +01:00
Dylan Kiss (dyki) 8889a896f3 [FIX] base: update Spanish address format
Currently the Spanish address format does not include the province/state.

This change adds the province between parentheses after the zip code and city.

task-3147965

closes odoo/odoo#111012

X-original-commit: 2c31ad84137b3a764116bea6a6d765a2c7d03eb7
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2023-01-25 19:52:43 +01:00
Guillaume (gdi) 4a9d7e5554 [FIX] web_editor: correctly position the blocks tooltips
Since [this commit], a tooltip is displayed on the blocks that can be
dropped in a page so that the user understands that he must not just
click on it but drag and drop the block. Unfortunately, these tooltips
were not well positioned in the email marketing application because the
editor is in an iframe in this application. This commit allows to
position correctly these tooltips.

Steps to reproduce the bug fixed by this commit:
- Go to the email marketing application
- Create a new mail
- Select a template other than "plain text".
- Triple click on a block

=> The tootlip is displayed way too high.

[this commit]: https://github.com/odoo/odoo/commit/a50c09e3b432d7601cd0e02cbbfabe24a67ba70f

task-2777738

closes odoo/odoo#111011

X-original-commit: 42d32a4f40d685e10f2ae4bb678df2009cb4bd21
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-01-25 19:52:40 +01:00