In this commit we resolve the bug that force close session when
deleting orders in a point_of_sale config. The problem was that we did
not take into account that orders can be canceled when closing
the session. This led to picking move and account move created for
canceled orders which is obviously not wanted.
Part-of: odoo/odoo#140045
*: point_of_sale
- Makes the tracking number displayed on frontend receipt (in small `Order: <tracking number>`, preserving the big `<tracking number>` title for kiosk self-order receipt).
- Fixes printing of kiosk self-order receipt after a successful Adyen payment.
closesodoo/odoo#139694closesodoo/odoo#140044
Task-id: 3570253
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Versions:
---------
- 16.0+
Steps to reproduce:
-------------------
1. install stock & purchase;
2. in Inventory settings, enable product packaging;
3. create a packaging for a product;
4. assign the packaging to the current company;
5. switch to a different company;
6. create a purchase order with the product.
Issue:
------
The packaging that gets selected automatically shouldn't be accessible
to the current company (and isn't in the drop-down). Trying to save
the form will return an access error.
Similar issues arise in `sale`.
Cause:
------
726179af78 and
ccdd113260 updated product packaging
onchange methods to computed methods, changing the environment these
fields exist to a `sudo` one. As a consequence, it includes records that
are normally inaccessible.
Solution:
---------
Use the follwing filter before calling `_find_suitable_packaging`:
```python
lambda p: p.product_id.company_id <= p.company_id <= line.company_id
```
- if `p.product_id.company_id` is set, `p.company_id` has to be set too;
- else `p.company_id` has to be `False` or equal to `line.company_id`.
opw-3457782
closesodoo/odoo#140025
X-original-commit: 05f6e91cd9babd8d65e2526a17439a7d81c65fc9
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Levi Siuzdak <sile@odoo.com>
Versions:
---------
- 16.0+
Steps to reproduce:
-------------------
1. install stock;
2. in Inventory settings, enable product packagings;
3. set the company_id of a product to current company;
4. in user settings, remove access to all other companies;
5. from the page of the edited product, add a package;
6. try to save changes.
Problem:
--------
User Error pops up due to incompatible companies on records.
Cause:
------
As of version 16.0, a field with the `groups="base.group_multi_company"`
attribute might as well not exist outside multi-company contexts,
preventing the context that automatically added a company_id to a newly
created package from working properly.
Solution:
---------
Add an invisible field containing the `company_id` with the
`groups="!base.group_multi_company"` attribute.
opw-3457782
X-original-commit: 0e4ae108cc191ca469770c456a341e455d664886
Part-of: odoo/odoo#140025
In the 'Accounting Settings' of 'Fisical Year', When the User tries to set
'February' as a month and the 29th as a Day and Save it, It will allow the user
to save but when the User opens the spreadsheet dashboard in the terminal,
same error will be generated.
Steps To Produce:-
1) Install the 'spreadsheet_account' module
2) Go to Settings -> Accounting
3) In the 'Fiscal Periods' of 'Fiscal Year', In 'Last Day' select
'February' month and set 29 as a Day
4) Go to the Accounting module, Customer->Invoices
5) In the 'Favorites', Select 'Insert Link in a Spreadsheet'.
6) Open Spreadsheet, Click on the 'Dashboard' Tab
The Error will be generated in Backend(Terminal)
Applying these changes will resolve this issue.
sentry - 4079962029
closesodoo/odoo#140011
X-original-commit: 1323829d3b5e134300f326f86c887f1cad6119f4
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Enhanced reports for better compatibility with Odoo 16.4's new Report Editor:
- Added `<div class="oe_structure"></div>` for user customization.
- Converted t-field/t-esc/t-out from div to span.
- Introduced demo data and adjusted t-if/t-else branching.
- Bundled t-if/elif/else directives for the 'condition selector' UI.
- Refactored `<t>` nodes in tables where feasible.
task-3447407
closesodoo/odoo#135739
Related: odoo/enterprise#47501
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
Steps to reproduce the bug:
- Enable product packing in inventory settings
- Create a storable product “P1”
- Update the qty with 3 package:
- Pack 1: Qty 10
- Pack 2: Qty 10
- Pack 3: Qty 20
- Product category: Force Removal Strategy: Least Packages
- Create a SO with 20 units of P1:
- Confirm → the pack 3 will be selected
- Validate the delivery
- Create another SO with 10 units of P1
- Confirm → the pack 1 will be selected
- Validate the delivery
- Create a second SO with 10 units of P1
- Confirm
Problem:
A traceback will be triggered:
return len(node.taken_packages) + node.count_remaining / qty_by_package[node.next_index][1] ZeroDivisionError: float division by zero
the issue is related to modifying the “qty_by_package” while iterating
through it. When we use “del” to remove an element, it shortens the list
in real-time. So When we remove an element, the indices of subsequent
elements get shifted, causing a skip of an element. By this why the last
element isn't iterated through correctly.
In the beginning, we have this:
[(6, 15.0), (5, 10.0), (4, 0.0), (7, 0.0)]
after iteration
[(6, 15.0), (5, 10.0), (7, 0.0)]
instead of having this
[(6, 15.0), (5, 10.0)]
Opw-3570784
closesodoo/odoo#139994
X-original-commit: cdd785981b2e7425cafbe4093ece6fdeae40c6ac
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Before this commit, the product configurator did not handle a deleted
product variant if a product variant had instantly create attribute, but
was deleted from the database.
Now, the product configurator will consider a combination `archived` if
the product variant doesn't exist (based on its id) and its create_mode
is `always`.
opw-3487571
closesodoo/odoo#139986
X-original-commit: 7abeb13ae53962694ec7fb02de133fc3d7a82908
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
Before this commit:
the scoring field was the only remaining thing in the 'Time and Scoring' Section
which is read-only when `survey_type` is set to 'survey'. so there was no point
of showing the whole section.
After this commit:
The 'Time and Scoring' Section will be invisible if `survey_type` is set to
survey'.
Task-3367524
closesodoo/odoo#139965
X-original-commit: da0927574ed93a532bb59080c7662d9d178d98cd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit fixes two bugs with the sidebar header.
Steps to reproduce the 1st bug:
- Go to "/shop" and edit the page.
- Click on the header.
- Open the header selector.
- Choose the "sidebar header".
- Bug: infinite loader (or traceback from V16).
Steps to reproduce the 2nd bug:
- Go to "/contactus" and edit the page.
- Click on the header.
- Change the "Header Position" option to "over the content".
- Save the page.
- Go to the homepage and edit the page.
- Click on the header.
- Open the header selector.
- Choose the "sidebar header".
- Save the page.
- Go to /contactus.
- Bug: the "sidebar" header is broken on the "/contactus" page.
The first bug was caused by triggering the deactivation of the "Overlay"
header from a location other than a website.page (in this case, the
"/shop" page in the steps to reproduce). In this place, the "Overlay"
header option isn't available.
However, while trying to fix this, we noticed the second bug => When we
activate the "sidebar" header (which is a general option for all pages),
we were deactivating the "Overlay" header only on the current page (this
option is specific to the page). It was done since this commit [1].
This doesn't make sense because the "Overlay" header should be
deactivated on all pages, not just the current one.
To address this in the simplest way, we modified the CSS so that the
"Overlay" header doesn't have an impact when the sidebar header is
activated. Without this change, we would have needed to add an RPC to
remove the "Overlay" header on all pages, which wouldn't have been worth
it.
[1]: https://github.com/odoo/odoo/commit/618fd49642310c7b97ef3b9e6c01f8f691c7b12f
task-3454161
closesodoo/odoo#139955
X-original-commit: b27279492fea98f2cd6bfba962bfd570e464d361
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Before this commit, a test in the "objects" test suite failed because
the 2 dates generated to verify equality could potentially be created
in a different millisecond, which would make the test fail.
A first fix simply assumed that patching the date would suffice, but
this did not solve the issue since the time advances normally even for
patched dates.
This fix ensures that the dates have exactly the same values (and
removes the patch which was not necessary anyway).
Runbot task 25596
closesodoo/odoo#139953
X-original-commit: b02d7fe6c4eaee09066cf58d0e9bad91e3a3234d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit adapts message tests to check pointer style on message author name
and author image.
closesodoo/odoo#139951
X-original-commit: 134b7cc1143faf9275683ae12c2b121ab03aed7e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when the command dropdown was open by clicking
on avatar/chat window header name, the clickable area was the same
as the rest of chat window header.
As a result, the dropdown was shown without some UI to help see the
toggler that is responsible from this dropdown.
This commit highlights the toggler of dropdown when it is open, so
that it looks nicer when the dropdown is open as we clearly see the
toggler of this dropdown.
closesodoo/odoo#139920
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
In this commit, we are changing the way prices of the components of a combo
product is calculated. The idea is that a combo product's price should behave
similarly as normal products.
This results to a simpler logic in calculating the prices of the components. In
order to get the fraction that will be used to scale the prices of the component
products, the lst_price of the combo product is divided by the total of the
pos.combo.base_price. This ratio is then multiplied to each pos.combo.base_price
to get the pro-rated unit price of each component. We then proceed to normal
calculation of taxes based on the tax configuration of the selected products.
Furthermore, we are now taking into account the extra prices from the selected
attributes. If the orderline is a component of a combo (menu) product, the extra
prices of the attributes are added on top of the prorated unit price, just like
we do with the `pos.combo.line`'s `combo_price`.
E.g.:
```
product.product.1 -> lst_price = 10
A1 -> price_extra = 5
A3 -> price_extra = 3
pos.order.line.1, product.product.1, attributes=[A1,A3]
-> price_unit = 10 + 5 + 3 = 18
```
One more thing, there is a regression in the combo configurator popup where the
total price of the selection is removed. It should be restored in the future
with calculation that properly follows the description above.
closesodoo/odoo#139915
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
When changing quantity of a menu order line (from combo product), multiple
(number of components + 1) rpcs are made. It makes sense that when incrementing
a menu order line, the components are also incremented. We, however, make the
rpc whenever one of the line's quantity is incremented. This commit extracts the
incrementer, and we only make the rpc when the incrementer method is done
incrementing all the components.
Part-of: odoo/odoo#139915
`quantity` on sm is depended on `quantity` on sml. When create new
sml, `quantity` of sm will always be 0. To fix it, we use origin sm in
the compute function to get correct value.
closesodoo/odoo#139913
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
When a user browses a website, he can visit two types of pages:
- Static page: the page is a website.page record.
- Dynamic / controller page: the page isn't a website.page (e.g. /shop).
Some options are only available on static pages, like the option to
make the header over the content. Since [this other commit], when a user
change the header template, the editor activate/deactivate an extra
options in addition to the header template change. The problem is that
this extra option may be available only on static pages, and the option
to change the header template is available on all pages.
Before this commit, if the extra option is not available, we stop the
process, the page was not reloaded and the user didn't see the new
header template. Now, we just ignore the extra option without stopping
the process, so the page is reloaded and the user see the new header.
Steps to reproduce the issue fixed by this commit:
- Go to /shop
- Edit
- Change the header template
=> The header template is not changed.
[this other commit]: https://github.com/odoo/odoo/commit/e7dcfc19298948b76caa4c214724c93854cf5f4c
task-3572277
closesodoo/odoo#139896
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
Before this commit, the `recover` parameter is used when parsing the xml
files. The issue with this, is that it will allow and parse broken XML
files, and the error messages in JS will not be related to the issue on
the broken XML.
Now, the parser is stricter, and the broken template will be replaced
with an error template with a compressive error message of the parsing
error.
closesodoo/odoo#139818
Task-id: 3420400
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Since the move_line_nosuggest_ids field has been removed, there's no alternative to show on
the detailed operations of incoming pickings. The only alternative is to show move_line_ids_without_package
at all times.
closesodoo/odoo#139907
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Before this commit, when a message is a reply to another message,
the whole row of the message reply-to was clickable to highlight the
reply-to message.
This is ok when the click happens on the actual reply-to message
above the message, but when the content of the reply-to message
is short, the click area extends to more than the "clickable" cursor
show, so that click on thread view hightlights the reply-to message
when it shouldn't.
The `cursor-pointer` style was already correctly shown only the the
actual part of the reply-to message. But the `t-on-click` was more
generous and considered the whole row in the thread view.
This commit fixes the issue by matching the `t-on-click` with the
intentional clickable area, matching the `cursor-pointer` that was
correct.
closesodoo/odoo#139906
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this revision, an employee could create a discuss channel
with whatever setup he wants.
Which is fine. The critical part is for an employee to not be able
to join an existing restricted channel.
But creating a channel is not a problem.
However, he would be able to create a channel for which
he doesn't have access, meaning he creates the channel
and then no longer see it, which is not user-friendly.
closesodoo/odoo#139903
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when a message is of type email, the button to
toggle between adjusted content style with webclient theme and the
original email style was labelled "Show Original Email" and
"Don't show original Email".
This label is confusing, as it gives the impression that this button
opens a new screen or removes a UI element. This button only alters
the visual of the message, that is the style, so the label should
be better worded to tell that.
This commit rename the label to "Show Original/Custom Format", so that
it's clearer what this button actually does.
closesodoo/odoo#139901
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
change the field name 'parent_id' to 'related_id' for the test model, since
'parent_id' is an Odoo reserved field name
add translation test for `mapped` since it uses different code from the normal
read api.
closesodoo/odoo#139819
Signed-off-by: Raphael Collet <rco@odoo.com>
Currently both incoming and outgoing emails are using the same 'email'
message_type. However both flows are not linked in any way.
Purpose of 'message_type' is to distinguish who generated the message.
In this case incoming emails are generated by the mailgateway while outgoing
emails are generated by mailins e.g. using the composer in mailing mode.
We now distinguish outgoing emails from incoming emails by using a specific
type for outgoing emails. Addons are updated accordingly.
Default 'message_type' value when removing sms/snailmail/whatsapp is now
'comment' instead of 'email', as default value of messages should be
comment as discuss is the main source of messages.
Task-3285720
closesodoo/odoo#139814
Related: odoo/enterprise#49597
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit contains the following changes:
- Mobile view for devices with a width under 'SIZE.MD'
- Align mobile view bottom buttons
- Reduce size of category bar when images
closesodoo/odoo#139686
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
tl;dr : it may be smaller in the SCSS file, but definitely not in the
generated CSS file. Do'nt repeat want can be set once.
These changes result in roughly 130KB gain in the backend bundle.
Follow-up of https://github.com/odoo/odoo/pull/138670
task-3546717
closesodoo/odoo#139683
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: stefanorigano (SRI) <sri@odoo.com>
Main changes:
Consolidate the relation between a sale order line and the repair
order it has created.
Before:
When a product trigger the creation of a repair order from a
sale order line, the 'Repair Request' field of the repair order
is defined by the product name.
After:
When a product trigger the creation of a repair order from a
sale order line, set the product and its quantity on the created
repair order if the product is of type storable or consumable.
Moreover, define the 'Repair Request' field of the repair order
by the description of the sale line rather than by the product
name.
closesodoo/odoo#139177
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Since the redesign of the default theme [1], `website_forum` needed to
be fine-tuned in order to fit with the other website modules.
This commit adapts the sidebar to maintain consistency with the other
website modules.
[1]: https://github.com/odoo/odoo/pull/120302
task-3559011
Part of task-3097005
closesodoo/odoo#139003
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Currently creating a record with 'is_published' being False (aka not published)
crashes when people can't publish. However 'is_published' being False is the
default value, and create should work in both cases.
It now correctly checks that published records could effectively be published.
This allows to remove a small workaround done in eLearning.
See odoo/odoo@4086f344d8 for ref.
Only failing use case would be having
def _default_is_published(self):
return True
def _compute_can_publish(self):
for record in self:
record.can_publish = self.env.user.has_group('something')
But this would not be a really valid use case: not being able to publish
but having default publish to True makes no sense: what matters is publishing
records as it gives more visibility to records, not the flag change itself.
Followup of odoo/odoo#70291
Task-3299702
closesodoo/odoo#137900
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Previously proposed formating was trying to normalize extra in one part
of the path. This means that no extra needed a placeholder.
The implementation was meant to be more generic and extendible since a
part of the logic has to be in website.
A suggestion was made to make it more restricted but explicite by
keeping the url simple in web/controllers/binary.py but adding a
controller in website to add this extra part.
The base extra direction is now in the extension, as the min part.
Initial urls:
/web/assets/{unique}/[{website_id}/][rtl/]{bundle_name}[.min].{extension}
New urls:
/web/assets/[{website_id}]/{unique}/{bundle_name}[.rtl][.min].{extension}
Managed by two routes:
/web/assets/<string:unique>/<string:filename>
/web/assets/<int:website_id>/<string:unique>/<string:filename>
Where filename is in the format {bundle_name}[.rtl][.min].{extension}
Multiple possibilities where proposed
- /web/assets/website/<int:website_id>/<string:unique>/<string:filename>
More explicit but prefixing by /website was considered
- /website/assets/<int:website_id>/<string:unique>/<string:filename>
This one is a litle painfull to match similar attachement, where
website is ignored.
- /website/<int:website_id>/assets/<string:unique>/<string:filename>
Almost accepted but subjective, and anyway two previous solution breaks
the cdn mecanism and would need a migration
- /web/assets/<int:website_id>/<string:unique>/<string:filename>
Almost accepted but subjective, and anyway two previous solution breaks
the cdn mecanism and would need a migration
This last solution was not ideal to match without unique
/web/assets/%/<string:filename> can match both
/web/assets/123456/<string:filename>
and
/web/assets/1/123456/<string:filename>
Anyway, matching without unique shouldn't be supported for al (even if
it is kind of supported with any right now) but it will work by changing
unique wildcard to a more specific one (_ * 7)
closesodoo/odoo#131353
Related: odoo/enterprise#47313
Related: odoo/design-themes#730
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
The generation inside the rendering has some drawbacks:
- `commit_assetsbundle` is needed for reports rendering because the
template rendering may generate some assets that will be accessed by
another transaction before the transaction is committed. But this
solution is not ideal since the transaction is committed in the middle
of the request
- when the first rendered page is a 404, the assets are not committed
and the page is broken.
- when starting, deleting an attachment can create a concurrent update
error and the request is retried. This will occur once per attachment
and for all worker trying to access the same resource. The whole
transaction is rollbacked, even the previously created assets bundle.
- The cold page load is a slower since there is more work to do.
- Implementing a readonly request is difficult because it could be
transformed to read write and re-executed if the assets bundle does not
exist.
Generating assets when needed solves those issues. The concurrency
when deleting an assets could still occur but only once per bundle, and
in a smaller transaction. This could be solved with a lock now that we
have more control on the transaction. The commit_assetsbundle can be
removed and 404 page should have a correct layout. The cold page load
could be a little faster because the assets bundle can be generated in
parallel requests instead of sequentially when rendering the page.
Part-of: odoo/odoo#131353