Commit Graph
124018 Commits
Author SHA1 Message Date
Romain Derie 90dec44a28 [FIX] website: restore the add of website_id on user at signup
Since b5a12b4aac the website_id was not set anymore.

Indeed, before this commit website_id was the field from the inherits, thus
when writing on website_id from res.user, we would write on the partner field.

But with b5a12b4aac the website_id was explicitely overrided on res.users as a
related to res.partner (its inherits) with readonly=True.

Thus, writting website_id on res.users was not working anymore.

closes odoo/odoo#33521

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-21 10:01:58 +00:00
Xavier Morel 7b00776c6c [FIX] doc: error & potential warnings
* properly handle 3-args version of odoo.define(): just ignore the
second argument, pretty much the only use-case is dynamic
dependencies (otherwise it should be using static require() calls)
so there's little the extractor can do
* fix an issue with sys.path ordering meaning sphinx would pick up an
odoo installed into the current virtualenv (editable or not) over
the local copy it's part of

closes odoo/odoo#33538

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-05-21 14:19:13 +00:00
Toufik Ben Jaa 72592750a7 [FIX] payment: do not shadow error traceback
- When validating payments on the payment process polling page
errors can occurs and the tracebacks aren't logged which doesn't help
when trying to understand the issues.

With this commit we display the traceback instead of shadowing them.

closes odoo/odoo#33537

Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2019-05-21 14:16:25 +00:00
jev-odoo 6d88041260 [FIX]doc_howtos_backend: typo in classname
closes odoo/odoo#33518

Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
2019-05-21 09:46:59 +00:00
Sébastien Theys 51ef8514ea [FIX] product,sale,website_sale: compute combination possible in rpc
This has several advantages:
- make the code easier to maintain by having the logic only on the python model
- prevent price flickering when changing from/to an impossible combination
- fix the UI for the issue mentioned in the previous commit/the opw
- make the code much faster when using many combinations, by not requiring to
browse and to return every existing and every archived variants

The opportunity is also taken to properly throttle the rpc and to use
"DropMisordered" on its result:
- fix all the other remaining flickering when changing quantity or combination
- fix the server being spammed of rpc when using the configurator modal, but
also in a lot of other cases such as incrementing the quantity, ...
- fix UI consistency by ensuring the result of the last rpc is always the one
displayed, obsolete rpc returns are ignored

By computing the possibility of the combination asynchronously, the two
drawbacks are:
- the UI is a bit less reactive than in the previously the best case scenario,
but this almost completely mitigated by debouncing with a leading call
- it is possible for a quick user to click on "add to cart" on an impossible
combination before the return of the rpc, but this is not really an issue
because when the product will be added to cart there will a check and the
closest possible combination will be selected automatically instead

Finally the event of the configurator mixin and the widgets using it have been
cleaned to avoid the duplication of the rpc in the first place.

opw-1959317
PR: #32691

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-21 10:11:38 +00:00
Sébastien Theys 42cc64b5ce [FIX] product: fix possible combination with variant active + archive
Before this commit, if multiple variants exist for the same combination it would
consider the combination impossible if any of the variants was archived.

After this commit, it will consider the combination impossible only if all the
corresponding variants are archived.

opw-1959317
PR: #32691
2019-05-21 08:44:55 +00:00
Sébastien Theys e015ee5df3 [FIX] website_sale: fix infinite recursion from product configurator
When the configurator modal is shown on the shop page (when the add to cart
button customize show is enabled), changing the quantity would trigger an
infinite recursion before this commit, because the selector was not finding the
input on the page (because it is not there), but it was not restrictive enough
so it matched the input on the modal itself.

PR: #32691
2019-05-21 08:44:46 +00:00
Julien CastiauxandRaphël Collet be5f07c612 [FIX] calendar: Cannot create 'free' event with reminder
Install CRM (we need the "Hide Private Message" record rule defined by
that module), create a meeting as of today, set a reminder of one day,
invite another user (Demo) as attendee, save. Edit, go to the options,
change the "Show time as" to "free", save => access error due to the
said record rule.

The reminder is handled by the `get_next_potential_limit_alarm` method
of the `calendar.alarm_manager` model. It uses a raw SQL query to
perform its search. It returns a dictionary of the different events with
data attached. Due to the "Hide Private Message" record rule, some
records are not accessible.

Original (reverted) 9c4b52000 fix was replacing the `browse` by a `search`
in order to filter out non-accessible records. That fix was later fine
tuned by (not-merged) 7dd93809c to exclude calendar's virtual ids. The
real fix is to filter out records in the original result dict.

opw-1974599

closes odoo/odoo#33209

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


Co-authored-by: Raphël Collet <rco@odoo.com>
2019-05-15 11:41:21 +00:00
Priyanka Kakadiya 8ffedf4545 [FIX] sale: fix search issue in settings
Before this rev., we searched for 'label' tagname into the DOM, but
the fields labels are not always inside <label> (sometimes <span>).

However, they always have className 'o_form_label', so we use this
instead.

task 1961427

closes odoo/odoo#33487

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-05-21 07:34:26 +00:00
Nicolas Martinelli 92393a6b8e [FIX] purchase_stock: discount on invoice
- Create a product P
Costing Method: FIFO
Inventory Valuation: Perpetual (automated)
Price Difference Account set
- Create a PO with P, set a price of 100 (no tax).
- Receive the product

2 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Stock Valuation         |   100.0|     0.0|
| Stock Interim (Received)|     0.0|   100.0|

- Create the corresponding invoice
- Change the:
Discount: 10
- Validate the invoice (for a total of 90.0)

2 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Account Payable         |     0.0|    90.0|
| Stock Interim (Received)|    90.0|     0.0|

This is not correct, it should be:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Account Payable         |     0.0|    90.0|
| Difference Account      |     0.0|    10.0|
| Stock Interim (Received)|   100.0|     0.0|

This comes from the fact that the valuation price is compared to the
price unit without the discount.

opw-1974002

closes odoo/odoo#33296

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-14 08:19:20 +00:00
Nicolas Martinelli 4927d4c5ac [FIX] purchase_stock: change PU with discount on invoice
- Create a product P
  Costing Method: FIFO
  Inventory Valuation: Perpetual (automated)
  Price Difference Account set
- Create a PO with P, set a price of 110 (no tax).
- Receive the product

2 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Stock Valuation         |   110.0|     0.0|
| Stock Interim (Received)|     0.0|   110.0|

- Create the corresponding invoice
- Change the:
  Unit Price: 100
  Discount: 10
- Validate the invoice (for a total of 90.0)

3 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Account Payable         |     0.0|   100.0|
| Difference Account      |     0.0|    20.0|
| Stock Interim (Received)|   120.0|     0.0|

This is not correct: the Stock Interim (Received) should have a debit of
110.0, and the Account Payable credit should be 90.0.

This comes from the fact that the difference is subtracted from
`line['price_unit']`, which doesn't contain the discount.

We can use `price_val_dif` to update the price. Moreover, the
`price_unit` seems ultimately useless, since it is not used in:

https://github.com/odoo/odoo/blob/e11bacfe512a3170f44d6d43646af914a9cf3b73/addons/account/models/product.py#L63

We still update it for consistency.

Fixes #32911
Fixes #33201
opw-1974002
2019-05-14 08:19:20 +00:00
Nicolas Martinelli e526b6bba4 [FIX] purchase_stock: incorrect indentation
Incorrect indentation following forward-port.
2019-05-14 08:19:19 +00:00
Jigar Vaghela 3d755262e5 [ADD] l10n_mn: Add Mongolia Accounting
Basic Chart of Accounts and taxes for the Mongolian
accounting.  Tags for a lot of reports in Enterprise.

A lot of different taxes are created to be able
to represent them in the vat report. Mongolians
are used to taxes included even for B2B.

Some fiscal positions are added e.g. to automatically
apply 0% for export.

We got a lot of input from our Mongolian partner
Baskhuu Lodoikhuu and colleagues from BumanIT LLC

opw-1946238
Separate pr for 12.3
Closes #32830

Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2019-05-14 08:07:03 +00:00
Jeremy Kersten 659ff0da13 [FIX] base: ignore context key in compute_display_name for res_partner
If you create a partner with a e.g. the key show_vat, it will be stored on
the partner while we would like to have this information only in the name_get.

After this commit, we will stop to save partner in our production database
with the vat number stored in the name because we create the partner (with vat)
from the invoice, where partner_id have a context with show_vat.

closes odoo/odoo#33492

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-20 13:52:20 +00:00
Adrian Torres 09af3fac39 [FIX] base: generate field translations based on index key
The ir_translation table has an index on the (name, lang, type and value)
key, however this index was not being used when generating field
translations because the column `type` was missing!

With this commit, we fully utilize the index when generating field
translations.

With the eCommerce with categories and 4k+ products, the time to charge
products per category would be around 4-5s; With this patch it is
reduced to 1-2s.

opw-1961665

closes odoo/odoo#33504

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-05-20 13:42:17 +00:00
Toufik Ben Jaa 3c305daded [FIX] payment: do not display postgres operational errors
- When processing payments on the payments processing page,
`psycopg2.OperationalError` can be raised.
We do not want those exceptions to be displayed to the customers,
instead we want the polling page to try to process the payments again.

This commit hides the display of psycopg2 operational errors.

- This commit also fixes the "processing your payments" message being
hidden after the first polling, no matter if the processing has succeeded or not.

closes odoo/odoo#33462

Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2019-05-17 13:17:01 +00:00
Romain Derie c209c250d7 [FIX] website: prevent new website homepage to be '/-1'
Before this commit, the URL of the bootstraped homepage for a new website
could be '/-1' instead of '/'.

Indeed, creating a new website ends up calling `page.copy` which try to get an
unique URL for the website (to avoid duplicated URL after copy). Typically, the
copied page will have a suffix (-X).

But `get_unique_path` in charge of doing that is based on `get_current_website`
method which will/could return a wrong website (not the one we created).
For instance the one forced in session after using the website switcher or
creating a website or installing a theme.

As those website already have (most likely) a homepage '/', get_unique_path
will create the bootstraped homepage with '/-1' as URL.

Step to reproduce (among others):
- Create a new website in backend through res.settings screen
- Create another new website, it's homepage will be '/-1'.
- Repeat indefinitely, every two website created, the bug will appear.
(One out of two, the bug won't appear since it will try to get an unique URL
on the previously created website which only has '/-1' so '/' is assumed
unique)

closes odoo/odoo#33372

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-14 15:12:50 +00:00
Jorge Pinna Puissant 418babf7af [FIX] account: Invoice Analysis product quantity
To calculate the product quantity and the average price, two UOM are
used: The UOM of the product, and the UOM of the invoice line.

The UOM of the product it's mandatory in the product, but the product
itself it's not mandatory in the invoice. The UOM of the invoice line
it's not mandatory.

When either of the UOM is not filled, it gives as value NULL, and gives
'empty' as result of the calculation.

Now, we use the psql function COALESCE to return '1' when one of the UOM
is not filled.

closes odoo/odoo#33465

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-17 13:31:44 +00:00
Jorge Pinna Puissant d48da27e64 [FIX] account: Invoice Analysis total without sign
- Go to Accounting > Reports > Invoices
- Go to the pivot view
- Enable 'Total' and 'Untaxed Total' in the measures

The Total is wrong.

The sign of the total must be positive for the customer invoices and the
vendors refunds; and negative for the credit notes and the vendors bills.

Before this commit, the total of the credit notes and the vendors bills
weren't negative.

This occurs because the sign of the result of amount_total * invoice_type.sign
is different of the sign of amount_total_signed. Indeed amount_total is
the total amount without sign, and invoice_type.sign is used to change
the sign only for the vendors bills and the vendors refunds
(see https://github.com/odoo/odoo/blob/3cf9cfc985950c30c6b76480f77f5ffe53650b24/addons/account/report/account_invoice_report.py#L144).
Contrariwise amount_total_signed is the total amount signed : negative
for the credit notes and the vendors refunds.

Later on the calculation, the total amount is multiplied to
invoice_type.sign, to have the signs as expected
(see https://github.com/odoo/odoo/blob/3cf9cfc985950c30c6b76480f77f5ffe53650b24/addons/account/report/account_invoice_report.py#L118)

Fine tuning of this commit: 4218f3b

opw-1999175
2019-05-17 13:31:44 +00:00
Odoo Translation Bot b25fdb25b5 [I18N] Update translation terms from Transifex 2019-05-19 01:16:49 +02:00
Nans Lefebvre cf84108de8 [FIX] product: test image variants behaviour
Add some tests to ensure that basic image variant updates are correctly done.

opw 1974727

closes odoo/odoo#33249

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-05-17 12:41:04 +00:00
snd f4748c28f7 [FIX] product: correct bug where variants can't change image
When you import a variant or when you archive variants to only leave
one tied to the template, the image of the variant can't be changed.

If the variant has a picture and you archive all the other variants,
when you change the image on the variant, it's the template
image which is modified.

opw 1974727
2019-05-13 12:32:41 +00:00
Nicolas Martinelli c545783b95 [FIX] account: communication size
- Create 5 vendor bills with a long reference (> 1000 characters), for
the same partner.
- Select the bills and register a payment

An error arise: 'psycopg2.OperationalError: index row size 3256 exceeds
maximum 2712 for index "account_move_line_partner_id_ref_idx"'.

As mentioned, the index row size limit is 2712 bytes, which is exceeded
in that use case. Indeed, the reference of the payment is computed based
on the vendor reference of all bills.

We limit the number of characters to 2000. This seems reasonable knowing
that UTF-8 characters use sequences of 1 to 4 bytes [1]. Characters with
a code less than 128 require 1 byte only, and it is expected that most
vendor references will only use these characters. It is indeed unlikely
that special characters (such as Chinese characters, taking up to 4
bytes) are used for such references.

[1] https://tools.ietf.org/html/rfc3629

opw-1998823

closes odoo/odoo#33457

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-17 07:46:54 +00:00
Christophe Simonis 3cf9cfc985 [FIX] test_convert: set a description to new test model
Oversight of previous forward-port.
2019-05-17 13:43:00 +02:00
Christophe Simonis d8c0826b07 [MERGE] forward port branch saas-11.3 up to 37bca6ae50 2019-05-17 12:19:55 +02:00
Christophe Simonis 37bca6ae50 [FIX] test_mail: bump again query count
Enterprise make more queries...
2019-05-17 11:48:43 +02:00
Christophe Simonis 8f6c7c20d6 [FIX] test_mail: bump query count
Oversight of previous forward-port.
2019-05-17 10:51:13 +02:00
Christophe Simonis 5f17daae40 [MERGE] forward report branch 11.0 up to daf9763e6e 2019-05-17 10:00:11 +02:00
Christophe Simonis daf9763e6e [MERGE] forward port branch saas-15 up to 68b7f2a8ef 2019-05-16 21:08:52 +02:00
Christophe Simonis 68b7f2a8ef [MERGE] forward port branch saas-14 up to fe970ad5ae 2019-05-16 21:07:53 +02:00
Christophe Simonis fe970ad5ae [MERGE] forward port branch 10.0 up to 4039fc5201 2019-05-16 21:07:21 +02:00
Christophe Simonis 4039fc5201 [FIX] website_customer: no error-prone xpath expr
closes odoo/odoo#33450

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-05-16 16:56:34 +00:00
Christophe Simonis 7b9aa21576 [MERGE] forward port branch saas-15 up to cecb1ec77d 2019-05-16 18:19:49 +02:00
Christophe Simonis cecb1ec77d [MERGE] forward port branch saas-14 up to 556b59bce1 2019-05-16 18:11:09 +02:00
Christophe Simonis 556b59bce1 [MERGE] forward port branch 10.0 up to 90d86e07dd 2019-05-16 18:10:33 +02:00
Mohammed ShekhaandDhaval Limbuwala 90d86e07dd [FIX] tools: allow using datetime in function call
Traceback generated when trying to pass a datetime object into a function tag
in xml.

<function name="action_name" model="model_name" eval="datetime.date.today"/>

Used to fail.

With this commit now one can pass time, datetime, timedelta, relativedelta,
version, ref, pytz in function tag in xml

Task-id: 1772614
Closes odoo/odoo#29212

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>


Co-authored-by: Dhaval Limbuwala <dli@odoo.com>
2019-05-16 14:42:41 +00:00
Sébastien Theys 3b3f85670f [FIX] website: prevent crash with image gallery snippet
If destroy is called before start, there will be a crash before this commit.

At the time of this commit, this can be reproduced in master by dropping the
image gallery snippet, clicking on add images (double click, which opens the
media dialog twice for some reason), selecting 2 images to add on the
media dialog, and clicking on add. The error will be in the JS console.

closes odoo/odoo#33440

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-16 14:33:40 +00:00
Nans Lefebvre 516f22c398 [FIX] mail: remove previous attachments when changing template
Open a mail.compose.message wizard.
Select a template that generates an attachment.
Reselect it. A second attachment has been generated.
Can be repeated ad infinitum.

At template onchange, the template is rendered to overwrite the composers values
This includes the attachments.
Let L1 be the list of attachments generated by the template.
When _convert_to_write(values) is called with {'attachment_ids': L1},
it gets self.attachments_ids = L2, and generates a [(6, 0, L1 + L2)] command.
As a result attachments are only added,
the previous ones need to be removed manually.

Since c6d718f, the semantics of _convert_to_write changed.
Before, it always returned an empty list for new records (without an id).
In other words, wa always had L2 == [].
As a result we need to adapt the wizard to keep its old behaviour.

To solve it we bypass the _convert_to_write for 'attachment_ids' and directly
generate the 6 command with the list of ids L1 generated by the template.
We only do this for templates that add attachments to keep the templates
composable (a template only overwrites the values it defines).
Unfortunately, we don't have any way to know which attachments have been added
manually, so we can't preserve these (which was the old behaviour anyway).

opw 1997430
opw 1987169
opw 1998115
opw 1998782

closes odoo/odoo#33387

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-05-16 13:15:03 +00:00
Denis Ledoux 272359b86c [FIX] mail: accurate message notifications marked as sent
When multiple emails (`mail.mail`) are linked
to the same message (`mail.message`),
all the message notifications were being marked as sent
as soon as one of the mail was sent, and not all of them.

This is indeed possible to have multiple emails linked to a single
message, for instance when there are employees and customers in
the followers of a thread, and some must therefore have
the buttons meant for the employees ("Assign me") and some not.

In other words, it was possible notifications were marked
as sent while their associated email was not sent yet.

This revision also comes as an addition to
5d6656d739

as it was possible to receive a bounce coming from
the previous mail sent which wrote on the same notifications `email_status`
than the current message being sent before we could acquire the lock on
them (see commit message of the above mentioned revision),
as it was writing the `email_status` on more notifications that it
should have, including notifications of the previous email.

e.g
- Mail 1
- Message 1
- Recipient A, B, C
- Mail 2
- Message 1
- Recipient D, E

Let's say recipient A bounces

If the email notifying the bounce arrives during the processing of the "Mail 1",
it will be blocked until we release the lock on the `mail.notification` `email_status`
we acquire thanks to having written `exception` on `email_status` before sending the email.
But, as soon as it is unblocked (after the `cr.commit()`),
it will immediately re-attempt the delivery of the bounce email,
therefore writting "bounced" in `email_status` of recipient A,
while the transaction of the second email already began.
When the second email sending will try to write the `email_status`
of recipient A as well
(as it used to write the `email_status` on all the message notifications,
not just the one related to the current email),
it raised a concurrent update.
Therefore:
1. Interrupting the loop, as psycopg2 exceptions are raised and not passed,
2. Replay the sending of the second email a second time.

opw-1984293

closes odoo/odoo#33431

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-05-16 12:57:57 +00:00
Lucas Perais (lpe) 587357432e [FIX] account: payments cannot be grouped on company
Since cdca5d4751, the field company_id
on account.payment is not stored anymore, so, it doesn't make sense to be able to group on it

OPW 1998427

closes odoo/odoo#33428

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-05-16 11:53:18 +00:00
Christophe Simonis 624c30a3b7 [MERGE] forward port branch saas-14 up to 679a73474e 2019-05-16 11:36:32 +02:00
Christophe Simonis 679a73474e [MERGE] forward port branch 10.0 up to 0164c9dfcb 2019-05-16 11:22:53 +02:00
Olivier Dony 9fc5a4a061 [FIX] ir_mail_server, mail: catch SMTPServerDisconnected exceptions
If the smtp session was dead, it would lead the whole mail batch to fail.

opw 1949270

closes odoo/odoo#32424

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>

closes odoo/odoo#33350

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-05-16 07:02:06 +00:00
Olivier Dony 11f0d7cefa [FIX] mail: do not shadow SMTP errors with QUIT
When an exception is raised during the course of a normal SMTP session,
smtplib's `sendmail()` method will close the channel automatically,
so any further attempt at sending SMTP commands will fail with an
SMTPServerDisconnected error, even just calling `smtp.quit()`.
This will shadow the original error, and make debugging harder.

Fixes #1493
2019-05-16 07:02:06 +00:00
Christophe Simonis a7743e0be8 [MERGE] forward port branch saas-14 up to 64ed30e34b 2019-05-14 13:55:35 +02:00
Christophe Simonis 64ed30e34b [MERGE] forward port branch 10.0 up to 2a14eea095 2019-05-14 13:54:56 +02:00
Johan Demaret Rivarola 2a14eea095 [FIX] website_{crm_partner_assign,customer}: fix 404 when crawling
When website_customer is not installed, some endpoints are not handled
by the router, causing the following tests to fail:

- test_10_crawl_public
- test_20_crawl_demo
- test_30_crawl_admin

Those tests were failing due to /customers responding with 404.

Indeed, the route /customers is defined in website_customer, but had
some usage within website_crm_partner_assign, causing tests to fail when
the former module is not installed.

The new behavior can be explained as follows:

- module website_crm_partner_assign on its own will lose the hyperlink.
- module website_customer will now inherit the view definition in order
to wrap the targeted HTML text elements with an anchor tag.

Closes #33344

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-05-13 16:34:27 +00:00
Christophe Simonis 825fee2626 [MERGE] forward port branch 11.0 up to d01db48087 2019-05-08 18:29:32 +02:00
Christophe Simonis d01db48087 [MERGE] forward port branch saas-15 up to 82f88478cf 2019-05-08 17:27:30 +02:00
Christophe Simonis 82f88478cf [MERGE] forward port branch saas-14 up to 98b10f98bb 2019-05-08 17:13:30 +02:00