Commit Graph
127809 Commits
Author SHA1 Message Date
jem-odoo ddb13a520f [FIX] sale_timesheet: propagate company
On Sales order confirmation, a project can be create. The project
company is not correctly propagated: the created project should
be in the same company as the SO.
To stay consistent, during the sold quantity conversion into the
planned hours of a task, we need to use the SO company instead of
the one of current user.

Task-1999686
2019-07-04 15:28:24 +00:00
jem-odoo 938990f698 [IMP] project: company required on task
As task can be billed, it became a important business model. To avoid mistakes in a multi company
environment, we need to make the company_id field required. Indeed shared task can be problematic
with access rights when a employee will log timesheet from another company in a task that is not in
the same company as its project.

To populate this field, we recommend to take the company of task's project, or to fallback on
the company of the user that created one.

Task-1999686
2019-07-04 15:28:24 +00:00
jem-odoo b061644e0c [IMP] sale: set company required
The sales order is a important model. Since it generates invoices and other business
documents, the company_id field should be required as the company must be propagate
to generated documents.
Moreover, a sales order without a company raises a error, and we need a company to
compute the multi currency rate.

This commit fixes that bug, by setting the company_id field required on sales order
and sale order line.

Note: we only simplify the ir.rule of sale.order, and not the one of
sale.order.line. Indeed, when creating an SOL, the creation is done
in 2 times by the ORM: first insert, then UPDATE with computed stored
fields. As company_id of SOL is a stored related, the check access rules
raises during the inconsistent state (between INSERT and UPDATE,
company_id is False).
Maybe this will be clean after the big refactoring of the ORM.

Task-1999686
2019-07-04 15:28:24 +00:00
Raphael Collet caf900e89e [FIX] *: use auth='public' in controllers that use request.env
The following trick used to work, because `sudo()` was actually making
an environment for the superuser to operate upon:

request.env[...].sudo().method(...)

It no longer works in general, since `sudo()` now makes an environment
in superuser mode but with `uid=None`!  It may still work by accident
for operations that never use `env.uid`, but is broken in general.

Using `auth='public'` fixes the problem by using the public user when no
user is available.

closes odoo/odoo#34297

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-07-04 11:32:22 +00:00
Raphael Collet 6230f72d2b [FIX] mail: avoid crashing for users without email address 2019-07-04 11:32:22 +00:00
Raphael Collet 3520eee8eb [FIX] website_form: avoid default_get() to crash by using superuser 2019-07-04 11:32:22 +00:00
Raphael Collet 3b592ef5a2 [FIX] base: create asset attachments with superuser
Stick with this convention, as it prevents regular users from manually
creating attachments that match the expected url, and screw up websites.
2019-07-04 11:32:22 +00:00
Raphael Collet bd8c760e92 [FIX] test_mail: query count 2019-07-04 11:32:22 +00:00
Raphael Collet da5021f704 [FIX] mail, hr: bypass user_has_groups() in superuser mode 2019-07-04 11:32:22 +00:00
Raphael Collet 368e9530f4 [REF] *: record.env.user._is_XXX() -> record.env.is_XXX()
Superuser mode implies `record.env.is_XXX()`.
2019-07-04 11:32:22 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
Raphael Collet 1e6c3bec2c [ADD] api: flag su on environments
The flag defines a "superuser mode" on environments, which allows to
bypass access rights without changing the current user id.
2019-07-04 09:24:23 +00:00
rhe 541012c9ea [FIX] point_of_sale: No payment methods after validating bank statement.
Before the fix, it was possible to validate a bank statement of a POS without validating the entire POS session.
After the fix it's impossible to validate the bank statement of an opened POS session. We now have an error message if we try to do it from accounting app and can't see the validate button anymore from the POS app.
TASK-ID: 2001551

closes odoo/odoo#33986

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-07-03 12:03:37 +00:00
Yannick Tivisse 7b9bf47d2e [REM] website_hr: Remove module
Useless module is useless.

closes odoo/odoo#34579

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-07-04 09:43:52 +00:00
Gert Pellin 1345a4f47e [FIX] point_of_sale: recover unpaid orders
Steps to reproduce:

Open a POS session and add an order with a few items on it, but
don't submit a payment for that order.
Exit, close and validate/post the POS session
Open another POS session

Current behavior:

The unpaid order vanished into Never Never Land, never to be
found again.

Expected behavior:

Either an error should be displayed when trying to close a
session with outstanding orders, or any open orders should
be automatically moved to the next open session. If I had
the choice, I would much prefer the second option, plus a
warning message when closing the session.

Closes https://github.com/odoo/odoo/issues/16151

TAK-ID: 1918354

closes odoo/odoo#33395

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-07-04 09:27:42 +00:00
Pierre Masereel 637d9e734d [FIX] point_of_sale: Decimal Precision access rights
Since changes made on decimal precision access rights in rev: a1eb000c93
the pos user doesn't have access anymore to decimal precision model in
read access.

So we've added the read right on this model for the pos user.
2019-07-04 07:30:28 +00:00
jem-odoo 86f5b6a926 [IMP] tools: get_timedelta helper
This commit introduces a small helper to return
a timedelta given a quantity and a time unit (day, hour,
month, ...)

Task-2024216

closes odoo/odoo#34576

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-07-04 08:19:08 +00:00
jem-odoo 01c279ced1 [IMP] tools: introduces format_time
In some module, we gonna need to display time part in name_get. So,
it is interesting to have a helper doing that for us. Time part label
depends on the language, format, and timezone.

This commit introduces this tool, based on `babel` lib like the
other helpers. Tests are provided.

Task-2024216
2019-07-04 08:16:08 +00:00
Rishabh Jadia 967040e62e [IMP] account: zip fields are now char
In fiscal position, fields from 'ZIP range' were not supporting the ZIP range with 'char' field and only support 'integer'. It was a problem in some countries like Canada.

task 1948120

closes odoo/odoo#31910

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-07-03 19:12:05 +00:00
Thibault Delavallée 3fc57893fb [IMP] test_mail: update test_mail performance counters according to current state
Also make a base performance class for some context and users in order
to lessen a big file size.

closes odoo/odoo#34547

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-07-03 11:38:49 +00:00
Jérémy Hennecart 3cc217e5a8 [IMP] website_sale_slides: improve course purchase flow and buttons
Before this task, when a customer bought a course, he was directly
redirect to the checkout process.

After this task, the customer can either Add to Cart or Buy Now
(if the Buy Now option is activated)

This commit also updated the redirection regex in website_sale_product_
configurator. When a product has an optional product, you have the possibility
to add in your cart the optional product thanks to a modal. Before, the button
"Add to Cart" was only available in the shop (/shop/), but now it is also
available on a course (/slides/). So to be redirected on the cart when we
click on the button "Proceed to Checkout" for a course, we needed to apply the
redirection also for the course.

Linked to task 1974929
Related to PR #34224

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-07-03 09:02:19 +00:00
Jérémy Hennecart 2010de60e7 [IMP] website_sale_slides: do not automatically install module
Now we can have eCommerce and eLearning without automatically willing to
sell courses. The auto_install in the manifest was also blocking the
possibility to uninstall the module. When we tried to uncheck the option for
selling course, it reinstalled it just after we had saved the change in the
settings.

Linked to task 1974929
Related to PR #34224
2019-07-03 08:51:44 +00:00
Parth Choksi 2bdff6783d [IMP] base: do not stretch partner image to a square
Before this commit when you set a partner image whose height was greater
than it's width, it used to get squeezed into a square. After this commit
we prevented partner image from being squeezed into a square.

Task ID: #1982082

closes odoo/odoo#33134

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-07-03 09:04:07 +00:00
Robot Odoo 1e69bacd46 [MERGE] integrate decimal_precision feature to base
The decimal precision feature makes sense to be an ORM feature, no need to be
in a specific module.
The limitation was also that models like res.currency were not able to use a
decimal precision as this was raised at #19668

Keep a backward-compatible signature with a warning.

Task id: 48198
Closes odoo/odoo#25467

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-03 15:11:53 +02:00
Martin Trigaux 573ccf098f [FIX] fields: implement _description_digits
Otherwise, fields_get returns the string, not the digits
Add test
2019-07-03 11:16:24 +00:00
Martin Trigaux e2bd3e328a [IMP] odoo: remove LazyCursor
Was specifically created for decimal.precision at f0646cb51b
Should no longer be needed
2019-07-03 11:16:24 +00:00
Martin Trigaux dd2fae2ead [IMP] base: remove decimal.precision.test model
It should not be a standard model but a test model
2019-07-03 11:16:24 +00:00
Martin Trigaux a1eb000c93 [IMP] base: remove read access to decimal.precision
There is no reason to interact directly with it.
The method precision_get is done in SQL and ormcached, it is better to use it
2019-07-03 11:16:24 +00:00
Mitali Patel 9d710df076 [REF] *: use the new decimal precision syntax
Since previous commit moved decimal_precision module's feature into base,
use the new syntax for fields declaration
Remove the imports to the removed module
Remove the module from dependency in manifest

sed -i "s|digits=dp.get_precision('\([A-Z a-z]*\)')|digits='\1'|" **.py
sed -i "/from odoo.tools import decimal_precision as dp/d" **py
2019-07-03 11:16:24 +00:00
Martin TrigauxandOlivier Dony 82be146954 [IMP] base: keep backward compatibility for decimal_precision
As the decimal_precision module was removed, allow code like

    from odoo.addons import decimal_precision as dp
    fields.Float(digits=dp.get_precision('Foo')

to keep working

Co-authored-by: Olivier Dony <odo@odoo.com>
2019-07-03 11:15:48 +00:00
Mitali Patel e453af0a8f [REM] decimal_precision: remove module
Remove leftover files, everything is now in base
2019-07-03 11:15:48 +00:00
Mitali Patel 0c5121a979 [IMP] decimal_precision: integrate into base
The decimal precision feature makes sense to be an ORM feature, no need to be
in a specific module

Previous syntax was
    from odoo.addons import decimal_precision as dp
    fields.Float(digits=dp.get_precision('Foo'))

and now is:
    fields.Float(digits='Foo')

Remove the possibility to have a callable method on the digits attribute (it
was only used for precision anyway) and directly retrieve the digits on the
decimal.precision model

Rename the method digits to get_digits to avoid confusion between the field
attribute when declaring a field and the method to retrieve the precision

Task id: 48198
2019-07-03 11:15:48 +00:00
Martin Trigaux 93b370c1f1 [REN] formatLang: remove ununsed special case
The formatLang method used to accept a value that has a _field parameter
This was introduced in 2010, at 6b19c64976 and is no longer used
Removed it to make the decimal_precision migration easier
2019-07-03 11:15:48 +00:00
Aaron Bohy a798daa4e7 [DOC] qweb: t-foreach: deprecate x_(all|parity|even|odd)
These variables aren't used in Odoo and can be easily computed
anyway.

Also deprecate the support of integer values for t-foreach, for the
same reason.

closes odoo/odoo#33981

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-26 10:50:26 +00:00
Florent de Labarre 02e6a8bdb8 [REF] stock: unlink of inventory adjustment allow deletion of draft and cancelled inventory adjustment
closes odoo/odoo#34469

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-07-01 07:54:48 +00:00
Sébastien Theys b540040ba2 [IMP] product: create product.template.attribute.line in batch
For 3000 lines (3 for 1000 products):
- 35s before this commit
- 22s after this commit

Gain around 30%

closes odoo/odoo#34295

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-24 09:19:59 +00:00
Priyanka Kakadiya 7194168457 [FIX] web: fixed default order issue
In a list/kanban view when applying a default_order on the view, it does not
work with favourite filter

Before this commit,
1) The default_order was not applied to the view when favourite filter is
applied
2) when default_order applied, Click on an element of the list/kanban and
then go back to the list/kanban with the breadcrumbs, default_order has been
changed.

This is because the ```_getOrderedBy ``` returns [] when favourite filter is
applied and it does not have sort value, added check if favourite has orderedBy
and has length then and only then pass orderedBy else pass undefined

After this commit,
1) default_order will be applied to the view
2) default_order will not be changed when going back through breadcrumbs

task-1922576

closes odoo/odoo#34001

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-07-02 06:55:34 +00:00
svs-odoo 1993488831 [IMP] stock: onchange on inv. line serial number
On Inventory Adjustment lines view, when you set serial number for a
tracked product, its quantity is automatically set on 1.

Task #2025397

closes odoo/odoo#34301

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-07-02 11:55:03 +00:00
svs-odoo d33b4a9a1d [IMP] stock: onchange on quant serial number
On quant view, when you set serial number for a tracked product, its
quantity is automatically set on 1.

Task #2025397
2019-07-02 11:15:18 +00:00
Aurélien Warnon 0b1b8f13e1 [IMP] survey: add attempt number on answer views
Purpose
=======

This commit adds the attempt number on the answer (= survey.user_input)
form & tree views.

The attempt number is always relative to its "pool" of attempts and
depends on the "invite_token" if specified.

ex: Attempt n° 2 / 4 (where "4" is the attempts_limit of the related survey).

closes odoo/odoo#31771

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-04-24 11:56:13 +00:00
Martin Trigaux 2e3b9f726c [IMP] base: partially revert d65969d572
As the source is not displayed, it makes sense to prefill the values with the
source. Also, English translations are now created (English should not really
be different than other languages) so it is prefilled with the src value.

closes odoo/odoo#33623

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-02 09:53:08 +00:00
Martin Trigaux 73a7534bfc [IMP] base: display field translation in a popup
The goal of this change is to allow the user to stay in the form view and edit
the translations in one go.

Generate also English translations to make the source=English a bit less true.
It was already the case for callable translations method

Adapt the test that was ambigious (verified no French translation was duplicated
but an English translation is created)
2019-07-02 09:53:08 +00:00
Robot Odoo 3910b2b293 [MERGE] mail, sms, test_mail(_full): prepare SMS refactoring
Purpose of this merge is to prepare upcoming SMS refactoring by
already pushing some tools, cleaning and tests in master.

Contained in this merge

* improvement of phonenumbers library tools and usage in SMS;
* addition of SMS test classes with tools and mocks;
* addition of SMS tests;

See sub commits for more details. Related to task 1922163.

closes odoo/odoo#34516

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-07-02 14:07:56 +02:00
Thibault Delavallée 20c10fcd19 [ADD] sms, test_mail(_full): add basic SMS tests and improve test tools
Purpose of this commit is to improve and add tools, methods and data to test
mail and SMS features. We also add tests for current implementation of SMS
feature, allowing to better understand future changes.

[ADD] test_mail_full

  * have a module depending on mail sub-applications like sms or snailmail.
    Its purpose is to check that standard mail features work effectively with
    all overrides and extra behaviors activated;
  * add a new model specific for SMS gateway, with default recipient
    computation;
  * add SMS tests for SMS module adding SMS capabilities linked to mail
    feature. This commit tests SMS feature before the upcoming refactoring
    and improvement of SMS module in community: posting with SMS and sms
    composer usage;

In test_mail

  * add necessary mobile information on test partners;
  * improve assertBusNotification that was not correctly asserting all items
    in message of bus notifications;

In sms

  * add mock for SMS sending. Purpose is to mock the connection to IAP
    services by mocking the call to IAP server. It allows to perform SMS
    tests without having to contact (and pay) for this service;
  * allow some customization when calling the SMS gateway mock to simulate
    errors and test corner cases;

Related to task 1922163
Linked to PR #34516
2019-07-02 10:44:56 +00:00
Thibault DelavalléeandPierre Rousseau db17763654 [IMP] phone_validation, sms: improve phone validation and SMS sending API
Purpose of this commit is to support more formatting options in phone tools,
to provide new API methods for phone numbers validatio. It also introduces
a method on sms.api to send SMS in batch. This one uses a new route given
in IAP services that send a batch of SMS instead of sending them one by one.

Concerning phone validation, tools are updated to correctly handle all
format supported by phonenumbers library. Indeed in addition to national
and international formatting phonenumbers library also supports E164
(international without spaces) and RFC3966 (beautification of phone numbers).
Let us support them and ease the use of our small tool methods in various
addons, notably sms.

Cleaning / check tools methods are added in phone validation module. Various
methods allow to sanitize phone numbers according to a context record and/or
some parameters. Those tools will be used in upcoming sms refactoring.

Another purpose of this commit is to add phone_validation in dependencies
of SMS application. Phone_validation module adds tools to parse and format
phone numbers and allow to replace the manual check done currently. Adding
it in dependencies of SMS does not change anything functionally as

  * library is still optional. If phonenumbers library is not installed the
    features are skipped without crashing;
  * no model is modified as it introduces only tools and a mixin. Models are
    updated in crm_phone_validation that updates lead and partner models;

Related to task 1922163
Linked to PR #34516

Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Co-Authored-By: Pierre Rousseau <pro@odoo.com>
2019-07-02 10:40:46 +00:00
Thibault DelavalléeandPierre Rousseau 566244b47b [REF] mail, sms: perform some guidelining (file move) and rename SMS composer model
Purpose is to prepare future improvements in mail and SMS module. In this
commit we apply some guidelines on XML Ids and file naming.

In mail cancel wizard code is separated from the resend one as they have
nothing in common.

More importantly ``sms.send_sms`` model is renamed to ``sms.composer`` to
avoid underscores (which is really really bad, take a look at
ir.config_parameter) and have a meaningful name.

Related to task 1922163
Linked to PR #34516

Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Co-Authored-By: Pierre Rousseau <pro@odoo.com>
2019-07-02 10:39:25 +00:00
svs-odoo 657adbe482 [IMP] stock: get back Change Product Qty. wizard
Product "Update Quantity" button can open the "Change Product Quantity"
wizard if all advanced stock options (stock locations, assign owner,
tracking by SN/LN, packaging) are disabled.

Task #2006337

closes odoo/odoo#33873

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-27 09:49:31 +00:00
svs-odoo 69185ea5d8 [IMP] stock: get back Update Quantity button
Get back the "Update Quantity" button on product views.

Task #2006337
2019-06-27 09:00:21 +00:00
svs-odoo e6bdf3e0d0 [IMP] stock: change empty quant message
Rewrites the help message displayed when no quant to make it accurier.

Task #2006337
2019-06-27 09:00:21 +00:00
svs-odoo 5b9e58321b [IMP] stock: hide quant product_id when useless
On editable list quant view, when user come from a single product (one
specific product variant, or product template with no variants), the
`product_id` field is hidden.

Task #2006337
2019-06-27 09:00:21 +00:00