Commit Graph
170826 Commits
Author SHA1 Message Date
Aaron Bohy 1a667293d5 [FIX] web: tests: fix randomly failing load state tests
Before this commit, several qunit load state tests sometimes
failed. They all follow the same pattern:
  - trigger an "hashchange" event to simulate an update of the url
  - wait twice for nextTick
  - check the DOM reflects the url change

However, waiting for 2 ticks isn't enough. Indeed, when the url
hash is set, our mock location object dispatches a "real" hashchange
event on window, but it does it after a setTimeout [1]. Then, the
webclient is notified (via the router service) of the url change,
and reacts by loading the appropriate action. This then requires
2 ticks, because we first clear the DOM with the BlankComponent,
and then we mount the requested action/view.

This commit makes those tests more robust by waiting for a
setTimeout before the 2 nextTicks.

[1] https://github.com/odoo/odoo/blob/1882d8f89f760bd1ff8a2bf0ae798939402647a3/addons/web/static/tests/setup.js#L52

Runbot issue~37030

closes odoo/odoo#162939

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-04-23 09:20:48 +00:00
Djamel Touati 94032d8d91 [FIX] purchase_requisition_stock: propagate the group_id in dropshipping
Steps to reproduce the issue:
- Create a storable product “P1”:
    - Route: dropship
    - Vendor: Azure interior and deco addict

- Create a sales order with one unit of P1
- Confirm the sales order

- A purchase order is generated with a dropship-picking
(linked to the SO)
- Create an alternative PO and confirm it

Problem:
The alternative PO is linked to the SO, but the dropship-picking is not
linked. This is because the procurement is not propagated when creating
the alternative PO.

opw-3828132

closes odoo/odoo#162815

X-original-commit: 727eae85cf532e2b7057a5645550e67875c37d62
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2024-04-23 09:20:47 +00:00
Csaba Tóth 488205d679 [FIX] website: fix recent static template typo
Recent commit [1] made a typo when converting templates

[1]: https://github.com/odoo/odoo/commit/02461534d2b74410bcdfb5cccaac8157fe806127

closes odoo/odoo#162757

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-04-23 09:20:45 +00:00
Nguyen Viet Phuong 69248626dd [FIX] hr_holidays: fix onchange _onchange_date_from
Issue: Error when the 'date_from' field is left blank.

Cause: When deleting the 'date_from' field, the onchange
'_onchange_date_from' is triggered. It will call the
'_process_accrual_plans' function and report an error as shown below:

first_level_start_date = allocation.date_from +
get_timedelta(first_level.start_count, first_level.start_type)

TypeError: unsupported operand type(s) for +: 'bool' and 'relativedelta'

Solution:
- Check the 'date_from' condition before calling next function
- Handle it only in the onchange because the 'date_from' field is
required

closes odoo/odoo#162730

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-23 09:20:44 +00:00
amdi-odoo 17d85347f9 [FIX] survey: fix demo data incoherence
Fix the demo user input lines which were considering "Pinaceae"
as a correct answer to the question "Dogwood is from which family
of trees ?" even though the suggested answer was declared as incorrect
for the question.
Dogwood is indeed from the "Cornaceae" family of trees, not the "Pinaceae".
Fixing the issue by updating the user input lines to be incorrect.

related: odoo/odoo#72298

Task-3856668

closes odoo/odoo#162886

X-original-commit: ee9ce57f4bb63d1c311d9474c26626081f333ba4
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Amélie Dieudonné (amdi) <amdi@odoo.com>
2024-04-23 07:15:07 +00:00
Walid 1882d8f89f [FIX] mrp: prevent kit product quant update
using sudo().is_kits to account for user not having access
to the bom module and boms in different companies

closes odoo/odoo#162830

X-original-commit: badd0a6dce90cc103ebc2c193e47da3f753f80a6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2024-04-22 17:04:39 +00:00
Ian de24389b43 [FIX] project: Tasks with dependencies retain state after being duplicated
Current Behavior:
Tasks with or without dependent tasks and a state not in closed states have their state changed to `01_in_progress` when duplicated.

previous PR that changed this logic: #139249

Purpose of this PR:
To retain the state of the original task when duplicated.

Steps to Reproduce in Runbot:
1) Enable Task Dependencies in Settings
2) Create a Project with Task A
3) Set state of Task A to 'Approved'
4) Duplicate Task A > Task A will now have a state of 'In Progress'

opw-3836251

closes odoo/odoo#162794

X-original-commit: a50d0317732232dad6c4b8b65c985643d0ff94b5
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-22 17:04:38 +00:00
Christophe Monniez 29fb4ac761 [FIX] base: fix similar attachments
While searching for a similar attachment, as the fallback url pattern is
the same as the url pattern, the condition is never satisfied.

With this commit, the ignore_params parameter is used to find a similar
attachment.

closes odoo/odoo#162654

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-22 17:04:37 +00:00
Aaron Bohy bfffd2ee7c [FIX] web: list: tolerate editable"1" (only in stable)
A few x2many list embedded in form views have the "editable" attr
set to "1". Normally, the valid values for this attribute are "top"
and "bottom". Regular list views are validated, but not lists
inside form views.

When set to "1", some features of the model aren't enabled. For
instance, when the current page is full and the user adds a record,
the limit isn't temporarilly increased for the added record to be
displayed on the current page, like it would be in editable="bottom"
lists, so the user doesn't see the record he just added.

The issue can be observed in the stock move form view for instance.

This commit is only good for stable versions: we add a fallback
on "bottom" s.t. if the editable attribute is set, it's always
either "top" or "bottom".

In master, we'll probably rethink the API.

opw~3860903

closes odoo/odoo#162832

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-04-22 15:28:52 +00:00
Ali Alfie (alal) 16c67c1cf1 [FIX] hr_expense: use correct partner_id in test
closes odoo/odoo#162826

Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-22 13:39:53 +00:00
Chrysanthe (chgo) 83f24391cd [FIX] web_editor: fix user avatar aspect-ratio
This commit fixes an issue occurring in the `web_editor` when multiple
users edit some content.

Prior to this commit, the user avatar was not using any aspect-ratio
rule, resulting in a stretch avatar if the uploaded image wasn't square.

This commit fixes this issue by adding the `o_object_fit_cover` class to
the image, ensuring a correct ratio no matter the format of the uploaded
image.

task-3877841

closes odoo/odoo#162810

X-original-commit: 7240fa3ff495a8aba7bd53b720e99cd767948342
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Chrysanthe Gomrée (chgo) <chgo@odoo.com>
2024-04-22 13:39:52 +00:00
nda 1b746c0e2c [FIX] calendar: allow internal users to download invitation.ics
Access rights on ir.attachment depend on the record it is linked to.

steps to reproduce:
- log as admin
- create a calendar event and invite marc demo
- log as marc demo
- check discuss notifications and try to download "invite.ics"

before this commit:
- file can not be downloaded from the webclient (access error appear in logs)

after this commit:
- file can be downloaded from the webclient

opw-3754798

closes odoo/odoo#162694

X-original-commit: 6a698ef3ee99af45251156279c9a5af6185f5dd1
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Nicolas Danhier (nda) <nda@odoo.com>
2024-04-22 13:39:50 +00:00
William Henrotin 96ac5c0770 [FIX] mrp: respect picking type option
The `use_create_components_lots` option of manufacturing picking type was never read
as the context to get the active production order was not always
specified.

Also, this field was not taken into account to display or not the
'generate serial' and import 'lot buttons'

closes odoo/odoo#162581

Related: odoo/enterprise#61137
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2024-04-22 13:39:49 +00:00
Florent de Labarre 9f3877d733 [FIX] l10_fr_fec : init line with zero balance should be not include
The FEC report contains initial balances. These representing balances on accounts from the previous period.
When calculating the initial balances, there is no requirement to include balances from the previous period for an account if they are at zero.
When there are settled transactions for many thousands of partners from the previous period, this results in many thousands of initial balance lines in the FEC report that all have a balance of zero.

This PR remove initial line with zero balance.

closes odoo/odoo#160729

X-original-commit: 1d1beaf4aa02875f1843b99564562f9ed4446ae8
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2024-04-22 13:39:47 +00:00
Arnold Moyaux 13708008ed [FIX] stock: remove mto link when product is stolen
A lot of users don't understand why they can't reserve in MTO chain after
moving a product with an immediate transfer. It's due to the double check of
_action_assign that look where the move orig stored the product and
if the quants exist in this exact location. In our case the product was
moved so the match doesn't work.

We introduce an new parameter to check if modifying the behavior on
those cases could work. When _free_reservation is call on a
`stock.move.line`, we expect to never find it at this place
anymore (except if we bring it back). Then we drop the MTO link
for this step and use the MTS reservation.

WARNING, this parameter could remove too many mto links. e.g.
There is multiple stock.move.line linked to different locations
they will lose the link for product remaining in the same place.

closes odoo/odoo#155118

X-original-commit: af41b538d89a3c59c78f65c9174c7fbf4aa43922
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2024-04-22 13:39:46 +00:00
Paolo Gatti (pgi) 26092e6972 [FIX] account: chart_template fiscal_position adjustement fix.
PR odoo/odoo#157918 has a bug on commit 8bd8d4a3eaf.
We cannot do `int(x) in Command` as it's TypeError.

closes odoo/odoo#162786

Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
2024-04-22 11:51:31 +00:00
tsm-odoo c9cfd25e3c [FIX] im_livechat: fix chatbot test page translation
This PR fixes two translation issues when launching a chat bot with a
different language than the user's:

1. Wrong translation for `question_selection` answers
2. Wrong translation for the `question_email` answers

1. The answers to a `question_selection` could be mistranslated
because the lang is missing from the context when `post_welcome_steps`
is called`. As a result, the `discuss.channel/new_message`
notification    would have the wrong answers format.

Steps to reproduce the issue:
- Go to the test chat bot test page
- Switch the website language to the one that is not used by the user.
- Check the return result of `post_welcome_steps`: answers are in the
correct language.
- Check the corresponding `discuss.channel/new_message` notification
received through the websocket: the language is the one of the user.

2. The chat bot language is not specified when calling the
`validate_email` route so the lang is the one of the user by default.

Steps to reproduce the issue:
- Go to the chat bot test page
- Activate another language than the one of the user
- Select "I have a pricing question" with no operator available
- Enter an invalid email
- The answer is in the user's language while it should not

opw-3862125

closes odoo/odoo#162655

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2024-04-22 11:51:30 +00:00
roen-odoo 6b979c6f64 [FIX] point_of_sale: correctly reconcile reversed payments
Current behavior:
When an order is invoided after the session has been closed, a reversed
payment is created. This payment is not reconciled correctly with the
invoice. This is creating an aged receivable for the partner.

Steps to reproduce:
- Change the bank payment method to "Identify customer"
- Create an order in the PoS and pay with bank and specify a partner
- Close the session
- Open the session again, and create an invoice for the order
- Go to the accounting module and look for the aged receivable report
  you should see some entries under the partner you selected.
- You can also go to the partner form and see that he has some due
  invoices.

opw-3678298

correct partner

closes odoo/odoo#162653

X-original-commit: 31aff389c4c9d01be2f960a0ae134ff658e802c9
Related: odoo/enterprise#61158
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2024-04-22 11:51:29 +00:00
william-andre cf3d3050f5 [FIX] account,l10n_be: allow to change the chart template even with demo
When in demo mode, we always want to be able to change the CoA
* to remove friction when demoing: no need to be overly safe
* to ensure that `test_all_l10n` always works even if we load a CoA
  in `<res.company>.create`

closes odoo/odoo#162299

X-original-commit: cceb4e823f7a697076615a13c2b47bc6dbdbaedb
Related: odoo/enterprise#60993
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-22 11:51:27 +00:00
Alexandre Kühn 6944eb3118 [FIX] mail: make chatter flex in Documents app
The chatter in documents was not flex, which made it take a lot
of space without any wrapping. As a result, usually chatter took
all the screen and content was massively overflowing, resulting
in poor UX.

This was caused by a specific stylerule in documents with chatter
that made sense in a earlier version of chatter CSS, but this
is no longer needed.

Also we actually want to reuse most style of chatter in form view.
This commit adds `o-mail-ChatterContainer` classname on same
HTML node as `o-mail-Form-Chatter` and adapts style, so that
Document can set this classname to reuse style.

opw-3681435

closes odoo/odoo#161940

Related: odoo/enterprise#60772
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-04-22 11:51:24 +00:00
Nguyễn Đại Dương 2d1e49d3d5 [I18N] l10n_vn: add missing translation
closes odoo/odoo#161457

Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-04-22 11:51:23 +00:00
Nguyễn Đại Dương f639de48ea [IMP] l10n_vn: add VAT exemption tax
This commit add a new tax call VAT exemption for VN accounting
-Exempt goods and services
There are stipulated categories of VAT exemptions, including certain
agricultural products; goods/services provided by individuals having
annual revenue of 100 million Vietnamese dong (VND) or below; imported
or leased drilling rigs, airplanes and ships of a type that cannot be
produced in Vietnam; transfer of land use rights (LUR) (detailed
guidance is provided to specific cases); various financial services;
various securities activities including fund management; capital
assignments; foreign currency trading; debt factoring; certain types of
insurance; medical services and elderly/disabled people care service;
postal and telecommunications provided by the Government; education,
printing/publishing, public transportation, export of unprocessed
natural resources, etc.
read more at
https://taxsummaries.pwc.com/vietnam/corporate/other-taxes
https://www.sumup.com/en-gb/invoices/dictionary/vat-exemption/

Part-of: odoo/odoo#161457
2024-04-22 11:51:23 +00:00
kpt-odoo a1c7a6a838 [FIX] payment: enhance log message for payment requests
Before this commit, the log message did not clearly indicate
who attempted to request a payment.

After this commit, the message specifies whether the payment request
was initiated by the customer or by the system.

task-3864521

closes odoo/odoo#161252

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2024-04-22 11:51:22 +00:00
Julien (jula) cf0743a679 [FIX] web_editor: prevent visible traceback from non-blocking RTC error
__Current behavior before commit:__
Sometimes the following tracebacks are popping up when an RTC connection
is being established between two users trying to edit the same document.
```log
InvalidStateError: Failed to execute 'setLocalDescription' on
'RTCPeerConnection': Called in wrong signalingState: stable
```

```log
InvalidStateError: Failed to execute 'setRemoteDescription' on
'RTCPeerConnection': Called in wrong signalingState: stable
```

__Description of the fix:__
These errors are not blocking and don't impact the successful ensuing
RTC connection. Thus, we can just catch the error and log it in the
console instead of showing it to the user.

__Steps to reproduce the issue (in 17):__
- Go to a knowledge article
- Open a new tab and open the same article
- On this new tab, quit the article and come back multiple times

Eventually a traceback will appear on one of the tab.
Note that this error seems to occur very randomly. It is similar to the
one dealt by [this commit][1] and it is probably due to a similar cause
i.e. a browser bug when the RTC connection is under stress.

It is however possible to trigger it in a more consistent way by calling
[_createClient][2] repeatedly.

opw-3778272

[1]: https://github.com/odoo/odoo/pull/158861/commits/0eca324
[2]: https://github.com/odoo/odoo/blob/a1afcc8/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js#L374

closes odoo/odoo#162709

X-original-commit: 034d45b6cde6d818755128778fdcf99dd9ff1254
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Julien Launois (jula) <jula@odoo.com>
2024-04-22 10:12:55 +00:00
William Henrotin f06da8b3c1 [FIX] stock: update quant with quantity
In case a quant for a product tracked by lot/sn exists but without any
lot/sn set and have some quantity, `_action_done()` should update it
instead of a quant with the correct lot but without any quantity

closes odoo/odoo#162683

X-original-commit: 534220ee90da3e213ea99ec5da7ce6cc9eff4203
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-22 10:12:55 +00:00
Guillaume-gdi 9d37080b6a [FIX] website: fix blog top banner latest post option
Before this commit an error appeared if a block had been set at the top
of the /blog page and the user wished to re-enable the
'Top banner - Name / Latest Post' option. This commit resolves the issue
by giving higher priority to the activated view.

Steps to reproduce the fixed bug:
- Go on /blog page
- Disable the customize option "Top banner - Name / Latest Post"
- Enter in edit mode
- Add a snippet to the top (in the oe_structure)
- Save the page
- Enable the customize option "Top banner - Name / Latest Post"

=> An error happens.

task-2774944

closes odoo/odoo#162620

X-original-commit: 5880aac0c79330e5ef62c475102d53765895cec4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2024-04-22 10:12:54 +00:00
Djamel Touati daaa255f04 [FIX] stock: use precision_rounding instead of digits with float_is_zero
Steps to reproduce the bug:
- Create a storable product “P1”
    - UoM: gram

- Create an internal picking with 0.01g of P1
- Validate the picking
- Create a return and try to validate it

Problem:
A UserError is triggered: “Please specify at least one non-zero quantity.”

When creating a return, we check if the quantity is not zero using the
“float_is_zero” function, but we mistakenly use rounding as
precision_digits.

opw-3862142"

closes odoo/odoo#162389

Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2024-04-22 10:12:52 +00:00
Mélanie d58db0d8d5 [FIX] hr_holidays : fix form design in several view
With this commit, on several form view (gantt, calendar and form view)
the status bar does not overlap and the text is no longer truncated.

closes odoo/odoo#161359

Task: 3849814
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-22 10:12:51 +00:00
arpr-odoo 6aa9439674 [FIX] web: fix trace back on set location button
Steps to reproduce:
- install `hr_homeworking`
- open calendar and click on "Set Location"
- it will give trace back (same thing can be check by installing `appointment` too)

Cause:
if condition in `onDateClick` method is missing one edge case where
`info.jsEvent` can be undefined.

Fix:
handled missing edge case in `onDateClick` method.

task-3790418

closes odoo/odoo#156861

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-22 10:12:50 +00:00
Antoine GuenetandDavid Monjoie 53cf4b4f89 [FIX] web_editor: apply padding to plain text template for Apple Mail
Most e-mail clients apply some padding around their e-mails, like
mass_mailing does in its editor. So for the plain text email template,
we mostly don't want to transfer that padding, but for Apple Mail we do
want some padding lest the e-mail be crammed in a corner. The editor's
padding was lost in conversion because the padding was applied to a
table with `border-collapse: collapse` so it was not applied (see
[mdn]).

Since we can't change that property (or layouts will be broken), our
remaining option is to wrap the layout table's contents in a `div` and
apply the padding to it instead. Since we only want this for Apple Mail,
we apply it in a nested media query, which Apple Mail is currently the
only client to support. This is the only known way to target Apple Mail
specifically but since e-mail clients tend to be remarkably slow at
adopting new technologies, this should be safe for a while.

[mdn]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse

task-3062027

closes odoo/odoo#162629

X-original-commit: bc84a40ff49cc82f1c6dd43ffddbffea6e211af0
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2024-04-22 08:27:12 +00:00
Louis (loti) d769909120 [FIX] website_sale: fix conditional display of strikethrough price
Previously, if a product had `price < list_price` and `price < compare_list_price`, but
`website_sale.group_product_price_comparison` unset, no strikethrough price was shown.
However, in that case, we should show `list_price` as the strikethrough price.

Previously, in the search dropdown, `compare_list_price` was only shown as the strikethrough
price if `price < list_price` (which is unrelated). This change make it consistent with the
product page.

opw-3845926

closes odoo/odoo#162611

X-original-commit: b4620c123b753caf2b77472a8d6c42d767471c53
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Louis Tinel (loti) <loti@odoo.com>
2024-04-22 08:27:11 +00:00
Maxime de Neuville 1733122915 [FIX] resource: update default calendar timezone on first admin login (follow-up)
Steps to reproduce:
-------------------
1. Install the resource module without demo data (or install any module which depends on it, again without demo data).
2. Login with the administrator user for the first time.
3. The default resource calendar (e.g. "Standard 40 hours/week") timezone will be set to 'UTC' by default
while it should be set to the timezone of the administrator.

Fix:
-------------------
When there is no demo data, no resource_calendar_id is linked to the admin.
In this case, we need to retrieve the record of the default working calendar and
set its timezone to the one of the admin user on the first login.

This is a follow-up of this fix: https://github.com/odoo/odoo/pull/84258

task-3793313

closes odoo/odoo#162531

X-original-commit: b280a9b2c77a1a74a0154154cb4c1cf36e5111af
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-22 08:27:10 +00:00
yosa-odoo f0172ad4b3 [FIX] l10n_it_stock_ddt: discount in ddt reports
Issue:
Discounts are not displayed in DDT

Steps to reproduce:
- create a quotation with a sale line having a discount
- smart button delivery > set qty > validate
- Print

opw-3745866

closes odoo/odoo#162287

X-original-commit: 957443d8a0f416997de9c99354c9d3ae2fb3dfbf
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2024-04-22 08:27:09 +00:00
vava-odoo 91be775b6f [FIX] base: no client action of tag 'apps'
Since 17.0, the tag `apps` of ir.action.client was removed with the
legacy code of javascript. This commit removes the only usage in
`res.config.installer` (not used in standard) to avoid a traceback at
install.

Fixes #160293

closes odoo/odoo#162228

Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2024-04-22 08:27:08 +00:00
mizosoft 588bf6b2bb [FIX] account: use proforma preview for non-printed invoices
Issue
-----

If an invoice is created, but not yet "Send & Print", the portal preview shows a normal invoice,
but when "Download"ed from the portal preview, a proforma invoice is downloaded. The download
behavior is intended since the client shouldn't be able to get a "final" invoice themselves,
before the accountant generates one with "Send & Print". However, the HTML preview should also
show a proforma invoice to be consistent with this, so the user downloads what they see.

Steps
-----

 - Create a new invoice: Accounting -> Customers -> Invoices -> New -> ...
 - Go to portal by clicking on "Preview".
 - You'll see a normal invoice. Now click "Download".
 - A proforma invoice is downloaded.

Cause
-----

The HTML-rendered invoice in the portal preview isn't configured to be proforma.

opw-3848049

closes odoo/odoo#161726

Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
2024-04-22 08:27:07 +00:00
JordiMForgeFlow c35df66c8f [FIX] purchase_stock: use correct picking when updating purchase qty
Before the fix, the picking used to create the new stock moves resulting
from changes in the purchased quantity is simply taking the first
available picking of the Purchase. This causes problems when you handle
Purchase Orders with multiple open pickings, as the correct picking to
use when the quantity is updated is not always taken.

After the fix we give priority to evaluate open pickings already related
to the line we are updating. We fallback to the same behaviour as before
is none is available.

closes odoo/odoo#161721

X-original-commit: b3335566a878fd2df29ff02023033acd3cabef70
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2024-04-22 08:27:06 +00:00
Chrysanthe (chgo) dbc760b68c [FIX] website_forum: fix spacing issues
This commit aims to fix an issue on forum posts, about comments being
placed directly next to each other without having a gap between them,
making it harder to visually recognize items at first glance.

To handle this issue, we simply add a `d-flex gap-x` utility classes
to ensure these elements receive some spacing between them.

closes odoo/odoo#155364

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-04-22 08:27:05 +00:00
Denis Ledoux 8e5dc5352c [FIX] tools: provide our own zeep Client
The API of zeep changes according to the version of zeep.

We want to limit the number of used methods and attributes
of the zeep client by our developers.
Hence, we provide our own zeep Client limited to the
attribute and method we really need.

In addition, a timeout for GET/POST requests
should be applied by default when creating a new Client,
which is not the case by default.
We override that behavior to always provide a default timeout,
and an easier API for developers wanting to change
the default timeout.
Before it was needed to import `Transport` from `zeep`,
instanciate that `Transport`, with a timeout and optionally
a session, and then pass that transport instance to the creation
of the Client.
We provide a way to directly pass these timeout parameters
through the Client constructor.

In addition, we serialize the returned values of Zeep service operation
calls, to make sure we return simple types in methods of models
e.g. bools, integers, string, ...
2024-03-29 15:35:03 +00:00
mega 67dc32b61f [FIX] l10n_id_efaktur: prevent error when download e-Faktur without tax number
Currently, the error arises when downloading e-Faktur without a 'Tax Number'.

Steps to reproduce:

- Install a 'l10n_id_efaktur' module (with demo data).
- Navigate to Invoicing -> Customers -> Invoices and open any invoice with
an empty 'Tax Number' field.
- Click on the action button to download e-Faktur.

Error:   'bool' object is not subscriptable while evaluating
'action = records.download_efaktur()'

When downloading e-Faktur, There's an issue at [1], Where
the system tries to access elements of 'l10n_id_tax_number', but
'Tax Number' is empty, So 'l10n_id_tax_number' is considered as a 'False'.

[1]: https://github.com/odoo/odoo/blob/9c4194ad3387c55d39ec7bbef1c6414893098c6e/addons/l10n_id_efaktur/models/account_move.py#L168-L170

This commit fixes the above issue by adding a condition to ensure that
the system only accesses an 'l10n_id_tax_number' if it is available.

sentry-5001664034

closes odoo/odoo#162749

X-original-commit: 24e65c2fe904e9a2a4e5004dc0e7ada220d1dacc
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-21 18:14:37 +00:00
Lucas Lefèvre (lul) 7351f4241c [FIX] documents_spreadsheet: fix See record menu if not loaded
Steps to reproduce:

- wrap a pivot function inside a IFERROR e.g. =IFERROR(PIVOT("1", "probability"), 42)
- reload the spreadsheet
- before the pivot is loaded (throttle the network in the dev tools): right click the cell
- click on "See records" menu item
=> boom

closes odoo/odoo#162759

Task: 3847477
X-original-commit: aeadd065e869a5cd6b971d6d458ba9d8e1edcc1c
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-04-21 09:42:54 +00:00
Odoo Translation Bot 459412b860 [I18N] Update translation terms from Transifex 2024-04-21 00:08:43 +02:00
66832f0ba0 [ADD] tools: patch C types, e.g. str.format
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: Denis Ledoux <dle@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
Co-authored-by: Mathieu Walravens <wama@odoo.com>
2024-03-26 16:51:36 +00:00
Paolo Gatti (pgi) 515ea2afb5 [FIX] account: Delay of account.tax.repartition_line_ids must clear
When we delay the creation of `repartition_line_ids`, the `account.tax`
gets created with default `base` and `tax` repartition lines,
which we must get rid of when we update the tax with the delayed
repartition lines.

related PR: #148370
task-3607459

closes odoo/odoo#157918

Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 5f612922c1 [IMP] l10n_it_edi_withholding: Fix use_in_tax_closing values
Withholding taxes should not be used for tax closing.
This was impossible to implement before because of the bugs addressed
in the other commits of this PR.

related PR: #148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 9829ccb997 [IMP] account: Bring naming back to sanity
`self.env.ref` -> kept of course
`deref`        -> `deref_values` as it derefers for all passed values.
`defer`        -> `delay`
`ref`          -> kept, there's no choice, it's used in too many places

Also changed some variable names in the final loop for clarity
`data`         -> `model_data`
`created_vals` -> `created_records`
`create_vals`  -> `all_records_vals`

related PR: #148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 3875c42595 [IMP] account: account_fiscal_template must support update
For `account.fiscal.position`'s submodels, REFs are not dereferenced,
they refer to virtual xmlids that only exist during import
(after account.tax.template was removed)

It should also look for: f"account.{company_id}_{template_xmlid}"

related PR: #148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 730acc1f98 [IMP] account: Added chart_template loading tests
Added chart_template loading tests for:

- evaluation of submodel fields
- import from commands in the integer form, i.e. (0, 0, {values})

related PR: #148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 0504701219 [FIX] account: Templates submodels values not evaluated
Files in the CSV templates that had submodels didn't get their values
evaluated.

Example:
`account.tax-xx.csv -> repartition_line_ids/use_in_tax_closing` was not
evaluated by `account/models/chart_template.py`'s `_parse_csv` function,
resulting in taxes having a "False" value still resulting as True.

This already affects `l10n_eg`.
In the process, code has been a little de-obfuscated.

*(This came out while testing the task linked below. Even if they're not
in the scope of the task itself, we noticed that withholding taxes have
`use_in_tax_closing` to `True` and putting them to False in the CSV had
no effect)*

related PR: #148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) 524cf0abc6 [FIX] account: Defer recursive check
This bug is generally hidden in normal localizations because the
`get_account_account` function reads `account.account-xx.csv` soon
enough to create all the needed accounts.

In `l10n_ng` there is no `account.account-ng.csv`, as it relies on the
generic_coa. The chart_template's `get_account_tax` function reads
`account.tax-ng.csv` before `get_ng_account_account` is called.

The `defer` function should check the account_tax fields and postpone
them until the creates are done, but it only checks the "first level"
and doesn't check all the way down to
`account_tax.repartition_line_ids.account_id`

By making `defer` recursive we are able to properly postpone
the creation of taxes after the accounts are made.

related PR: odoo/odoo#148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00
Paolo Gatti (pgi) ac7e0795be [IMP] account: Compute the template function only once
When making a registry of all available chart templates from exisiting modules,
the templating function is executed 5 times per Chart template instead of once.
It may not be all this relevant, but the fix is very basic.

related PR: odoo/odoo#148370
task-3607459

Part-of: odoo/odoo#157918
2024-04-20 17:39:55 +00:00