Commit Graph
170958 Commits
Author SHA1 Message Date
Alvaro Fuentes 1bc016fa0f [FIX] core: remove SQL constraints upon ir.model.constraint removal
Otherwise we leave the constraints in the table. Common source of
upgrade issues.

closes odoo/odoo#163623

X-original-commit: 847a24e6f7f57c755cf6f42597b1ac75908f2c83
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
2024-04-29 08:07:30 +00:00
Paul Stroobant fc16ecced2 [FIX] project_purchase: use price_subtotal in project profitability
Steps to reproduce the issue:

1. Create a purchase Tax and tick Include in Price in the Advanced Options
2. Create a Purchase Order with Analytic Distribution towards a Project in the Order Line
3. Set the purchase Tax created before as the tax of the Order Line
4. Confirm the Purchase Order
5. Make sure the Project is Billable, then go to the Project Updates
6. The profitability calculated the price with the included Tax
7. Create a Vendor Bill and set the same Tax and Analytic Distribution as the Purchase order
8. Confirm the Bill
9. Return to the Project Updates
10. The profitability doesn't calculate the included Tax

Explanation:

In `project.project._get_profitability_items`, we can find an inconsistency in the queries.
The query for `purchase.order.line` is looking for `price_unit`, which takes included taxes into account.
https://github.com/odoo/odoo/blob/249aaac7bd1a13d62c947cddb1835772659aabff/addons/project_purchase/models/project.py#L125-L132
The query for `account.move.line` retrieves `price_subtotal`, which does not.
https://github.com/odoo/odoo/blob/249aaac7bd1a13d62c947cddb1835772659aabff/addons/project_purchase/models/project.py#L171-L181

Suggested fix:

In `project.project._get_revenues_items_from_invoices`, the `account.move.line` query retrieves `price_subtotal` as well.
https://github.com/odoo/odoo/blob/8750b94c53c6ab58567873b0745fa6d9a18c97d0/addons/sale_project/models/project.py#L467-L474
With above information and input of PO (olma), taxes will not be calculated in `project.project._get_profitability_items`, therefore we will replace `price_unit` with `price_subtotal` in the `purchase.order.line` query.

opw-3781426

closes odoo/odoo#163567

X-original-commit: d4fa9ff7b1e2e8b5cd466d0f5433f99a1b407ac9
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-29 08:07:29 +00:00
lase@odoo.com 1ecd0b2160 [FIX] project_sms: Allow transition of task to state with SMS template
Steps to reproduce:

Be sure to have the `sale_sms` module installed.

- Connect as Marc Demo. Note: Marc has the administrator access rights
  in every service application including projects,...
- Go to the field service app create a new task and change its state to
  `planned`.

> Access error: you are not allowed to access 'SMS Templates'

Expected behavior:

Since the newly created user has the rights to modify the state of the
task and since he does not try to access the content of any sms.template
he should not raise this access error.

Cause of the issue:

The stage `planned` is associated with an SMS template. As such, when a
task is moved to this stage, an sms will be sent using the template.
This action is done during the `write` override of the `project_sms`
module:
https://github.com/odoo/odoo/blob/5f1a3bdcaa63492cf169f6f5f3eb2e2281ad5ab5/addons/project_sms/models/project_task.py#L24-L32
However, this `_send_sms` method will need to 'read' the sms.template to
generate the sms:
https://github.com/odoo/odoo/blob/e6be732450d9ef662a48ba074e1ca1ad32e35c04/addons/sms/models/mail_thread.py#L191-L192
Since the user does not have the acess rights to 'read' this template
because of the `ir_rule_sms_template_so_sale_manager` access rule
defined in the `sale_sms` module, the access error will be raised.

Fix:

Since the `_send_sms` method will only read records in order to generate
the sms that will be send, we should bypass access rigths checks during
the call of this method.

Note: this was already the solution used for portal users.

opw-3789197

closes odoo/odoo#163525

X-original-commit: b5b63509a6bc4467cf84cd15ebdf3b4b0601aeb0
Signed-off-by: Lancelot Semal (lase) <lase@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-29 08:07:28 +00:00
Djamel Touati 14836d4084 [FIX] mrp: create a stock move without price_unit in MO
Steps to reproduce the bug:
- Create a storable product C1:
  - standard_price: $10
  - Update the quantity to 2 units

- Create a storable product P1 with BoM:
  - Component: 1 unit of C1

- Create a MO to produce 1 unit of P1:
  - Confirm it

- Update the price of C1 to $20

- Go back to the MO and set the quantity consumed of C1 to 2

- Mark the MO as done
- Confirm the difference in consumption

Problem:
Another move is created with 1 unit of C1 consumed but is not merged
with the first move because the two moves were created with different
prices, making them incompatible for merging.

Solution:
There's no need to create the moves with `price_unit`.

OPW-3791816

closes odoo/odoo#163175

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-29 08:07:27 +00:00
Arnaud Sibille 69b2c89165 [FIX] point_of_sale: create picking before invoice
We are in the context of anglo-saxon accounting, when selling a product
having an automated valuation.  The invoice linked to the `pos.order`
should have its stock output line reconciled with its counterpart in
the stock valuation journal.  That is what happens if you create the
invoice directly from point of sale.

Currently, if you do not create the invoice, keep the session open and
then click the "Invoice" button on the pos order, the stock output line
will not be reconciled.

This happens because in `action_pos_order_invoice`, the picking is
created after the invoice.  But the reconciliation happens when creating
the invoice.  As it doesn't have its valuation counterpart yet (which is
created from the picking), it then do not reconcile with anything.

The fix here is to create the picking before.

opw-3702345

closes odoo/odoo#163157

X-original-commit: abf3f16ea6bb0278b2d44de281d69d3cfc8ac4cb
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2024-04-29 08:07:26 +00:00
Lucas Perais ccddb8a36f [FIX] base: ir_qweb_field:image: handle webp mimetype
See discussions on https://github.com/odoo/odoo/pull/85494/.
TLDR: webp image format needs to be supported, but we should avoid
going through the Pillow library as it is largely unsafe for that format.
jpg attachment are created in JS at upload time.
Wkhtmltopdf doesn't support webp, so, in reports, we should display one of those jpg copies.
This work is handled by `ir.qweb: _get_converted_image_data_uri` which is used as:
```xml
<img src="image_data_uri(some_b64value)" />
```

The mentioned PR did not however adapt the ir.qweb.field.image that, when passed the option `qweb_img_raw_data`
should return a base64 url such as `data:[mimetype],base64,[datas]`.
usage:
```xml
<span t-field="object.image_field" t-options-widget="'image'" t-options-qweb_img_raw_data="1" />
```

Hence, before this commit, there was a crash as we tried to pass that value to PIL.

After this commit, there is no crash, and the image displays correctly as JPG in the PDF

opw-3859423

closes odoo/odoo#163003

X-original-commit: 9056a4b1f28e820c0444f28367cc30abebd5ea30
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-04-29 08:07:25 +00:00
Patrick Hoste 7a124de438 [FIX] web: force padding 0 in some nested sortable
In Documents when dragging a workspace in the search panel
to resequence it there was no visual effect showing where
the workspace would drop. This was due to some css rules that
were replaced by a bootstrap class in the following
commit : 6f63e2349c

In our case, the `o_search_panel_category_value` node already
has a `py-1` bootstrap class, which overrides the value set
by the `py-0` class.

this commit restores the `padding-top: 0 !important;` and
`padding-bottom:0 !important;` rules to avoid conflict with
other py-X CSS rules (e.g.: py-1, py-2, ...)

Task-3877426

closes odoo/odoo#162948

Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2024-04-29 08:07:25 +00:00
Simon Goffaux (sigo) 5d0c50da3f [FIX] hr_holidays: save already_accrued from allocation form views
Currently, when we have an accrual plan where the accrued time is
allocated at the start of the accrual period and we set the allocation
start time in the past, the plan will be processed but already_accrued
will not be saved.

Example:
 - We have an accrual plan that allocates 1 day per month at the start
   of the accrual period. Milestone reached 0 days after allocation
   start.
 - We set the start date of the allocation to 2024-01-01, the current
   date is 2024-03-15. The number of days are calculated to 3.00
   (jan, feb, mar).
 - We save the record, already_accrued is not saved (defaults to false)
 - When the scheduled action runs (2024-04-01), it will allocate 2 days
   instead of 1

This commit fixes this behavior by adding the already_accrued field to
the form view so that it is saved when the record is created.

opw-3851320

closes odoo/odoo#161508

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-04-29 08:07:23 +00:00
Hubert Van De Walle f07c1a6b60 [FIX] sale_project: editable views for action_view_task
Steps to reproduce
==================

- Install sale_project,industry_fsm,web_studio
- Open quotation S00023
- Click on the Tasks stat button
- Open studio
- Go to views
- Enable the gantt view

=> Unable to complete the operation: duplicate key value violates unique constraint "act_window_view_unique_mode_per_action"

Cause of the issue
==================

The [action record] already contains the gantt view, but it is replaced
inside the python [action].

In [previous] version, the user was entering this condition and thus had
no problem editing the views

Solution
========

Instead of replacing the entire action['views'], we can remap the view
ids to the ones we want.

One side effect of this though is that the `gantt,activity,map` views
will be available by default.

---

[action record]: https://github.com/odoo/enterprise/blob/1df090289f3c45c200d133734989a6d9a8073145/project_enterprise/views/project_task_views.xml#L227
[action]: https://github.com/odoo/odoo/blob/1a9302dc3a9b0d9323612c10e0f3a91300bb89fd/addons/sale_project/models/sale_order.py#L154
[previous]: https://github.com/odoo/odoo/blob/8dbcd3d955e7270fc26a6141e8fce751029e5a4b/addons/sale_project/models/sale_order.py#L133-L141

opw-3800071

closes odoo/odoo#163594

X-original-commit: e331798655f821b89c50a0f578dabeb6e03ecc78
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-04-29 06:25:12 +00:00
Ken Luzuriaga 22993c230c [IMP] l10n_ec: New april 5th withholding tax codes updates for Ecuador
- 303A Servicios profesionales prestados por sociedades residentes
- 312A COMPRAS AL PRODUCTOR: de bienes de origen bioacuático, forestal y los descritos el art.27.1 de LRTI
- 312C COMPRAS AL COMERCIALIZADOR: de bienes de origen bioacuático, forestal y los descritos el art.27.1 de LRTI
- 343C Recepción de botellas plásticas no retornables de PET

closes odoo/odoo#163593

X-original-commit: ed01d20579604e7b6ead4d4d0ad68b11f7fe8eb4
Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-28 21:01:06 +00:00
Odoo Translation Bot b31ea21cab [I18N] Update translation terms from Transifex 2024-04-28 00:10:20 +02:00
Anh Thao Pham (pta) 2a2c76a028 [FIX] l10n_sa_edi: fix scheme ID for foreign customers
Steps to reproduce:
- Install Contacts, Accounting and l10n_sa_edi
- Switch to a Saudi Arabian company (e.g. SA Company)
- Create a contact who is not in Saudi Arabia:
  * Address: [Complete address in United Arab Emirates]
  * VAT: [any]
- Create an invoice:
  * Customer: [The created contact]
  * Product: [any]
- Confirm the invoice
- Process by ZATCA

Issue:
The following warning is returned:
"The other Buyer ID (BT-46) must present in the tax invoice and associated
debit notes and credit notes (KSA-2, position 1 and 2 = 01), where the buyer
VAT registration number or buyer group VAT registration number (BT-48) is
not provided."

Cause:
"PartyIdentification" element is not set in the electronic invoice for customer
because he doesn't have "l10n_sa_additional_identification_number" field set.
This field is only available for contacts living in Saudi Arabia.
For contacts who don't live in Saudi Arabia, "PartyIdentification" should be
populate with their VAT number.

opw-3845645

closes odoo/odoo#163652

X-original-commit: 3500c5f5dc78ea88bb662bb08cb6c59482f502db
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-04-27 09:25:41 +00:00
Anh Thao Pham (pta) 704c0bec40 [FIX] account: fix taxes proposition in fiscal position of branch
Steps to reproduce:
- Install Accounting
- Go to "Settings / Users & Companies / Companies"
- Create a branch company (e.g. Branch Company) for a company (e.g. YourCompany)
- Switch to Branch Company
- Create a fiscal position

Issue:
It is not possible to select the taxes from the parent company in the
tax mapping.

opw-3850514

closes odoo/odoo#163552

X-original-commit: f1f561b720e040c7284d42a6d1ce840ff86e7237
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-04-27 08:06:03 +00:00
Benoit Socias a4ea153932 [FIX] web_editor: do not use image when uploading document from URL
The goal of this commit is to forward port [the original commit] which
was introduced in 16.4 but, due to an error, has not been forward
ported.

Original commit message:
Since [1] when uploading images from URL the data is downloaded and then
hosted on the Odoo instance. As stated in its task (task-3129360) it
should not have been applied to document URLs.
Because of this, when hitting a CORS issue to fetch binary data, we try
to fetch the data through an `<img>` element by setting its `src` field
- which also fails when the data is not an image.

This commit makes the changes of [1] specific to image uploads and
restores the previous behavior for other files.

Steps to reproduce:
- Drop a "Text - Image" snippet.
- Double-click on the image.
- Go to the Documents tab.
- Click on "Add URL".
- Enter an example PDF URL.
E.g.: https://www.africau.edu/images/default/sample.pdf
- Click on "Add URL".

=> Fails because of a CORS issue.

[the original commit]: https://github.com/odoo/odoo/commit/238566d1dea29fd11353e7e6529d29843c4f658b
[1]: https://github.com/odoo/odoo/commit/943944dd249c15de870d6800d89e48d54a422e5a

task-3493618

closes odoo/odoo#163576

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-04-26 18:54:39 +00:00
aliya d00c64e263 [FIX] account_peppol: properly hide ocr button
`extract_can_show_send_button` is a computed readonly field, providing a default value doesn't do anything.
By setting `is_in_extractable_state` to `False` by default, we can hide the ocr button.

no task, noticed while fixing a traceback in saas-17.1

closes odoo/odoo#163568

X-original-commit: d4b06d49624a1e3c5ecbb4d0c755a165cf213120
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
2024-04-26 18:54:38 +00:00
David (dafr) 42c51588cd [FIX] mrp_subcontracting: fix origin moves on backorder
This commit adapts commits d4abaafa4757ace22010be49bb1f7ce1c4fbfc0d and
7a78839ca6cf45ddec7adb59051da132e0ebceb4

The commits above try to split the origin moves during a split
(backorder). The issues was the split move lost its correct origin move
and the backorder move had all the origin moves linked to it.

HOW TO REPRODUCE:
- Create product FNS (storable)
- Create subcontracted BoM for FNS
- On Operation type 'Receipt', set Show Detailed Operations = True and
  Pre-fill Detailed Operations = True
- Create PO for 10 units of FNS -> Confirm
- Go to Receipt > Detailed operation > Set quantity = 1 > Validate (with
  backorder)
- Repeat step above on the created backorder

OR

- Create storable product FNS tracked by serial number
- Create subcontracting BoM, with strict consumption
- Create PO for 10 units of FNS -> Confirm
- Open detailed operation, add 2 lines with SN, confirm, Validate &
  create backorder
- Redo the same step with backorder receipt

OPW-3838250 OPW-3812937

closes odoo/odoo#163553

X-original-commit: db78c0bdd4a50e094f8867b58b651e06a8822a8a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
2024-04-26 18:54:37 +00:00
sesn-odoo b9491abd1f [FIX] account: synchronize Invoice Line Dates with Invoice Date
Currently, when the `invoice_date` of an invoice is updated (triggering
the recomputation of `date`) and if a system flush occurs before any
line's date is accessed, the invoice lines' dates do not get updated.
The following test illustrates this issue:

```py
move = self.init_invoice(
    move_type='in_invoice',
    partner=self.partner_a,
    amounts=[1000.0],
)

move.invoice_date = fields.Date.from_string('2024-01-01')
self.env.flush_all()

for line in move.line_ids:
    self.assertEqual(line.date, move.date) # will fail
```

Cause
-----
The `date` of a move is a computed field dependent on the move's
`invoice_date`. The `date` of a move line is a related field, pointing
to its parent move's `date` (note: related fields are computed fields).
During a flush, the system recomputes all fields that need to be. Here,
the system first processes 'account.move.date' and calls its computation
(`_compute_date`). However, the `_affect_tax_report()` call within
`_compute_date` triggers a recalculation of `account.move.line.date`,
but as this happens within `_compute_date`, the invoice lines' `date` is
recalculated using the old invoice `date`.

Fix
---
Force a recalculation of the invoice lines' dates whenever the invoice's
date is changed.

opw-3759472
opw-3875405
opw-3872006
opw-3884013

closes odoo/odoo#163530

X-original-commit: e9d955c5a52902cdac86c6285204c54876c68eac
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2024-04-26 18:54:36 +00:00
william-andre 0d5bf820c3 [FIX] account: update the user groupby if the engine is not compatible
When the report is updated and `groupby` is updated, we might need to
also update `user_groupby` if it was not compatible.
Followup/fix of 7d54c76aaee325449248fa698adb9e549c486ee

For instance upgrading from before to after
odoo/enterprise@d226977e19 was an issue.

closes odoo/odoo#163526

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2024-04-26 18:54:34 +00:00
Carlos RocaandAaron Bohy c6b0248b5f [FIX] web: SearchView of many2one is not getting the form domain
Steps to reproduce the problem:

1. Add a many2one field to lines of a model, example: sale.order.line
2. Add it to form view of the lines with a domain
3. Click on Search more... option
4. You will see results out of the scope of the domain

In the getDomain is passed an object that has only the key
fieldName but for knew in what view is the field placed
it needs to be provided the key viewType, this both are placed
on the class object this.recordParams builded at:
https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L129

If this key is not provided the viewType is beeing filled
with the element viewType, this element is the record opened placed
in the parent view, so by default if will be kanban or list. So
if the domain is filled just in the form view, the search panel
will get the domain [], so all the entries will be displayed and
they will be able to be selected.

If we see the next line:
https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L431
We will see that getContext is getting this.recordParams as
argument, for the same reason that the domain should have it.

With this changes the getDomain method is getting the viewType
to take the domain instead of the viewType of the lines displayed
on the parent view.

closes odoo/odoo#163513

X-original-commit: 1eef2e8711124df9cbe7373ef6056b51f1b2617c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2024-04-26 18:54:33 +00:00
Jeremy Kersten eb7ea22ea0 [FIX] hr_recruitment: synchro of data between partner and hr.applicant
Previously, when receiving a new email to create a job applicant for an
existing partner, the process would inadvertently erase the phone and
mobile numbers on the partner by using the inverse method.

With this commit, the behavior is adjusted so that phone numbers are only
written in the inverse method on the partner if there is a number present on
the applicant. This prevents the inadvertent removal of phone numbers on the
 partner when creating new applicants for existing partners.

Additionally, this commit ensures that phone numbers from the partner are
computed on the applicant as if they were related non-stored fields. This
avoids the need for manual re-encoding of numbers later and prevents the
inverse method from being forced again.

Furthermore, to optimize the process, email changes are now only processed
using the inverse method if the normalized version of the email is different.
This prevents unnecessary method calls on the highly used res.partner model
when the email is updated, particularly for cases where the normalized version
remains the same.

Previously, changing the partner's email from `jke@odoo.com` to
`"JKE" jke@odoo.com` would resend all waiting sign requests because the
normalized versions of the email were distinct. While ideally, this check could
be performed within the sign request code itself, this optimization now helps
prevent unnecessary overrides across all modules simultaneously.

closes odoo/odoo#163495

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-04-26 17:18:06 +00:00
Rémi Rahir (rar) 9997989926 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/065ac988c [REL] 17.0.20
https://github.com/odoo/o-spreadsheet/commit/3046eb22d [FIX] evaluator: Prevent incorrect invalidation of spread Task: 3883954
https://github.com/odoo/o-spreadsheet/commit/d28b9b48a [FIX] borders: wrong borders on remove rows Task: 3884112
https://github.com/odoo/o-spreadsheet/commit/a54fa7fb0 [PERF] evaluation: faster dependencies checking Task: 3874821
https://github.com/odoo/o-spreadsheet/commit/9d7385612 [IMP] helpers: backport recompute zone
https://github.com/odoo/o-spreadsheet/commit/17b354804 [FIX] dataValidation: Display suggestions on dv-icon click Task: 3872312
https://github.com/odoo/o-spreadsheet/commit/c917ca566 [FIX] tests: rewrite autocomplete test

closes odoo/odoo#163477

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-04-26 17:18:05 +00:00
Djamel Touati fb16a3411e [FIX] stock: don't check 'scrap' move when validating picking
Steps to reproduce the bug:
- Create a storable product “P1”.
- Update its quantity to 10.
- Create a delivery picking:
    - Add the product “P1” with 10 units.
    - Mark as to do.
    - Scrap 1 quantity of “P1”.
- Try to validate the picking.

Problem:
A wizard asking to create a backorder is triggered. This occurs because
the move of the scrap is created, linked to the picking, and marked as
'done' (so, picked). Therefore, when validating the picking, we will
checks if all the moves are picked (Even if not picked, it will
work because we'll set them all to 'picked'). but as the first move is
not picked and the scrap one is picked, the backorder wizard is raised.

**opw-3821869**

closes odoo/odoo#163395

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-26 17:18:03 +00:00
Laurent Smet 5f017682c1 [FIX] base: Allow report with duplicated res_ids
In stock, you would print multiple times the same lot label.
In this scenario, the rendering method get multiple times the same res_id as parameter.
However, the code is loosing track of those duplicated ids before all
streams are indexed by res_id.

closes odoo/odoo#163362

X-original-commit: fb92e991bb98e5945c57c157754ff0eba306b924
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2024-04-26 17:18:02 +00:00
Gauthier Wala (gawa) 250a616446 [FIX] l10n_syscohada,account: remake coa visible
The COA should be visible, so existing db won't crash.
Indeed, it is used in the Selection field of the config settings.
As the field does not exist, the users get an error.
We instead don't let a user apply the Syscohada template to a
company that does not already have the COA.

opw-3893013
opw-3891587
opw-3891028

closes odoo/odoo#163350

Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-04-26 17:18:01 +00:00
Walid 168ec21e6e [FIX] stock: muliple rules leadtime
Steps to Reproduce on Runbot:
- Install MRP
- Create a second warehouse
- Go to Warehouse -> Routes -> Manufacturing.
- Set the "Supplied Warehouse" to the first warehouse.
- In Inventory > Opertaions > Replenishment
- Create a new Replenishment with Manufacturing route
- click on Replenishment information (small "i" button)
- Expected singelton traceback error.

Fix:
get_lead_time in Manufacturing expects a single rule
using _get_rule to deteermine the correct rule as the
comment sugessted

opw-3838099

closes odoo/odoo#163318

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-26 17:18:00 +00:00
Gurpreet Singh e1c623127f [FIX] sale_mrp: fix picking creation issue for bom with kit type
Currently, if the product type is set to 'product' and recurring_invoice is
true, and the product has a bill of materials (BOM) with the type 'kit'
the picking was not created after the first invoice.

Producing steps:
- Create a subscription product with the type set to 'product'
- Create a BOM for that product with the BOM type set to 'kit'
- In the component, add any product with the type 'product'
- Create a sale order with the products that are created and generate an invoice
- Upon creating the next invoice for the subscription product,
  the picking was not being generated.

With this commit, we are ensuring that the picking for subscription products
is now correctly created when generating an invoice.

task-3681597

closes odoo/odoo#163243

X-original-commit: ee15fc0c45f08c1fbef9d9062041ea8ff9bb0f59
Related: odoo/enterprise#61415
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2024-04-26 17:17:57 +00:00
Pedram (pebr) 76c0b98119 [FIX] point_of_sale: prevent Order Duplication from Backend
Prior to this commit, it was possible to duplicate a PoS order from
the backend.

opw-3839287

closes odoo/odoo#163018

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2024-04-26 17:17:56 +00:00
Pedram (pebr) 5f870ed29b [FIX] l10n_fr_pos_cert: log hash string for better error investigation
This commit add the logging of hash string data. By printing the string
to hash, it becomes easier to investigate issues.

opw-3839287

Part-of: odoo/odoo#163018
2024-04-26 17:17:56 +00:00
dane@odoo.com b82a1ae38b [FIX] mail: update security rules
Since the introduction of `user_id` field, it makes sense to allow
those users to update/read/delete templates they have been assigned to.

task-3748816

closes odoo/odoo#162400

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-26 17:17:54 +00:00
Sarah Bellefroid e15c7e5442 [FIX] hr_holidays: correct name search in leave type
Currently, when requesting time off for multiple employees, the search for the leave type correspond to the search of the current user.

Steps to reproduce:
-------------------
* Go to the **Time Off** app
* Select **Configuration** > **Time Off Type**
* Create a new time off type
  * Approval: By Employee's Approver and Time Off Oficcer
  * Requires allocation: Yes
  * Employee Requests: Extra Days Requests Allowed
  * Approval: Approved by Time Off Officer
  * Notified Time off officer: Mitchell Admin
* Select **Management** > **Allocations**
* Create a new allocation
  * Employees: Mitchell Admin
  * Time off time: The one created previously
* Validate the allocation
* Select **Management** > **Time Off**
* create a new time off
  * Employees: Any Employee A & Employee B
  * Time off type:
  > Observation: The new time off time is present in the name search while both employees don't have any allocation for it.

Why the fix:
------------
The name search searches for time off type with
```
['|', ['requires_allocation', '=', 'no'], '&', ['has_valid_allocation', '=', True], '&', ['max_leaves', '>', '0'], '|', ['allows_negative', '=', True], '&', ['virtual_remaining_leaves', '>', 0], ['allows_negative', '=', False]]
```
By configuration, the time off has `requires_allocation = yes` therefore it shouldn't appear here and it does not -> ok

`has_valid_allocation` has a search method `_search_valid`
https://github.com/odoo/odoo/blob/bb0cb2896236ead6b474cd1b3a685ff447716b95/addons/hr_holidays/models/hr_leave_type.py#L109-L138

`max_leaves` has a search method `_search_max_leaves`
https://github.com/odoo/odoo/blob/bb0cb2896236ead6b474cd1b3a685ff447716b95/addons/hr_holidays/models/hr_leave_type.py#L165-L192

Both use the function `_get_contextual_employee` to make their search.
https://github.com/odoo/odoo/blob/bb0cb2896236ead6b474cd1b3a685ff447716b95/addons/hr_holidays/models/hr_employee.py#L386-L388

When there are more than one employee selected on the hr leave form, the context contains `employee_id: False`. Thus here we are making the search using the current user, which is Mitchell Admin.

The search shouldn't be made using the current user in this case since he doesn't correspond to any of the employees we added of the form.

opw-3816442

closes odoo/odoo#161713

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-04-26 17:17:53 +00:00
Rémy Voet (ryv)andRenaud Thiry cd9c69bd7d [FIX] core: fix non-attachment binary fields for web_save
When bin_size=True is in the context, a computed non-attachment binary
is incorrectly saved to the database.  The row is actually updated with
the size of the binary instead of the value itself.

This commit fixes the problem by avoiding setting the cache with the
bin_size value as dirty.

Moreover, the binary size is computed with `pg_size_pretty` for
non-attachment binary fields.  Also, method compute_value() calls
b64decode() on the value that was previously encoded in base64 by
_compute_datas().  But _compute_datas() is specific to attachments, and
is not used in this case.  Thus b64decode() doesn't make sense.

These 3 bugs are now covered by testing web_save(), where cache
consistency is required. It was first reported for this method.

Closes #156673

closes odoo/odoo#160708

Signed-off-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Renaud Thiry <reth@odoo.com>
2024-04-26 17:17:52 +00:00
Rémy Voet (ryv) 76e5c6af2a [FIX] core: flush non-attachment binary fields when necessary
Non-attachment binary fields need to be flushed before reading their
size, since the latter relies on the database's binary size function.

Part-of: odoo/odoo#160708
2024-04-26 17:17:52 +00:00
Rémy Voet (ryv) b890049fda [FIX] core: cache inconsistency when assigning related resized image field
After writing or creating on a related Image field, its cache contains
the full-size image instead of the resized one (according to its
attributes max_width and max_height).  Fix the cache with the resized
image at the end of the inverse method.

Part-of: odoo/odoo#160708
2024-04-26 17:17:52 +00:00
Rémy Voet (ryv) 87a1ebb338 [FIX] core: fix create/write on binary fields
When invoking create() or write() with a binary field, the cache of the
field was incorrect if bin_size=True was in context.  Force context with
bin_size=False when putting a binary value in cache.  It is particularly
important to have coherent values in the cache for `web_save`.

Also, because an environment with bin_size=False won't return the same
context cache key as one with bin_size=None, it leads to have a cache
inconstistency when we write with bin_size=False.  Change Environment
method cache_key() to return the same cache key when bin_size is absent,
bin_size=None or bin_size=False.

Tests on binary fields have been updated to not rely on flush and
invalidate.  We also created specific tests for write() on binary
fields.

Part-of: odoo/odoo#160708
2024-04-26 17:17:52 +00:00
Rémy Voet (ryv) a0bf434960 [FIX] core: add invalidation of Environment's _cache_key.
Changing the environment in method create() to force bin_size=False
looks harmless, but it actually breaks many tests, in particular in
module account.  The reason is that company_dependent fields are read at
the wrong place in the cache.  And this is because `env._cache_key` can
be polluted with old data.

Make sure that `_cache_key` is cleared when resetting all the lazy
properties on the environment.  Only the change in res_user.py makes it
work, but let's not tempt the devil.

Side note: I hate caches.

Part-of: odoo/odoo#160708
2024-04-26 17:17:52 +00:00
AMZIL Ayoub 695ff395cd [FIX] l10n_id: adapt the check to the new VAT regulation
The issue:
Currently, in Indonesia, the regulation for tax ID is 15 digits.
But a new regulation is coming where Tax ID is now 16 digits by adding 0 in front

The fix:
Remove the first zero and leave the rest for the _run_vat_test function

Related PR: #146111

opw-3782636

closes odoo/odoo#157885

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2024-04-26 17:17:51 +00:00
Gauthier Wala (gawa) ffcf2ee1a3 [FIX] analytic: plan's applicability don't work without companies
If you create an applicability and remove the company field,
they are never used.
An applicability like this should be valid for all companies.
We put a 0.5 value for the company field so an applicability
so it has a lesser priority than other fields.
Same idea as the distribution models.

opw-3847415

closes odoo/odoo#162152

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2024-04-26 15:42:57 +00:00
qsm-odoo 16de0f70a0 [FIX] web: restore proper public widgets onFailure in old guardedCatch
Commit [1] made a mistake when adapting the guardedCatch handler.

[1]: https://github.com/odoo/odoo/commit/fcb16a3b1bd373726ffb54f0fbe41fb6d1784769

closes odoo/odoo#163486

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-04-26 10:05:21 +00:00
Victor Feyens 27ef7d571b [FIX] account,purchase,sale: wrong mail thread method signature
Since 3eb9680602, the signature of method
`_notify_by_email_prepare_rendering_context` has been changed to provide
a default values to `msg_vals` and some overrides were not adapted
(or have been added afterwards).

No true bug/issue has been found caused by that discrepancy, but for
consistency, this commit makes sure those overrides are adapted to
provide the same API as the parent method.

Fixes #162742

closes odoo/odoo#163418

X-original-commit: d4b31842d6c3e1c5c86d9019a353601914ebf1f7
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2024-04-26 10:05:20 +00:00
mega cf16b96ae0 [FIX] sale_loyalty: prevent error while remove all product quantities from cart
Currently, an error is generated when removing all product quantities from the
cart after a claiming a reward(discount).

Step to produce:

- Install a 'website_sale_loyalty' module.
- Navigate to the website / eCommerce / Loyalty / Discount & Loyalty to create
a record.
- Set the Loyalty Program name and Program Type as 'Loyalty Cards'.(Ensure it's
available on sale and the website.)
-  And add 'Rewards' and set a Reward Type as 'Discount' which is applied to
on Cheapest Product.
 - Go to the website shop add any product on a card, Open a cart increase the
 quantity of the product, and claim the discount reward.
- Again go to Loyalty Program and open Loyalty Card, Open a record and add a
Balance(greater than 200 as default reward points are 200) and copy 'Code'.
- Again go to the website shop and apply this code to claim a discount after a
claim discount.
- Now remove all product quantity from a cart.

AttributeError: 'bool' object has no attribute 'price_unit'

The issue occurs when attempting to remove all product quantities from a cart.
At this point [1], a bool value  'False' is returned, and the system attempts to
get a value of 'price_unit' from it [2].

link [1]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L187-L195

link [2]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L205

This commit resolve issue, If the _cheapest_line() method returns False then
also returns False from _discountable_cheapest(), To raise an error at [3].

link [3]:  https://github.com/odoo/odoo/blob/cbc40eccf576c499709f7825edad9a3b3ce7a22d/addons/sale_loyalty/models/sale_order.py#L317-L333

sentry-5119007021

closes odoo/odoo#163403

X-original-commit: dfd1aabb40d8c8e6e80f1b194a4b61e1dfb41608
Signed-off-by: Meet Gandhi (mega) <mega@odoo.com>
2024-04-26 10:05:19 +00:00
AMZIL Ayoub 2d2a7729a7 [FIX] account: payment error on empty default post exchange difference journal
The issue:
when you make a payment and there is an exchange difference, since the post exchange difference is not set, it will throw a traceback

To reproduce:
- Enable 2 currencies
- Have the exchange difference journal set to NULL (empty)
- Create an invoice with a different currency than the one set for the company
- then register a payment.

The fix:
Throw a user error indicating to set the post exchange difference journal

opw-3783917
opw-3768202

closes odoo/odoo#157735

Signed-off-by: John Laterre (jol) <jol@odoo.com>
2024-04-26 10:05:16 +00:00
yosa-odoo f244c5c7ef [FIX] tools: remove control characters xml
Steps to reproduce:
[account_edi_ubl_cii]
- create an invoice and set a line with on the control character https://unicode-explorer.com/b/0000
- confirm it
- try to print it

Issue:
Ugly Stack Trace

Cause:
XML does not accept such characters
```
        The characters to be escaped are the control characters #x0 to #x1F and #x7F (most of which cannot appear in XML)
        [...] XML processors must accept any character in the range specified for Char:
        `Char	   ::=   	#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]`
        source:https://www.w3.org/TR/xml/
```

opw-3773808

closes odoo/odoo#163433

X-original-commit: d06a22991cd604e46d6392f6394b2b0e6a4ae673
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-26 08:22:55 +00:00
Ugaitz Olaizola 6a90fee4c1 [FIX] l10n_es_edi_tbai, sudo on company when creating TicketBAI chain sequence for the first time.
Before this commit:

When creating the first invoice TicketBAI chain sequence does not exists therefore it is created, if user does not belong to Administration/Settings
group, an access error is raised and invoice is not posted. In the same time, a write operation is done in the company to set the value of the sequence
on l10n_es_tbai_chain_sequence_id field, and writing in a company only is allowed for users that belongs to Administration/Settings.

With this commit:

We make a sudo in self (res.company), no errors are raised, invoice is posted and TicketBAI XML file is created and posted to the agency.

closes odoo/odoo#163432

X-original-commit: 55bb16a6b5c44a86cf20f29c4cd705bb2403ae27
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-26 08:22:54 +00:00
Harsh Modi 62dc664bf8 [FIX] l10n_in: test case fix the inherited class
Before this commit:
Accidentally the test case in community inherited
class from enterprise

After this commit:
We inherit the correct class which belongs to
community

closes odoo/odoo#163399

Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-26 08:22:53 +00:00
Maximilien (malb) aec2529593 [ADD] l10n_rw: basic package
Add the basic package to the Rwanda localisation.

-COA
-Taxes
-Default settings
-Tax report
-Fiscal position

task-3584127

closes odoo/odoo#153501

Related: odoo/enterprise#57099
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2024-04-26 08:22:49 +00:00
Sven Fuehr c268543304 [FIX] l10n_co: necessary changes for EDI update to anexo 1.9
The spec for electronic invoices in Colombia was updated and is now
known as Anexo 1.9. This was done in the related enterprise PR (module l10n_co_edi).
This commit introduces some changes in the base module that are needed
for the Anexo 1.9 update.

task-3639271

closes odoo/odoo#151431

Related: odoo/enterprise#55279
Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-26 08:22:47 +00:00
Lucas Lefèvre (lul) 93e28ea102 [FIX] spreadsheet_account: fix no account match
Steps to reproduce:
- create an empty spreadsheet
- type in a cell '=ODOO.BALANCE("qsdfqsf", "02/2024")'
=> #ERROR

There's no account that match the given code.
The account.move.line domain ends up having a clause
`('account_id', 'in', [])`
The ORM detects the domain won't match anything and
early returns an empty list []

Our code expects a query object and not a list => boom

opw-3872445

closes odoo/odoo#163444

X-original-commit: 95de1332196fde7bfa5d178c6c0b7995cd892acb
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-04-26 06:49:58 +00:00
Lucas Lefèvre (lul) 4939846774 [FIX] spreadsheet_account: take correct date period
Steps to reproduce:
- in A1, type '02/2024'
- in A2, type '=ODOO.BALANCE("100", A1)'
=> the result you get come from account lines
for the day 2024/02/1 instead of the full
february month.

The value of A1 is detected as a number (first of february 2024)
When that number is given as the argument of ODOO.BALANCE,
the number falls back as being interpreted as a single day,
instead of a month period.

opw-3872445

closes odoo/odoo#163156

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-04-26 06:49:56 +00:00
Lucas Lefèvre (lul) 2a6f0b4252 [FIX] spreadsheet_account: compute value with format
This commit actually refactors the code of the accounting functions
to use `computeValueAndFormat` instead of `compute` which doesn't
receive the arguments format.

The goal is to make the actual fix in the next commit easier
to review/understant with minimal noise.

opw-3872445

Part-of: odoo/odoo#163156
2024-04-26 06:49:56 +00:00
Lucas Lefèvre (lul) 6d2f4222e4 [FIX] spreadsheet_account: take correct date period
Steps to reproduce:
- in A1, type '02/2024'
- in A2, type '=ODOO.BALANCE("100", A1)'
- right click on A2
- click the menu item "See record"
=> you end up with wrong records in the list view

The value of A1 is detected as a number (first of february 2024)
When that number is given as the argument of ODOO.BALANCE,
the number falls back as being interpreted as a single day,
instead of a month period.

opw-3872445

Part-of: odoo/odoo#163156
2024-04-26 06:49:56 +00:00