As some formatting tools already exists, it is time for float_time
conversion to have its own. Purpose is to extract formatting logic
from the float_time qweb widget to tools, in order to reuse it
in mail.template (jinja).
We named it 'format_duration', to follow babel convention. This
can bring confusion with the duration qweb widget, but this widget
should be called 'timedelta', as it is more generic than this one.
Task-2025396
closesodoo/odoo#34417
Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
This commit moves formatting helpers method used in mail.template to tools. The goal
is to reuse them anywhere in odoo, and not only in mail templates. Thoses method are
used to format date, datetime, amount, ... according to user localization (currency,
language, pattern, ...).
This commit also improve the formatting methods of 'date' and 'datetime': we are now
taking the 'lang_code' into account. Indeed, as the implementation uses `babel` lib,
it is easy and usefull to add the language option, to display the given dates into a
particular language. This parameter is optional to keep compatiblity with existing
code.
Task-2025396
Code Courtesy of @tde-banana-odoo
Purpose
=======
Having some usability check to be sure to make the pay
for everyone, and don't loose contracts.
We would like to remove incoming and to renew columns in
hr.contract and replace them by a kanban state. In employee, we would
like to add warning on the kanban to warn the hr responsible there
is no contract or a contract is about to expire
Specification
=============
hr.contract kanban:
- add a kanabn state
- it becomes red automatically when the contract is in running and expire in 7 days
- add aquick search in filter to filter on expered soon
- the kanban state can be changed manaually (in case of there is several rh)
- sort by contract end date set first (more close of today first)
Employee kanban
- add an red icon if there is no contract in Runnig status OR there is a
kanban state red in their contract (whatever the status).
- add a quick seaach on employee with warning
- State pending + green = incoming
- State confirmed + red = about to expire / to renew
closesodoo/odoo#33489
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
In case of selection or many2one field, while saving the page, the field
is re-rendered and loses the applied design changes.
This commit fixes the behavior by re-applying those changes on a newly
rendered field.
task-1961733
closesodoo/enterprise#4657
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
X-port/Cherry-pick of odoo/enterprise@298a9b3a94
Let's consider a product P with a unit price = 100€
When a price list PL with a discount of 20% was applied, and
a coupon program CP with a discount of 10% was also applied,
system still calculated the rate based on unit price of the product
and not on the discounted price.
So in this example, the amount of the CP discount was 10€ instead of
8€ because the CP discount was computed on the unit price 100€
instead of the discounted price 80€ (with 20% discount of PL)
opw:2006829
X-port/Cherry-pick of odoo/enterprise@23739e8a71
In case of failure at token creation, raise a proper UserError instead
of a generic traceback.
opw-2025723
closesodoo/odoo#34420
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Avoid crash at currency conversion when no company is set on the SO
opw-2009044
closesodoo/odoo#34408
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
test_website: Add multi-company test
=============================
Purpose
------------
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
-------------------
The website company should be automatically set in the
context as 'allowed_company_ids'.
That way, we can remove the switch company menu on the
website, which doesn't make a lot of sense.
This test enforce this behavior.
web: Add QUnit tests for the SwitchCompanyMenu
=========================================
Purpose
------------
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
------------------
Ensure the robustness of the switch company menu for
multiple cases like:
- Bar rendering
- Switch to another company in mono/multi environment
- Toggle another company in mono/multi environment
- Remove a company in mono/multi environment
The widget itself has been slighty modified to make
it more testable:
- Reading from session is now in the `willStart` function
instead of `init` to allow mocking the session (in tests,
`init` is executed before the mock is applied).
- In the event handlers, don't use `bbq` to retrieve
current allowed company ids. `bbq` is not easily nor
cleanly patched.
- When reading allowed company ids from session, cast
ids from string to integer. They are everywhere casted
except there.
and some linting
hr: Add multi company tests
======================
Purpose
-------------
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
------------------
Check that a report printing for several records on
different companies:
- Works if the context is correctly set, i.e. both
companies are in the allowed_company_ids
- Doesn't work if the context is not correctly set
It's currently possible for binary downloads to be missing an
extension entirely. Generate an extension from the mimetype and use
that. Also ensure the existing extension (if any) matches the
mimetype.
Warning: this may require adding new mimetype/extensions pairs to the
local mimetype database similar to
f413d155df.
Also fix missing or incorrect filenames on records without a filename
field: in some Odoo versions the client would send a filename of
"null", resulting in a download of e.g. "null.pdf" instead of the
attachment or inferred name.
Task 2025716
closesodoo/odoo#34299
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Purpose
=======
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
=============
Check that a report printing for several records on
different companies:
- Works if the context is correctly set, i.e. both
companies are in the allowed_company_ids
- Doesn't work if the context is not correctly set
Purpose
=======
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
=============
Ensure the robustness of the switch company menu for
multiple cases like:
- Bar rendering
- Switch to another company in mono/multi environment
- Toggle another company in mono/multi environment
- Remove a company in mono/multi environment
The widget itself has been slighty modified to make
it more testable:
- Reading from session is now in the `willStart` function
instead of `init` to allow mocking the session (in tests,
`init` is executed before the mock is applied).
- In the event handlers, don't use `bbq` to retrieve
current allowed company ids. `bbq` is not easily nor
cleanly patched.
- When reading allowed company ids from session, cast
ids from string to integer. They are everywhere casted
except there.
and some linting
Purpose
=======
This commit tests some behaviors with multi company
mode after changes brought by f847a46.
Specification
=============
The website company should be automatically set in the
context as 'allowed_company_ids'.
That way, we can remove the switch company menu on the
website, which doesn't make a lot of sense.
This test enforce this behavior.
The error message is built from string pieces except one that is a list.
This commit cast this list into a proper string to be able to build the
error message.
closesodoo/odoo#34402
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Before this commit, on editable quant view list, when user tries to
create a duplicate line and save it with tab or enter key, the list
tries to go to the next line. But sometime, this line was moved cause of
the refresh, so it causes a JS error and raises a traceback.
This fix avoid to try to select something in case we refresh the list.
Task #2006337closesodoo/odoo#33866
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
- Make a SO with a product that have a carriage return in its
description
- Export FEC report
The CSV contains new lines and is not correctly formatted.
opw-2026861
closesodoo/odoo#34385
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Install stock module
- Activate multi-company and variants
- Create a second company
- Create a product with 2 variants
- Create a picking with the product for both companies
- Add an attribute on the product with 2 values
- Save
An AccessError is raised on `stock.move`.
It arises because the field `product_qty` on `stock.move` must be
recomputed but is on a record in a different company.
The `try` / `except` clause doesn't protect against the recomputation.
Indeed, what happens is:
- try to unlink in batch => AccessError due to recomputation
- try to unlink individually => AccessError due to recomputation
- try to write individually => the field couldn't be recomputed before
(flagged as dirty), so try again to recompute => AccessError
We perform the operation as sudo, and take care of checking the access
rights beforehand.
opw-2009450
closesodoo/odoo#34369
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
There is a conflict in saas-12.3.
Indeed, the optional popup on a product when adding to cart got encapsulated
into a new module with 55ed70f405.
But 9308180089 introduced a new test in 12.0 about free delivery.
The tour expects the popup to be shown, but it is not the case anymore.
The tour needed to be adapted. Standard runbot was green since the test would
luckily be executed after `website_sale_product_configurator` would be
installed. That was not the case on runbot theme.
The chance is also taken to ensure the test is executed on the correct
delivery.
closesodoo/odoo#34367
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
When creating a new tax, before saving, the default-computed repartition lines had no country_id associated. It only 'appeared' when saving the record.
closesodoo/odoo#34359
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Before this commit, when an user would visit a subcategory in the ecommerce, he
would see a slugified URL, containing all the category hierarchy, which is good
for SEO purpose.
For example, if `Wheel` is a child of `Car` which is a child of `Vehicule`,
then the URL would be `/shop/category/vehicule-car-wheel-3`.
But on the sitemap, the parents would not be prefixed to the URL, thus the
sitemap would simply show `<loc>/shop/category/wheel-3</loc>`.
This commit ensure the category parents are added to the final URL of the
sitemap, as in the ecommerce.
task-1889972
closesodoo/odoo#34073
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Add a boolean field in res config settings to install hr_expense_payroll.
Add demo data to allow expense validation easily without having to create
a journal
closesodoo/odoo#32988
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Add `categ_id` field (related of `product_id`) in `stock.inventory.line`
model to able user to filter and group by product category.
Task #2026952closesodoo/odoo#34349
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Add an Inventory Adjustment field `prefill_counted_quantity`.
True by default, when it's disabled, the inventory will generate when
inventory lines with 0 as value for `product_qty` field when started.
The purpose is to make simpler the use of barcode scanner to do the
inventory adjustment.
Task #2026952
When we open any x2m record (in a FormViewDialog), there is a "Remove"
button to delete/unlink the opened record from parent.
This button is placed besides "Discard" button and it creates little
confusion in some cases. For example, in list view, there's already a
bin / 'x' icon depending on the field type using which people are used
to delete/unlink the record. And when they open a record, they might
accidentally click "Remove" button instead of "Discard".
To avoid this, now we won't show "Remove" button when we open record from
x2many list view. However, we have to keep this button in case x2many of
kanban as there's no other way to remove the record.
task-1886913
closesodoo/odoo#34333
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Purpose
=======
As the employee picture on a form view is often too small,
it should be possible to zoom on it like for products in eCommerce.
Specification
=============
Added new bool options on FieldBinaryImage: `zoom` and `background`.
`zoom` will call zoomOdoo.js and display a popup with the zoomed out
image.
`background` is used to either display the image as a div element with
a background-url (to be used e.g. in a kanban view) or as a standard
img element.
closesodoo/odoo#33839
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this fix, the many2one text in the list view was not wrapping.
After this fix, the text will wrap according to the available space
(managed automatically by the browser).
closesodoo/odoo#34345
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Following the revamp / contextualisation of multi company, the list of
allowed companies from the context is now used as part of the ir_rule
caching key.
Sadly that list is a list, and thus not hashable, meaning
_compute_domain was not cached anymore. Sadlier, type errors would be
silently ignored (just increasing the error counter of the cache stats).
Fix both issues:
* Store lists from the context as tuple. Technically could be a
frozenset but that might not always be the case so it doesn't feel
future-proof, a tuple might lead to slightly less hits but seems safer
* Log a proper warning in case of an ormcache TypeError (non-hashable
type used as cache key). It should never routinely happen.
closesodoo/odoo#34330
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
When registering a payment against multiple vendor bills and change the memo,
the memo must be populated to all the payments. This behavior has been introduced
with the following commit in stable 11.0: c04065abd8
opw:2024652
closesodoo/odoo#34322
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>