As `discuss_public_channel_template` is sandboxed for the `webclient`
the following CSS rule is not applied anymore.
```css
.o_web_client {
direction: ltr;
}
```
This commit adds it specifically for this template to reflect the
language direction in this sandboxed environment.
closesodoo/odoo#95893
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Currently, if your tooling is not up to date, the pre-commit hook will
happily just format your code with the outdated config. This is
undesirable because the next person to touch the file with an up-to-date
config will introduce a bunch of linting noice in their commit.
This commit adds some basic checking by comparing the config files and
aborting the commit if they are out of date, and suggesting a refresh
when the eslint/prettier config files have changed or a full reload if
the package.json has changed.
closesodoo/odoo#97286
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
This commit adds a refresh script which is a lightweight alternative to
the reload script in case the package.json hasn't changed but some
eslint/prettier files have been changed (new rules or ignored files).
Part-of: odoo/odoo#97286
The prefer-const rule disallows using const on variables that are never
reassigned, this improves readability by allowing the reader to know in
advance that all variables that are declared with const are never
reassigned and all variables declared with let will eventually be
reassigned.
The curly rule disallows braceless if/else, for and while which is a
rule we have thus far been enforcing by hand.
Part-of: odoo/odoo#97286
Be in another language, edit and save a record which has translatable fields.
Before this commit, there was a crash because no changes were done on the record, making
a programming error.
After this commit, we can edit and save a record with translatable fields without changes.
closesodoo/odoo#97240
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a list view, if you create a new record without
modifying it and then exit the action then your new empty record will
be saved.
This causes two problems:
- you don't want to save a new empty record
- you get a "View can't be saved" error if there is a require field
The solution is to abandon new invalid records if they have not yet
been modified.
closesodoo/odoo#97169
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The render API was confusing as mixing the access to the report and
the rendering env.
The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.
This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value
This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.
Task-id 2670865
closesodoo/odoo#91341
Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Before this commit, it is possible to have duplicate field names in an
alert translation.
How:
- enable multi-language
- go to a form view with at least one translatable field
- edit the value of that field
- click on save (the translate alert displays the field name once)
- edit the same field a second time
- click on save
Result Before:
The translate alert displays the field name twice.
Result After:
The translate alert displays the field name once.
closesodoo/odoo#97287
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Improves the odoo garbage collector for large amounts of attachments.
The odoo garbage collector takes around 20 sec to process 1000 records. In one of our deployed projects with production data, there are 790,000 records. According to our tests, each batch of 1000 records takes 20 seconds and hence the whole process is currently taking around 4 hours to complete, as shown below:
(790,000 records / 1000) * 20 sec *(1 min / 60 sec) * (1 hour / 60 min) = 4.38 hours.
Since the Odoo garbage collector routine runs periodically and currently takes more than 4 hours, this behavior is not acceptable in this application, because if there is any other app that tries to use attachments at the same time (for instance invoicing), it will not be able to do it since the Odoo garbage collector will lock the table, leading to a deadlock.
After adding the index parameter to the store_fname field the total time decreased drastically from 4 hours to 10 seconds since now each batch of 1000 k records takes only 13 ms.
closesodoo/odoo#97281
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Sometimes, no picking type match the domain, but picking_type_id is a required field.
closesodoo/odoo#97278
X-original-commit: afcad067bccc7676b4e40cc57f8d9b5792068802
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Install Documents
Open Settings > Documents, enable 'Accounting' files centralization
Configure 'Journals' with a single line
- Journal -> Vendor Bills
- Workspace -> Finance / Supplier Invoices
Now in go to Accounting>Vendor>Bills
Upload an xml representing a vendor bill, including an attachment
encoded in the <Allegati> tag
Open created bill
Traceback. The error is caused by the attachment included in the xml
registered without res_id/res_model.
In the document flow the attachment will receive a res_id, but not the
res_model, causing the traceback when retrieving the attachment
opw-2919610
closesodoo/odoo#97277
X-original-commit: 377e8eedb2ceb444d6b331debdffa17c47e4a898
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
The button should only be shown if a tokenization-capable acquirer is
enabled (or if a token already exists), but a typo made the button being
shown regardless of that (first) condition.
closesodoo/odoo#97276
X-original-commit: b301844cbdcb07b4e13186cae85257b18ca54654
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
The invoice status was badly computed since the loyalty refactor due to
the use of the wrong value when comparing to the previous state.
(to_invoice instead of to invoice)
TaskId-2936708
closesodoo/odoo#97002
X-original-commit: e88dcd26eebf0e527929a0c48e259895822cf23e
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
The mock server's mockReadGroup function would not properly compute the
value, range and domain of the returned groups for date/datetime fields.
The value should be expressed in the local timezone,
and the range/domain shoulb be expressed in UTC timezone.
Consider the following:
- a record with a datetime field of value "2016-12-14 12:34:56" (expressed in UTC)
- a user with an UTC+2 timezone offset
- a read_group with groupby "['datetime:hour']"
The corresponding group would have had the following metadata:
- value: `"12:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 11:00:00"], ["datetime", "<", "2022-12-14 12:00:00"]]`
- range: `{ from: "2022-12-14 11:00:00", to: "2022-12-14 12:00:00" }`
It now has the following valid metadata:
- value: `"13:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 12:00:00"], ["datetime", "<", "2022-12-14 13:00:00"]]`
- range: `{ from: "2022-12-14 12:00:00", to: "2022-12-14 13:00:00" }`
closesodoo/odoo#96946
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
formatDate and formatDateTime had their default 'timezone' option set to
false but this was changed to true in order to have the same behavior as
the legacy formatDate and formatDateTime functions.
Part-of: odoo/odoo#96946
Before this commit:
When the page is expanded and try to add any block with an image, try to change
the image using replace button. It lands the user at the top of the page instead
of staying image place.
After this commit:
The user will stay at the image place after clicking on replace button.
Task-2753302
closesodoo/odoo#97266
X-original-commit: da4fdd90622b1f6ba2e45e717fcb4fdde09033af
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
fields having a tooltip in the future UI.
4/ some cleanup of existing messages too
The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX
closesodoo/odoo#97279
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
When printing an invoice, the customer address
was not displayed if there was no delivery
address specified.
As the address should be displayed at the same place
than when the delivery address and customer address
are the same, we just paste the code from the related
condition.
opw-2899259
closesodoo/odoo#97248
X-original-commit: c0544097d38fae25decb096808dbbdec0cdb5c4d
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
Open Accounting>Journal Items
Select 1+ items with 0 credit/debit
Hit Actions>Automatic Entries
In the wizard choose 'Change Period', select an Accrued Account with
'reconcile' flag and confirm
Error will raise 'You are trying to reconcile some entries that are
already reconciled.'
This occurs because new entries, with 0 balance, will be created to match
the selected one. The flow include a reconciliation step in which the 0
balance will raise the error.
With this patch the problematic lines will be created but not reconciled
opw-2909058
closesodoo/odoo#97228
X-original-commit: 2433d5daec851293abcd04332dcbb589ceba92c1
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Steps to reproduce:
- Install eCommerce with product comparator
- Open the product in </shop>
- Change the product quantity
- Click on the <Enter> key
Current behavior:
En error message appears.
Expected behavior:
No error message appears.
Explanation:
The productComparison widget overrided the submit with a selector
that was not specific to the comparison so its _onFormSubmit function
could be called from other pages creating errors. To solve the issue
we add a specific class to the form and to the selector.
opw-2936994
closesodoo/odoo#97221
X-original-commit: 600e6f3c7ab10b97684fa4268ce5501a3b61e628
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
*: website_livechat
This commit is a step towards refactoring the JS of public livechat,
so that it reuses the same architecture as the code of Discuss.
This implies code that uses JS models and OWL components.
Task-2939083
closesodoo/odoo#97219
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
When a delivered product was owned by an external partner, we should not
generate any COGS line
OPW-2884211
closesodoo/odoo#96882
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
When getting the on hand quantity of a product in a specific location,
the result may be incorrect.
To reproduce the issue:
1. In Settings, enable "Storage Locations"
2. Create a storable product P
3. Update its quantity:
- 5 x P at WH/Stock/Shelf 1
4. Inventory > Reporting > Inventory Report
5. Apply the following filters:
- Product: P
- Location: WH/Stock/Shelf 1
- => There is a line with 5 x P at WH/Stock/Shelf 1, which is
correct
6. Click on Inventory at Date, set <Today>, confirm
7. Apply the following filters:
- Product: P
- Location: WH/Stock/Shelf 1
Error: There is a line for P but its on hand quantity is 0, which is
incorrect (should be 5)
In the first search, we let the ORM handle the domain conversion. When
searching for `('location_id', 'ilike', 'WH/Stock/Shelf 1')`, it will
use the `_rec_name` of the model to find the record. In case of a stock
location, its `_rec_name` is the field `complete_name`:
https://github.com/odoo/odoo/blob/94a8ad3fae914b046064bb7ce17572be8280f6e0/addons/stock/models/stock_location.py#L19
However, for the second search, when getting the on-hand quantity of the
product, we force the use of the field `name` to find the location.
Because the `name` of the searched location is "Shelf 1", using
"WH/Stock/Shelf 1" as key search will not work.
OPW-2920904
closesodoo/odoo#97187
X-original-commit: 9a651e13440d807ce3f455a3d334fa90caa3ce04
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
Add stacked option on line chart.
The option already existed in Project for burndown graph, so I exported
and adapted everything concerning stacked lines from Project to Web.
closesodoo/odoo#96833
Task-id: 2929576
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Just fixing a typo in _render_qweb_pdf_prepare_streams().
closesodoo/odoo#97182
X-original-commit: 9cf1061b9a463e67e46468b5bf83a0e2059ded77
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
*: website
Setting transformations on images is handled by the jQuery transfo
plugin. This plugin, however, also manipulates animations related css
properties allowing the plugin to work on animated images.
After closing the transformation tools these properties stay in the DOM,
preventing the animation options to work properly. Animations are not
played when previewing or selecting a choice from the dropdown list.
Instead they remain stuck in their initial keyframe.
To avoid complications from the interaction between both options, this
commit hides either option when the other is activated. Additionally,
css properties added by the transform option are cleaned, avoiding
potential interactions after the transform option is reset again.
opw-2765529
closesodoo/odoo#97137
X-original-commit: 3ac59a7f841b528a32c14a2111e7a1a7e11c830a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
In the BS5 migration, the legacy `checkbox` and `boolean_toggle` widget
were adapted but not the OWL Component.
Also, we have tweaked the old widget and the component to have better
positioning and margins.
Note:
the CSS for the print is already done in BS5
```css
@media print {
.form-check-input {
color-adjust: exact;
}
}
```
Also we change `offsetWidth` by `getBoundingClientRect().width` in
`list_renderer` to avoid inaccurate rounding in columns width's
calculation.
Lastly a `.o-checkbox` class is added to the Checkbox component for a
more universal and context independent targetting.
closesodoo/odoo#96185
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
The "pressing a specific key to confirm/cancel a popup" behavior was added but the problem was that
some popups only had one button which was either confirm or cancel. It was thus possible to close
those popups by bypassing the default behavior (e.g. possible to "cancel" a popup which only
has one button linked to an overridden confirm method and vice-versa). Also, we normalize the use of
`confirm` and `cancel` methods in the popups so that when the specifics keys are pressed, the right
behavior is executed.
closesodoo/odoo#97069
X-original-commit: a14ade59744855a9dea8b16f23a3d61eb88678de
Related: odoo/enterprise#29957
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
To make cleaner code and keep a similar API than fields, the
extractProps static method is added to the the widgets.
extractProps allows making new props out of the attrs of the widget
node.
Part-of: odoo/odoo#96843
No need to set carrier_id to False.
This is already taken care by `delivery` module since 448312173.
closesodoo/odoo#79231
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Before this commit, in a ListView, the view context was not used when
creating a record.
This caused some problems:
- the record does not use "default_" to initialise its data
- server-side required fields that are not present in the arch and
have a value given in the context return server errors
closesodoo/odoo#97165
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
We keep the statement line note when changing
the partner in reconciliation widget
Steps:
- Create a Bank Statement, a Bank Statement
Line BSL with a note (field narration)
- Save, edit, change partner on statement
line and save.
-> The note on BSL is empty
With this commit we allow narration computation
only for sale documents.
opw-2832287
closesodoo/odoo#97125
X-original-commit: 19394d1971259933c5158139c56344c9c35bdaed
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
The way the code has evolved, `create` is now no more than an
unnecessary indirection for `insert`.
This PR removes `create` and replaces its uses with `insert` directly.
closesodoo/odoo#97058
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, an error was raised when an invisible button was
found on a list view (for example, if it has a group).
Now, the invisible buttons are correctly managed.
closesodoo/odoo#96963
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
auth_totp module added user_id in session_info, but it's not in the depends of project and web_editor module.
To avoid traceback after uninstalling auth_totp module:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0'),
we should use uid instead of user_id in js code.
closesodoo/odoo#96880
X-original-commit: 81b92a61907028f71b1337b11d0d60ee98bb5775
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Steps to reproduce:
1- install sale, accounting
2- create a fiscal position fp that maps
tax inc t1 to any other tax t2
3- create a delivery product dp with t1 and mark it "can be sold"
4- create a new delivery method with dp
5- in a new sales order, choose fp, click on add delivery
6- the unit_price is wrong, it hasn't mapped t1 to t2
7- try adding the delivery as a product in a new sales order line
8- the unit_price is correct and the taxes are correctly calculated
Bug:
`_create_delivery_line` is not using the same logic used
when normally adding a sales order line although technically
delivery product is still a product
Fix:
use `_get_tax_included_unit_price` to get the correct unit_price
OPW-2806965
closesodoo/odoo#96874
X-original-commit: 03bb18d12606447faaed0de04bb83dde5de53b96
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
`_post_dispatch` is a late addition to the httpocalypse. It can be used
to alter the response object e.g. to inject headers or cookies. The
function is automatically called for regular, fallback and error
responses. On the other hand, `_dispatch` is only called when an
endpoint is matched and might not return a response in case of error.
task-2839031
closesodoo/odoo#96651
Related: odoo/upgrade#3710
Signed-off-by: Julien Castiaux <juc@odoo.com>
Step to reproduce:
- Create variants for product without grid
- Go to website
- Try to add variant of created product to wishlist
Current behaviour:
- Product ID is not properly fetched
- Product template is added to wishlist
Behaviour after PR:
- Product ID is properly fetched
- Product is added to wishlist
opw-2705883
closesodoo/odoo#96274
X-original-commit: f7ce60511c64002b84d3b4dbd66a2f52becc46fc
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit fixes following html block [1]
``` xml
<div class="fc-content">
<span class="fc-time">08:00</span>
<div class="o_event_title">Mitchel Admin - Administrator</div>
</div>
```
`rtlcss` lib changes `padding-right` to `padding-left`, which doesn't work if we
use `span` block next to `div` block, because position of the blocks are not
changed (time is still on the left side and title is on the right). Adding the
`ignore` directive solves the issue.
[1]: https://github.com/odoo/odoo/blob/4a996060e6b922fecb299eca32d6763dbb12b831/addons/web/static/src/legacy/xml/web_calendar.xml#L16-L17
opw-2925491
closesodoo/odoo#97129
X-original-commit: e6807b75e33ab3a083c84ace0b6c337e7566e64b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
Currently, when enabling watch mode on a tour the tour's timeout does
not change. This is usually an issue because:
- watch mode makes tours a bit slower, so they can timeout even
without doing anything
- trying to diagnose what's wrong, it's common to add check steps with
a long timeout or even a `debugger` statement, which trips the
python-side timeout and kills the tour
To avoid needing to remember to update the timeouts (then revert them
afterwards), just bump the timeout to 1h by default, or 10x the
original time for very long tours (e.g. qweb test suite, which
currently has a 30mn timeout).
While at it, forward the watch mode status to the client via the QS,
so we can eventually make use of it for one reason or an other.
closesodoo/odoo#96994
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Columns involving price within the downloaded e-faktur document is supposed to report prices that does not include tax.
When taxes are configured to not be included in price (account.tax field: price_include), result would be correct.
However, if the tax configurations is "Included in Price", the price columns will not respect the official e-faktur guideline. Consequently, it will also result to the discount column to be incorrect due to the calculation.
2889400
closesodoo/odoo#97049
X-original-commit: 633c89bcc00cea674f2582c25dadafb2792d9945
Signed-off-by: William André (wan) <wan@odoo.com>