Commit Graph
124010 Commits
Author SHA1 Message Date
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
Christophe Simonis 98b10f98bb [MERGE] forward port branch 10.0 up to a48318cb33 2019-05-08 17:09:40 +02:00
Nicolas Martinelli 709e59b4e9 [FIX] account: analytic account and cash basis
- Activate cash basis
- Set a tax
Tax Due: Based on Payment
Include in Analytic Cost: true
- Create an invoice, add the tax and an analytic account on the invoice
line
- Validate and pay

The analytic account is correctly set on the tax line, but it is not set
on any of the cash basis entries.

Partial backport of 079a13a349.

opw-1971751

closes odoo/odoo#33236

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-08 12:41:00 +00:00
Nicolas Martinelli 6ff5498fc0 [FIX] base: barcode fallback
- Set a product barcode to a 8 letters value, e.g. 'AAAAAAAA'
- Print 'Product Barcode (PDF)' (or any other report containing the
barcode)

The barcode doesn't print.

All templates assume that:
- a 13 characters barcode is EAN13
- a 8 characters barcode is EAN8

But this assumption is too restrictive: one could want to generate
barcodes with such length without following the EAN13 or EAN8 structure.

We fall back on Code128 when the barcode generation fails.

Backport of 06cfdbaab8
opw-1981988

closes odoo/odoo#33240

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-08 09:02:45 +00:00
Nicolas Lempereur f89d2f3599 [FIX] hw_blackbox_be: typo e8574502e1
There was a syntax improvment in the commit merged but it was not
intended to be unfinished.

fixes #33228
opw-1981839
closes #33239

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-05-08 08:55:41 +00:00
Joren Van Onder 41871bf562 [FIX] payment: prevent duplicate payments with payment tokens
When paying an eCommerce order with an acquirer which doesn't
redirect (payment_flow: s2s) the "Pay Now" button is correctly
disabled after clicking it. This prevents a user from clicking it
multiple times and being charged multiple times.

When paying with an existing payment token however the button was not
disabled and the user gets no feedback his request is being
processed. Charging an existing payment token takes a while (~5
seconds with Authorize) and so it's possible users will hit the button
multiple times.

This disables the button when reusing an existing payment
token. Additionally it now uses the correct font awesome icon (fa-lock
instead of fa-plus-circle).

opw-1981064

closes odoo/odoo#33196

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-07 17:42:33 +00:00
Nicolas Lempereur b87454ee1b [FIX] hw_blackbox_be: adapt code to posbox 17 py3
Python2 uses byte strings by default and python3 text string, so adapt
the code communicating with blackbox to still only use bytestring.

Also raspbian image has been updated in posbox 17 to Raspbian 9
(stretch) so ifconfig command returns has different format output (
`ether {MAC address}` instead of `HWAddr {MAC address}`) so the way we
get the MAC address is changed.

opw-1981839
closes #33150

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-05-07 12:39:51 +00:00
Pedro M. Baeza a48318cb33 [CLA] update Tecnativa signature
Remove Tecnativa's old employees, add new ones

closes odoo/odoo#33197

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-05-07 08:03:28 +00:00
Lucas Perais (lpe) b3864b8b4a [FIX] point_of_sale: connection failure right before pdf download
ONLINE:
make an order, chose a customer, click on "invoice"
Make the payment, validate

Just **before** the request to download the pdf of the invoice
go OFFLINE
(to achieve this, just put a debugger before the do_action() fires, and kill the server)

Before this commit, the button validate on the payment screen stayed inactive forever
This was because the deferred representing the invoicing flow was still pending

After this commit, we handle the case to invite the waiter to print the invoice
from the backend

OPW 1972301

closes odoo/odoo#33188

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-05-06 13:05:42 +00:00