Skip to content

[REF] stock_move_line: access product with sudo in _onchange_putaway_location - #127

Draft
ThomasBinsfeld wants to merge 126 commits into
16.0from
16.0-ref_stock_move_line_onchange_putaway_location_sudo_tbi
Draft

[REF] stock_move_line: access product with sudo in _onchange_putaway_location#127
ThomasBinsfeld wants to merge 126 commits into
16.0from
16.0-ref_stock_move_line_onchange_putaway_location_sudo_tbi

Conversation

@ThomasBinsfeld

Copy link
Copy Markdown
Member

DO NOT MERGE

fd-oncodna and others added 30 commits December 2, 2025 16:19
…hen sending Peppol invoices

Sending a Peppol invoice failed with an access error because the wizard reads
`account.edi.document.attachment_id`, which is restricted to system users.
Accounting users must be able to access the generated Peppol document linked
to the invoice they are sending.

Use `sudo()` when fetching the attachment.

closes odoo#238157

Signed-off-by: Antoine Dupuis (andu) <andu@odoo.com>
…tomer VAT

It is allowed to create peppol invoices to customers without VAT number (e.g. public sector).
Tested with the ecosio validator (BIS Billing 3.0.19)

closes odoo#238161

Signed-off-by: Antoine Dupuis (andu) <andu@odoo.com>
Since d0d0fa2 the Windows installer only supports 64 bit version of
the OS. It was recently noticed that when uninstalling the app with the
provided uninstaller that the app remains listed in the installed
sofwtare. Altough the directories and third party apps were correctly
cleaned and removed.

The reason is that the Odoo app registry key is still present after the
uninstall process. When a 32 bit process tries to write a registry key
in `HKLM\SOFTWARE` it's redirected by the OS to `HKLM\SOFTWARE\WOW6432Node`.

By using the `SetRegView 64` NSIS directive, the installer writes the
registry key at the right place ... but the uninstaller is lacking that
directive and thus tries to remove an unexisting key in
`HKLM\SOFTWARE\WOW6432Node`.

With this commit, the uninstaller is fixed by using the directive too.

closes odoo#238476

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Problem
---------
When two requests with the same promo code arrive at the same time,
The promo code is used several times, although it is set to single use.
This is a problem since it bypasses the condition to use the code only.
once.

The issue arises because the two requests arrive at the same time which
triggers two workers to process the data in parallel. Each worker use
the same initial data (no promo code is currently used when the requests
are received).

Solution
---------
Add a NOWAIT lock when on the program row when reading the `limit_usage`
to trigger a serialization error during the process of the second
request to make it retrigger with up-to-date data.

task-5343050
When using Ubuntu Jammy, werkzeug is version 2.0.2, which does not yet
follow RFC3986. With Ubuntu Noble, werkzeug is version 3.0.1 and has
removed url_encode. We now recommend changing to urllib.parse.urlencode
which also does not follow RFC3986.

RFC3986 is being followed in an inbetween version of werkzeug. We have
vendored the code from a version above 2.1.0, which includes the
following git pull request:
pallets/werkzeug#2320

This parser differential behavior can cause unexpected behavior. Due to
our modular system we should preserve the behavior that developers
expect. A third-party module should work regardless of differences in
the supported OS they choose to use.

opw-5172692
Backport ICE number from 18.0 to 16.0: f9d00e6

Reason: The ICE (Identifiant Commun de l'Entreprise) is an identification number assigned to businesses and legal entities for various administrative and legal purposes in Morocco. If the partner has one, it must be indicated on the invoice.

The ICE number is supposed to be put on all the invoices made to Moroccan companies, whatever the country of the company issuing those invoices. We hence add that directly into the account module.

task-4879950

closes odoo#237068

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Werkzeug's url_encode does not have consistent behavior between
versions, and gives three different result when running Odoo under
Ubuntu Jammy, Ubuntu Noble or a virtual environment.

After this commit:
Use the standard library urllib, which has consistent behavior across
versions.

opw-5187047
…records

RATIONALE

When a cascade delete occurs in DB, ORM methods are not called. More
specifically loosely connected records using res_model / res_id pair
are not removed when unlink override exists.

SPECIFICATIONS

If you post a scheduled message on a record and delete it before it is
sent, the notifications cron got blocked with `MissingError`.

Now, those notifications are simply skipped. Scheduled message is
unlinked, but no message is produced. As there is no recovery mean
no log is done either, would add useless information.

@moduon MT-7276
Task-5138556

Part-of: odoo#233071
Related: odoo/enterprise#101185
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
RATIONALE

When a cascade delete occurs in DB, ORM methods are not called. More
specifically loosely connected records using res_model / res_id pair
are not removed when unlink override exists.

SPECIFICATIONS

When a record that inherits from `mail.thread` is deleted by an
'ondelete="cascade"'' SQL constraint, its messages and notifiations
are kept in DB.

If some of those notifications is in status 'bounce' or 'exception'
it will keep being displayed to the user. However, the user won't be
able to do anything with it. Actually, if they try to, they'll get an
exception.

This fix avoids displaying failures related to non-existing records.
This clears noise and avoids situations where the user is unable to
react to their notifications.

COUNTERS

This implies additional query counters in various tests, as we add
some exists in calls, notably when messages are formated, which happens
quite frequently. Those querie are fast as they are just a direct hit
to the id field of tables.

@moduon MT-7609 OPW-4285691
Task-5138556

Part-of: odoo#233071
Related: odoo/enterprise#101185
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
RATIONALE

When a cascade delete occurs in DB, ORM methods are not called. More
specifically loosely connected records using res_model / res_id pair
are not removed when unlink override exists.

SPECIFICATIONS

If there are some activities linked to removed records, those are
fetched by systray. However when trying to set them done there is
a crash linked to posting a message on an unexisting record.

We are now defensively checking records exist. For removed records
no message is posted, and attachments are removed while removing the
activity.

Task-5138556

Part-of: odoo#233071
Related: odoo/enterprise#101185
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
RATIONALE

When a cascade delete occurs in DB, ORM methods are not called. More
specifically loosely connected records using res_model / res_id pair
are not removed when unlink override exists.

SPECIFICATIONS

Fix various use case in mail

* notifications sent for scheduled messages;
* failure notifications management;
* activities mark as done;

Task-5138556

closes odoo#233071

Related: odoo/enterprise#101185
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Verify that the user is an internal user
to avoid unexpected behavior.

task-5349128
In rare case when we would like to schedule messages without model
a variable is not defined in that scope.

closes odoo#238762

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
When running tests locally, it's really annoying (and sometimes really
jarring / surprising) to hear random beeps and boops from your
machine, especially when it's an old timey ringtone from voip.

Make it stop.

closes odoo#238882

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Steps to reproduce
===============
1. Enable reCaptcha in Settings and configure keys.
2. Go to an event and click Register.
3. Fill in the form but wait more than 2 minutes.
4. Submit the form
---> An error message is shown.

When reCaptcha was enabled on event registrations, the token was being
requested too early (during `willStart`).
Since a token is only valid for 2 minutes, users who took longer to fill out
the registration form encountered an error when submitting.

After this commit, the reCaptcha token is requested only on submitting.
This way, the token is always valid and the form can be submitted successfully,
even after several minutes.

Backport of ed691e6

closes odoo#238504

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The parser rules cannot be modified once
the parser has been instantiated.

task-5091744

closes odoo#239046

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
When a user gets deleted or archived, his signup token is not correct and
should be recomputed and resent if still required.

task-5340362
When `lower_logging` encounters a `LogRecord.args: Mapping`, it fucks
up and strips out all the values keeping only the mapping keys (as a
tuple), which then breaks when trying to format it in `LogRecord.msg`.

Fix the issue by moving the entire message munging into,
appropriately, the formatter: `getMessage` will do the `str.__mod__`
call at which point we don't need to deal with the args at all, then
`formatMessage` generates the full message line (not including the
stack traces from `exc_info` and `stack_info`, those are added in the
second half of `Formatter.format`).

https://runbot.odoo.com/odoo/error/234669

closes odoo#239410

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
closes odoo#177614

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit adds the Global Location Number (GLN) to delivery partners,
which is required to be reported during eInvoicing.

closes odoo#237591

Task: 5237220
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
Legacy payment APIs will be discontinued by 31 Dec 2025.
Backport Worldline provider to 16.0.

- Worldline payment provider was introduced in v18.0
- Worldline has now been backported to version 16.0
  and serves as the replacement for Ogone.

Affected version-16.0
task-4687593

closes odoo#215758

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
One of the changes in odoo#118332 was to let exceptions bubble up to the
interpreter in case of error, to improve the experience while running
the script locally.

This turns out to have downgraded runbot reporting significantly as it
doesn't account for stderr / log tracebacks if it got error-level (and
possibly even warning-level) logs during the run.

Hopefully get the best of both world (and shorten tracebacks slightly)
by restoring `logging.exception` at the script level but triggering an
abnormal exit for local CLI utility.

closes odoo#239995

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Fixes wrong author on portal users messages.

task-5150607
Currently the PDF is not embedded into the XML files
sent via Peppol.

This commit fixes that.
The PDF is embedded into the XML file at the point where the PDF is generated.
It (re)uses the existing logic for other account EDI formats.

opw-5405357 (among others)

closes odoo#240093

Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
This commit makes it easier to change the peppol endpoint and eas
computations for localizations

back-port of: odoo#233160

Task: 5172378
Part-of: odoo#240178
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
This commit improves the UX by displaying more intuitive placeholders
for the peppol identifier. The peppol information is also automatically
verified when important data changes.

It also adds a special case for Belgium in which we try to use the vat
number as the peppol identifier with the company registry endpoint.

back-port of: odoo#233160

closes odoo#240178

Task: 5172378
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
The \_retrieve \_product() function relies on a query with multiple domains
OR'ed together. As the search will require a LEFT JOIN with the product_template
table, the use of OR in the query prevents Postgres from utilizing indexes. This
becomes a problem in databases with a large number of products since a seq scan
would be very slow.

This commit changes the way this is done by performing separate queries instead
of a single query with multiple conditions within an OR statement. Although
this might seem a performance degradation, it actually allows these separate
queries to utilize indexes and run much faster compared to the original
approach. It also simplifies the priority logic and allows for faster early
exits compared to the original one.

This function is mainly used with EDI crons (such as PEPPOL where this problem
was noticed), which could require hundreds of product searches as it does a
search per invoice line.

Benchmarks:

Importing a peppol document of 173 invoice lines.

| Num products | Num invoice lines | Before   | After   |
| ------------ | ----------------- | -------- | ------- |
| 864873       | 173               | 868.18 s | 19.43 s |
| 397005       | 173               | 468.91 s | 20.68 s |
| 8064         | 173               | 125.08 s | 20.1 s  |
| 564          | 173               | 119.9 s  | 20.21 s |

opw-5245007

closes odoo#238853

Signed-off-by: Laurent Smet (las) <las@odoo.com>
The current call to `super()._get_proxy_identification()` was incorrect,
because the parent method expects a 'company' argument.

Steps to reproduce:
 - Configure an Italian company
 - Install l10n_it_edi
 - Attempt to set up Peppol

This triggers:
TypeError: AccountEdiFormat._get_proxy_identification() missing
1 required positional argument: 'company'

The issue occurs following the addition of account_peppol, because
before that, no other EDI format existed besides fattura_pa, so the
condition in the if clause was never triggered.

opw-5405602

closes odoo#240680

Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
Steps to reproduce:
- Insert a icon in an empty paragraph.
- Remove the inserted icon.
- The paragraph becomes unreachable.

Cause:
- When a paragraph contains only an icon, removing that icon during the delete
  process does not trigger fillEmpty. As a result, the paragraph ends up with no
  content, leaving it empty and unreachable.

Solution:
- During the delete process, after the icon is removed, call the fillEmpty
  method. This ensures that if the block becomes empty, a <br> is inserted
  inside the paragraph, keeping it accessible.

task-3540454

Part-of: odoo#237891
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
yolannsabaux and others added 30 commits March 30, 2026 12:25
…eepers

Steps to reproduce:
- log in as a user with bookkeeping access rights (and of course no "administration" rights)
- create and confirm an invoice for a Peppol-enabled partner
- open the send and print wizard and enable "Send via Peppol"

Issue:
access error

Cause:
https://github.com/odoo/odoo/blob/1682e3ababfd7639f22af036d31c8afc75ce0e0e/addons/account_edi/models/account_edi_document.py#L24-L28

opw-6022261

closes odoo#255609

Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
Ensure that the recordset is an instance of the `ir.qweb` model.

Task-6085716
This change improves error logging when receiving invoices by including
the full traceback in the logs. This provides better visibility into the
root cause and simplifies debugging by giving more context around the
error.

opw-6059877

closes odoo#256619

Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
Prevent changing a Peppol journal to a non-purchase type,
to avoid import errors when receiving Peppol invoices.

Step to reproduce:
- Setup a company with Peppol
- Change the Peppol reception journal type to non-purchase
- Try to run Peppol cron to import invoice, it fails with
  "Cannot create a purchase document in a non purchase journal"

opw-6071992

closes odoo#256823

Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
Previously, printing surveys of type scoring_without_answers omitted
participants' answers, resulting in incomplete and inconsistent reports.
This commit ensures answers are always included, regardless of survey type.

Task-5407701

closes odoo#258616

Signed-off-by: Julien Banken (jbn) <jbn@odoo.com>
Initialize a new empty git repository where you are going to vide-code
some new Odoo modules. Because the repository is empty (no addon yet)
the CLI fails with an "option --addons-path: the path <path> is not a
valid addons directory".

This makes vide-coder sad, and bigrams want vide-coders to be happy, so
drop the sanity-check and also accept empty addons.

closes odoo#256913

Signed-off-by: Krzysztof Magusiak (krma) <krma@odoo.com>
*: l10n_account_edi_ubl_cii_tests

Fix rounding issue with the early payment discount.
I used the client's setup in the test to replicate the exact problem.

opw-4245127

closes odoo#186811

closes odoo#258360

Signed-off-by: Laurent Smet (las) <las@odoo.com>
When adding peppol, we didn't know if we needed to use the 9925:BE or 0208.
Therefore, we switched between them if the endpoint was not found.
This has no more use today as we use 0208.

opw-5976574

closes odoo#258297

Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
The resulting modules should be bound to the `odoo.upgrade` package.
Side effects:
 - the loggers created inside the upgrade scripts are now in the
   `odoo.upgrade` namespace.
 - warnings raised by bad usages in upgrade scripts are now correctly
   filtered.

closes odoo#258025

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Assert the relative exclusion paths.

Task-6110104
Steps:
- Duplicate an employee.
- Check that the bank account is copied.
- Modify the bank account on the duplicated employee.
- Verify the original employee’s bank account.

Issue:
- When duplicating an employee, the bank account was copied as well, causing both
  employees to use the same account. Updating it for one also changed it for the
  other, leading to both salaries being paid to the same account.

Fix:
- Set the 'bank_account_id' field to not be copied during duplication, ensuring
  the field is cleared for the duplicated employee.

task-6093406

closes odoo#259405

Signed-off-by: Romain Carlier (romc) <romc@odoo.com>
Backport of fix in 19.0 (odoo#259844)

Prevents invitations to be triggered when adding new attendees to an event
in the past.

OPW-6125052

closes odoo#260050

Signed-off-by: Jérémy Hennecart (jeh) <jeh@odoo.com>
The sum of individual line extension amounts in UBL/CII exports can
sometimes differ from the total expected amount due to cumulative
rounding differences.

Steps to reproduce:
- Configure rounding to Round Globally
- Have a Belgium company setup
- Have a customer with Peppol enabled
- Create an invoice with many lines where each line amount
  have multiple decimals before rounding (product price
  precision raised to 4, fixed tax with 4 decimals)
- Confirm the invoice

Issue:
Discrepancy between line totals and the document total in the XML,
leading to validation failure
`[BR-CO-10]-Sum of Invoice line net amount (BT-106) = Σ Invoice line net
amount (BT-131)`

Analysis:
When generating e-invoice, we calculate the total line extension amount
from unrounded line amounts.
However, the sum of line rounded values may not equal the rounded sum
of the raw values.
This change tracks the expected rounded sum and compares it to the
actual accumulated sum. If a delta exists, it is distributed across
the lines to ensure the XML is consistent.
Minimalistic backport of d66c299

opw-5871638

closes odoo#251155

Signed-off-by: Laurent Smet (las) <las@odoo.com>
This commit removes unecessary whitespace when reading qweb attributes.
This result in nicer HTML output.

opw-6173086
Steps to reproduce:
- install payment_authorize module;
- complete a credit card payment using Authorize.net with more than 60 characters
    on any other field than first name, last name or company;
- confirm the payment.

Issue:
An error message appears.

Cause:
The Authorize.net API define the max length of information.
It is possible that some information exceeds the maximum length.
(https://apitest.authorize.net/xml/v1/schema/AnetApiSchema.xsd)

Solution:
Truncate information if the number of character is too large.

opw-6141441

closes odoo#262154

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
…sh_invoice

Part-of: odoo#267147
Signed-off-by: Josse Colpaert (jco) <jco@odoo.com>
closes odoo#267147

Signed-off-by: Josse Colpaert (jco) <jco@odoo.com>
The `_get_totp_mail_code` method must be used during MFA.

Task-6218044
Problem:
- `s_three_columns` is not rendered correctly in Outlook Desktop when
  the equal-height option is enabled.
- Button padding, border radius, and background color are not rendered
  properly in Outlook Desktop.

Solution:
- Set the `height` attribute on `td.card-body` along with `valign` so
  columns keep the same height in Outlook Desktop.
- Use `v:roundrect` to support rounded corners (`arcsize`) and
  background colors (`fillcolor`), making buttons render consistently
  with the editor in Outlook Desktop.

Steps to reproduce:
- Add the `s_three_columns` snippet with one card containing more
  content than the others.
- Add some buttons.
- Send or preview the email in Outlook Desktop.
- Observe that column heights and button styling are not rendered
  correctly.

opw-6044725

closes odoo#269274

Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
Prevent sending incomplete e-Waybill requests to the GSP server when the
dispatch and delivery pincodes are identical.

In such cases, the distance cannot be automatically determined and must be
provided explicitly. This commit adds a validation to ensure a distance is set
before generating the e-Waybill, avoiding incomplete requests and subsequent
server-side errors.

task-6234343

closes odoo#268497

Signed-off-by: Josse Colpaert (jco) <jco@odoo.com>
Monkey-patching C types is not straightforward.
It relies on changing the attributes or methods in memory
at the right address with the exact right size.
This requires the greatest caution.
A simple mistake can mess up the memory used by the Python interpreter,
and for instance lead to `SegmentationFault` exceptions
or unforeseen behaviors.

However, being able to patch C type is a very powerful tool.

With great power comes great responsibility.

`patch_c_type` is implemented with the greateast caution.
The Python C-API documentation has been thoroughly followed
and understood.
In addition, this patch has been battle tested in real
conditions.

In the end, this allows to patch unwanted behaviors
from types implemented in C.

Co-authored-by: Olivier Dony <odo@odoo.com>
Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
Co-authored-by: Mathieu Walravens <wama@odoo.com>
Fix bug introduced by commit odoo@c455663
that caused an error if an address field was not set, due to trying to
cut a False field. Now, unset fields are set to empty strings.

closes odoo#270295

Signed-off-by: anko-odoo <anko@odoo.com>
Printing the images no longer works in Firefox due to it not respecting
the script tags that are written with document.write. Therefore we need
to construct the page manually through the newer JS style with
createElement. However it was also quite clear that this function could
be improved and therefore I simply refactored it to keep the code to a
minimum.

opw-6287367
Website forms allow submitting messages to many different models, e.g.
creating a task, sending an email, etc. Upon sending an email we want
to check the signature of the request. This should be done when the
email_to field is set but also when the email_cc and email_bcc is set.

opw-6110064
Steps to reproduce:
- Create a credit note for 6units at a price of 74 for example
- Add the 2/7 with 2% early payment discount
- Confirm send the invoice with Peppol
- Try to validate the file with https://peppol-ap.test.odoo.com/filevalidator/validate

Issue:
- file is not valid

opw-6217645

closes odoo#266447

Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
opw-6332274

closes odoo#272371

Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.