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
closesodoo/odoo#33487
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- 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
closesodoo/odoo#33296
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- 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#32911Fixes#33201
opw-1974002
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>
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.
closesodoo/odoo#33492
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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
closesodoo/odoo#33504
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
- 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.
closesodoo/odoo#33462
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
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)
closesodoo/odoo#33372
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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.
closesodoo/odoo#33465
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- 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
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
- 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
closesodoo/odoo#33457
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
Closesodoo/odoo#29212
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Dhaval Limbuwala <dli@odoo.com>
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.
closesodoo/odoo#33440
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#33387
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
closesodoo/odoo#33431
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
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
closesodoo/odoo#33428
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
If the smtp session was dead, it would lead the whole mail batch to fail.
opw 1949270
closesodoo/odoo#32424
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
closesodoo/odoo#33350
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
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>
- 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
closesodoo/odoo#33236
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- 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
closesodoo/odoo#33240
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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>
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
closesodoo/odoo#33196
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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>
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
closesodoo/odoo#33188
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>