Commit Graph
127728 Commits
Author SHA1 Message Date
jem-odoo 2cbbc88dab [IMP] tools: introduces format_duration
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

closes odoo/odoo#34417

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-06-28 06:51:17 +00:00
Thibault Delavallée ef7871826e [REF] mail: template: move formatting to tools
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
2019-06-28 06:51:16 +00:00
Kevin Baptiste f17655dd77 [IMP] hr_contract: Replace some contract states by kanban status
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

closes odoo/odoo#33489

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-28 06:59:32 +00:00
Christophe Simonis 5548029fb7 [MERGE] forward port branch saas-12.4 up to 5e81b18e24 2019-06-27 20:51:59 +02:00
Christophe Simonis 5e81b18e24 [MERGE] forward port branch saas-12.3 up to 0247d2f35f 2019-06-27 20:45:52 +02:00
mgh-odoo c3a609eae4 [FIX] website_form_editor: retain selection field design while saving
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

closes odoo/enterprise#4657

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>

X-port/Cherry-pick of odoo/enterprise@298a9b3a94
2019-06-27 19:59:16 +02:00
Goffin Simon 0247d2f35f [FIX] sale_coupon, sale_coupon_delivery: Wrong discount on promotion program
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
2019-06-27 19:14:28 +02:00
Christophe Simonis 6c5783bd5a [MERGE] forward port branch saas-12.2 up to 465909f0fd 2019-06-27 19:10:09 +02:00
Christophe Simonis 465909f0fd [MERGE] forward port branch 12.0 up to cd21c016b0 2019-06-27 18:01:07 +02:00
Christophe Simonis cd21c016b0 [MERGE] forward port branch saas-11.3 up to 2f2bc67c06 2019-06-27 17:24:24 +02:00
Nicolas Martinelli 52749f9a02 [FIX] payment_stripe: UserError
In case of failure at token creation, raise a proper UserError instead
of a generic traceback.

opw-2025723

closes odoo/odoo#34420

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-27 13:07:18 +00:00
Christophe Simonis 2f2bc67c06 [MERGE] forward port branch 11.0 up to b1d43cc80e 2019-06-27 14:40:32 +02:00
Christophe Simonis b1d43cc80e [MERGE] forward port branch saas-15 up to d090c92782 2019-06-27 14:25:31 +02:00
Nicolas Martinelli 7670c6c80a [FIX] pos_discount: change customer
- Enable general discounts for POS
- Create a POS session
- Add a product
- Create a general discount of 10%
- Change the customer

The discount is reset to the product price.

When changing the customer, the prices are reset:

https://github.com/odoo/odoo/blob/3b1699e02d4483913159681bf7e10839e6493244/addons/point_of_sale/static/src/js/screens.js#L1251

In the case of a global discount, the price is therefore reset to the
product price in:

https://github.com/odoo/odoo/blob/3b1699e02d4483913159681bf7e10839e6493244/addons/point_of_sale/static/src/js/models.js#L2304

To avoid this, we set the price as manually set. Conceptually, this is
indeed the case since we manually chose the percentage, therefore the
price.

opw-2009761

closes odoo/odoo#34416

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-27 11:51:54 +00:00
Christophe Simonis d090c92782 [MERGE] forward port branch saas-14 up to 1985a49b92 2019-06-27 12:41:55 +02:00
Christophe Simonis 1985a49b92 [MERGE] forward port branch 10.0 up to 5eb15c01b5 2019-06-27 12:41:15 +02:00
Nicolas Martinelli 365110e9eb [FIX] sale: no company
Avoid crash at currency conversion when no company is set on the SO

opw-2009044

closes odoo/odoo#34408

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-27 09:37:22 +00:00
Yannick Tivisse a5b08d5ea5 [MERGE] web, hr, test_website: Add multi-company tests
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
2019-06-27 11:34:29 +02:00
Priyanka Kakadiya 5eb15c01b5 [FIX] base, web: missing extension on binary downloads
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

closes odoo/odoo#34299

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-27 08:26:49 +00:00
lul-odoo d8f95609eb [IMP] hr: Add a multi company report printing test
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
2019-06-27 10:24:44 +02:00
lul-odoo 1c99c251c9 [IMP] 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
2019-06-27 10:24:40 +02:00
lul-odoo 7ea21adabe [IMP] 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.
2019-06-27 10:24:32 +02:00
William Henrotin fdcabf19b2 [FIX] mrp: wrong message construction
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.

closes odoo/odoo#34402

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-06-27 08:23:59 +00:00
Christophe Simonis cf18c9bae1 [MERGE] forward port branch saas-14 up to 2a89adef2a 2019-06-26 19:26:58 +02:00
Christophe Simonis 2a89adef2a [MERGE] forward port branch 10.0 up to 7b16abbae1 2019-06-26 19:26:33 +02:00
svs-odoo 0fa9c07eaa [FIX] stock: can't select undefined record
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 #2006337

closes odoo/odoo#33866

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-26 12:30:12 +00:00
Christophe Simonis b5beeb0901 [MERGE] forward port branch 11.0 up to 7742887e96 2019-06-26 13:52:44 +02:00
Nicolas Martinelli d870749d79 [FIX] l10n_fr_fec: remove new line
- 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

closes odoo/odoo#34385

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-26 11:45:57 +00:00
Nicolas Martinelli da986aa479 [FIX] l10n_fr_fec: backport fixes
Backport of:

a3519638a3
fe9e7d47b8

opw-2026861
2019-06-26 11:41:41 +00:00
Christophe Simonis d65953124c [MERGE] forward port branch saas-14 up to 61a51a8651 2019-06-26 11:15:32 +02:00
Christophe Simonis 61a51a8651 [MERGE] forward port branch 10.0 up to ea4ddff117 2019-06-26 11:12:36 +02:00
Nicolas Martinelli 6387614dca [FIX] product: create variants in multi-company
- 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

closes odoo/odoo#34369

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-26 07:21:22 +00:00
Romain Derie 762b809f71 [FIX] website_sale_delivery: adapt test to 55ed70f405
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.

closes odoo/odoo#34367

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-25 16:53:08 +00:00
Nicolas Seinlet 33f47e0ae9 [FIX] sale: larger terms and conditions field
In edit mode, the terms and condtions field is too small

closes odoo/odoo#34332

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-06-26 10:39:20 +00:00
Olivier Colson 8c7d7e0c2f [FIX] account: correct default country on new tax repartition lines
When creating a new tax, before saving, the default-computed repartition lines had no country_id associated. It only 'appeared' when saving the record.

closes odoo/odoo#34359

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2019-06-26 08:11:17 +00:00
Yannick Tivisse 88360a95f2 [FIX] hr: Add missing group on private employee model
closes odoo/odoo#34366

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-25 15:26:22 +00:00
Christophe Simonis ed40b8409b [FIX] web: avoid using unknown fields
Oversight of previous forward-port.
2019-06-25 15:37:12 +02:00
Christophe Simonis cf51b5f25d [MERGE] forward port branch saas-12.3 up to 793933a128 2019-06-25 14:23:48 +02:00
Bohdan Lisnenko 7742887e96 [FIX] http_routing: slugify_lib - max_length param should be int
closes odoo/odoo#33858

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>

closes odoo/odoo#34363

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-25 12:15:37 +00:00
Romain Derie b2eceae7c9 [IMP] website_sale: show shop category final URL in sitemap
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

closes odoo/odoo#34073

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-25 09:02:05 +00:00
jbm-odoo 9bc974c2f8 [IMP] hr_expense: Add setting to install hr_payroll_expense
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

closes odoo/odoo#32988

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-26 11:29:50 +00:00
svs-odoo 03f2096b57 [IMP] stock: product category for inventory Lines
Add `categ_id` field (related of `product_id`) in `stock.inventory.line`
model to able user to filter and group by product category.

Task #2026952

closes odoo/odoo#34349

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-26 08:58:31 +00:00
svs-odoo 68e96fbe13 [IMP] stock: allow to start inv. adj. with 0 qty
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
2019-06-26 08:58:31 +00:00
Pratima Gupta e719824271 [IMP] web: hide "Remove" button in FormViewDialog
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

closes odoo/odoo#34333

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-06-26 09:04:06 +00:00
Kevin Baptiste 83aaea9e5c [IMP] base: Add option on image widget to enable zoom
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.

closes odoo/odoo#33839

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-26 06:56:17 +00:00
Vincent Schippefilt 793933a128 [FIX] web: fix wrapping of many2one in list view
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).

closes odoo/odoo#34345

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-25 08:34:11 +00:00
William Henrotin 1c542adf86 [FIX] stock: calling 'get()' on None
This commit tests that values is not falsy before accessing a key

closes odoo/odoo#34343

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-25 08:00:30 +00:00
Christophe Simonis fbd874368a [FIX] website_sale_comparison: correct product removal from comparison list
Oversight of previous forward-port.
2019-06-24 14:48:54 +02:00
Xavier Morel 5fd75da0e9 [FIX] base: ir_rule don't not cache _compute_domain
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.

closes odoo/odoo#34330

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-24 12:29:41 +00:00
Goffin Simon 3d27337f6d [FIX] account: correct communication when registering payment for multiple invoices
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

closes odoo/odoo#34322

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-06-24 11:29:08 +00:00