Suppose an invoice in EUR with a company using USD.
- Try to create an invoice with some lines, remove the value of the journal_id field.
=> Traceback because line.company_id.currency_id is an empty recordset on which you can't
call the 'round' method.
- In the list views of the invoices, the price must be shown in the company currency.
- When registering the payment if you change the currency in USD the conversion is wrong.
closesodoo/odoo#37050
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
In some cases, after installing a new language in rte_translator tour,
some query using ir_translation table will become very slow.
Identified query:
SELECT res_groups_users_rel.uid, res_groups_users_rel.gid
FROM res_groups_users_rel, "res_groups" LEFT JOIN "ir_translation" as "res_groups__name"
ON ("res_groups"."id" = "res_groups__name"."res_id"
AND "res_groups__name"."type" = 'model'
AND "res_groups__name"."name" = 'res.groups,name'
AND "res_groups__name"."lang" = 'en_US'
AND "res_groups__name"."value" ! '')
WHERE 1=1 AND res_groups_users_rel.uid IN (2) AND res_groups_users_rel.gid = res_groups.id
ORDER BY COALESE("res_groups__name"."value", "res_groups"."name") OFFSET 0´
During post_install this query will become slower (between 0.7 and 2 seconds) ~50%
of the time, when this usually take less than 0.1 second.
For some tour step, this query is executed several times, making a simple
/web loading going from less than one second to more than 10 second, breaking the tour.
The main intuition behind that would be that the query plan completely fails,
mainly because postgress is to busy and doesn't have time to launch an analyse
when runbot load is high.
This commit proposes to execute a manual ANALYZE on ir_translation table
after a new language is installed. Tested with 40 builds, rte_translator never failed
with this fix.
cherry-pick of fc5934dc45closesodoo/odoo#37013
X-original-commit: 57f91453cb567d8a7a29137b321a630fe0dbb9a6
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Be in company C1. Create the invoice I for a SO in company C2.
The invoice is created on the default account.journal for C1.
This happens when e.g. C2 is a child company of C1.
Then I is accessible from C1, but not from C2
as reading the journal violates the multi-company record rules.
Note that if company_id == False, then
self.env['account.invoice'].with_context(company_id=company_id)
.default_get(['journal_id'])['journal_id']
returns False, and in that case, it would raise below.
To keep with the existing behaviour, we put a fallback on
self.env.user.company_id.id
which means that the values we pass are:
'company_id': False, 'journal_id': J for some J in company C
which is flaky, but won't trigger any extra errors.
opw 2068291
closesodoo/odoo#37002
X-original-commit: 427280d9760a71e6ca2961bcf4a2f9f157e6dddd
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Steps to reproduce the bug:
- Let's consider that warehouse A resupplies from warehouse B
- A has Outgoing Shipments in one step
- B has Outgoing Shipments in two steps
- Change Outgoing Shipments of B in one step
Bug: An integrity error was raised because route_id field is required
on model 'stock.rule'
PS Inspired from function create_resupply_routes
opw:2069163
closesodoo/odoo#36991
X-original-commit: 2a87b56efab1246fa85c1b507322e0909db3dd20
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Some operations call the WizardMultiChartsAccounts.existing_accounting
(file chart_template.py), such as going to the settings of the Accounting app.
This function tests whether any lines are present in several tables related
to accouting.
Before this commit:
a search is performed throughout the tables and takes forever for a large db.
Partner reports: "with current code, a customer with 12M account move lines
gets an out of memory error after the screen has sat for 10 minutes - this is
because the code is doing a read on every row in the account move line just to
see if the user company has a record".
After this commit:
with limit=1, the search stops after only one line is found in any table.
closesodoo/odoo#36975
Opw: 2066938
X-original-commit: 80563819ae93c00d171935f1d1cded33de15ba21
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Before that, when using a small screen (with width <= 768 px) and
showing the accounting dashboard of a company without any chart of
accounts installed, the icon and message prompting to install a chart of
accounts was displayed in the lower left corner, instead of being
horizontally centered.
closesodoo/odoo#36974
X-original-commit: 4999f47d7e283c6a5799e68f2b0e1351638e17a3
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Co-authored-by: Nicolas Lempereur <nle-odoo@users.noreply.github.com>
-Create a random journal entry affecting the partner A, using a receivable/payable account.
-Let the journal entry in draft.
=> The amount set on the line must not be sum in the partner's amount_due.
closesodoo/odoo#36973
X-original-commit: 3ab4589ff444da9889ac922ac9d7ba6c8e8638bc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Following 40487aca5c there was an issue
where a delivery could be splitted because of mrp specific code.
This test checks that when creating a sale order including a level 3
bom (MTO) the delivery is one, containing the correct products
closesodoo/odoo#36961
X-original-commit: c07ecea7923c1609c4461fadbc61040e9fd3d86a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
On the pivot view, there is the following unsigned measure fields:
"account_tax" and "account_untaxed".
It can cause mistakes since for example the sum of a invoice an its
full credit note should be zero, but here it will be double the amount.
So here we complete 97aec9f8 for two fields that were still available.
opw-2071027
closes#36940closesodoo/odoo#36971
X-original-commit: 2dc8e2feec9e5b604e0c0acae52562822a113342
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
The progress bar was pretty broken before this commit.
> It was not possible to input the value as text
> Moving the progress bar to modify value and saving crashed
> modifying the max value crashed
> The whole feature was ill-defined
With this commit, we fix the crashed. It is now possible to write the field
behind the progress bar by moving it in RO mode
or by typing the input in RW mode
*if it is the value we want to write on*
It it is the max value that the field targets, we can do it in RO and RW mode,
only with the input as text
Note that this works *only if* the editable option on the widget is set to true
OPW 2061846
closesodoo/odoo#36928closesodoo/odoo#36970
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
In case you have a button of type action, the controller is doing an rpc
on the model using the right method, but in this rpc, the context is not
passed.
This creates a translation problem (nothing is translated) since the
language is not defined in the context.
Task Id 2062419
Closes#36189closesodoo/odoo#36969
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
There is no need to redefine `_get_stripe_api_url` by adding `https`
since all existing calls to the method programmatically add it already.
Therefore, we use the same approach: we add `https://`, then join the
URL.
opw-2031745
closesodoo/odoo#36957
X-original-commit: 0412786486462423c91afc1c5a4dcb25886827e4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Log an error only if a transaction exists.
opw-2071862
closesodoo/odoo#36946
X-original-commit: 903bd53d5f11dc9a9cfea246e6c5c0a088ad02ba
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Steps to reproduce the bug:
- Change the date format of your current lang
- Reconcile a statement
Bug:
The maturity date displayed in the widget didn't use the format of your
current lang.
opw:2068241
closesodoo/odoo#36944
X-original-commit: d2ad3d6542bfe1c900720148f22abe4b507e2a41
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
before this commit: it gives error when we redirect to payumoney site
after this commit: payment testing in payumoney is working as expected
closesodoo/odoo#36937
X-original-commit: 97c0ece7857ca56b1fd20d3772262def5aeebdc4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Reverts d91b1e5bd5
But still handles the use case (cancelling transfer payment)
Make a payment, confirm it
The payment's move has a name, i.e. constructed from its sequence
Cancel it
the payment has no move anymore
Re-confirm the payment
Before this commit, the new move had a new name from a new sequence number
This is problematic to ensure accounting consistency
Besides, it was not the way it works for invoices' moves
After this commit, the former name of the move is taken
to build the new move of the re-confirmed payment
OPW 2046412
OPW 2070167
closesodoo/odoo#36868closesodoo/odoo#36922
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
When processing a payment in Ecommerce, if the payment
acquirer communication is defined on 'Based on Document Reference'
and if the sale order sequence is having a suffix, we have
an internal error due to a bad implemented regexp.
opw-2067596
closes#36867closesodoo/odoo#36892
X-original-commit: b08a0025e7900554791a4e42bddcbeb09739a8a1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Nicolas Lempereur <nle-odoo@users.noreply.github.com>
In case no email address was specified on the delivery address stripe
redirect flow will fail, so we define a fallback on the billing partner
email.
closesodoo/odoo#36833closesodoo/odoo#36862
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
* website
Following the new editor merge at https://github.com/odoo/odoo/pull/29775
(which was finally partially reverted for 13.0), the crop dialog was not
working anymore on sub-sequent crop. This was due to 2 things:
1) Re-cropping an image that was just cropped now
The original source of the recently cropped image is saved as temporary
jQuery data on the image element. Unfortunately, for some strange
reason, that image is cloned before any edition and thus lose that data.
This commit fixes the problem by cloning the data too... supposing the
orignal clone is there for a reason.
2) Re-cropping an image that was saved before
This did not work anymore simply because... the cropped images were not
saved in database anymore but saved as base64 data in the view... For
some reason, the cropped images to save were searched in the original
DOM instead of the edited DOM...
Also fixing the random use of a mutex.
Discovered while working on task-2059480
closesodoo/odoo#36878
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
With the PSD2 directive coming into effect on September 14th,
was had no choice but to switch our Stripe integration to use
newer APIs that support Strong Customer Authentication (SCA for short).
This meant switching from the old stripe.js implementation for
'redirection' flow to the Stripe Checkout API and from the
Charge API to the newer SetupIntent & PaymentIntent APIs
for s2s flows.
This new modules introduce these changes in a non-intrusive way,
this means that installing this module is *not* required for
all customers (e.g. instances only accepting payment to and
from countries that are not part of the EU), that installing it
will support SCA flows and that uninstallation leaves you with
a working instance as well.
Task 2039100
closesodoo/odoo#36869
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
With the PSD2 directive coming into effect on September 14th,
was had no choice but to switch our Stripe integration to use
newer APIs that support Strong Customer Authentication (SCA for short).
This meant switching from the old stripe.js implementation for
'redirection' flow to the Stripe Checkout API and from the
Charge API to the newer SetupIntent API for s2s flows.
This new modules introduce these changes in a non-intrusive way,
this means that installing this module is *not* required for
all customers (e.g. instances only accepting payment to and
from countries that are not part of the EU), that installing it
will support SCA flows and that uninstallation leaves you with
a working instance as well. Essentially a backport of 9f5f2fc
in a seperate module.
Task 2039100
- allow acquirers to arbitrarily include info about the tx in the
processing page
- pending is now a valid state that could require customer action in the
payment processing page - don't blindly redirect to the return url of
another tx if a pending transaction is there
This latest change might mean that customers with many tx attempts might
have a sub-par experience as they may need to click manually on the
redirect url of a successful tx while before they were redirected
immediately.
Be in multi-company, with shared products, let P be a product in company C.
Suppose there are stock moves or pickings in company C'.
Suppose a non-admin writes on P: it triggers an access error.
Stock moves are not shared across companies in all cases.
So fields that depend on product_id might trigger a recompute on stock.moves
that are in another company, and thus trigger a spurious ACL error while
simply writing product attributes.
Note that _cal_move_weight depends on product_qty, however it is not sufficient
to only put that field in compute_sudo; the product_qty has already been marked
as todo, and so it is recomputed in the initial environment.
opw 2066691
forward port of 7d4d8fa18aecb3b78c8d359434a165c1de71a9b4
closesodoo/odoo#36838
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
- Activate mrp bom cost.
- Create a BoM for a product
- The Compute "Price from BoM" button appear on the product template
below the Cost field.
- Click the button.
Before this commit:
Probably because dynamic variant creation is activated and there is
no variants, the ensure_one fails with 0 records actually passed to
the function.
Additionally, if all the BoM are for variants and there is no BoM for
the template, then there is a division by 0 exception.
After this commit:
A test is performed to avoid calling the function with 0 records.
A test is performed to avoid a division by 0 exception.
closesodoo/odoo#36761
Opw: 2064884
X-original-commit: 42264002070c8acbb781bd111d8a0c31e2ad9716
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Prior to this commit, we would try to decode the logo of a company
without any verification on its presence. If the logo was not set, we'd
try to decode nothing which caused a crash.
This commit ensure that we asert that the field is set before trying to
encode it for a JSON payload.
closesodoo/odoo#36784
X-original-commit: f40f763831bace8c499072ea81ef9bbd5fc910e4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Animations (now public widgets) are now disabled by default in edit
mode. It is opt-in. That one should have been enabled and was left
disabled by mistake.
task-2070930
closesodoo/odoo#36807
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since commit 5f12e244f6, the write of implied groups is done directly in SQL,
bypassing the ORM writes, and thus bypassing the python constraints checks.
In particular such a constraint was added in f206714af0.
We add back an explicit check of this constraint;
however we rewrite it in SQL to be fast.
closesodoo/odoo#35411closesodoo/odoo#36769
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
For contract of type 'Company' which have no image set, we should display a
specific default 'company' placeholder image instead of default placeholder.
This allows to easily identify which records are companies.
This was already the case up to commit 6153d65664
OPW-2067475
closesodoo/odoo#36783
X-original-commit: 42c08846296d86fb3196f430eec45dd39cf1a8f5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Before this commit, when printing the Price List report of a Product
Variant, the price is printed directly from the float result of the
calculation of the price, even if this price is rounded, the
representation of the float can have, sometimes, float precision errors
(a lot of 0 after the decimal point, and a 1 or 2 at the end).
Now, the function returns a string formatted to the correct number of
fractional digits.
opw-2069305
closesodoo/odoo#36705closesodoo/odoo#36770
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Activate variants
- On a product variant without BOM, go to Action > Compute Price from
BOM
A zero-division is raised because of `... / bom.product_qty`.
opw-2067520
closesodoo/odoo#36733closesodoo/odoo#36736closesodoo/odoo#36749
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Forward-port of #36688 (original: #36284)
Before this commit, search view was barely usable with Japanese IME.
For instance, when pressing ENTER while in composition mode and
IME prompts some suggestions, it made a search with the updated input
content. The expected behaviour should have been to update the input
content, without making the search yet.
This commit fixes the issue by turning off some actions of the
search view when typing during composition mode.
opw-2061590
closesodoo/odoo#36728
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Have a model with a parent field
Set his parents like
Parent 0
|
-- Parent 1
|
-- Parent 2
Now, put the Parent 1 as inactive
Open a view with a search panel, which will fetch the parent field as categories
Before this commit, it crashed, because the inner record memory
did not contain a reference to the parent of Parent 2
After this commit, it doesn't crash, and the search panel
just doesn't display parents categories that are archived, nor any children of those
OPW 2070266
closesodoo/odoo#36699
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
-Choose the document template 'external_layout_boxed' or
'external_layout_standard' for client in Spanish.
-Print an invoice.
Before this commit:
the page numbering in the footer is not displayed properly.
After this commit:
the page numbering in the footer is displayed properly
closesodoo/odoo#36741
Opw: 2066838
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
When .with_context() is called with a dictionary as 1st positional
argument, it will replace context (and not modify the referenced keys)
It may create bugs when losing the content of the context (e.g. remove
partner's language)
This is a partial merge of #36164 without the inventory part as
discussed.
closesodoo/odoo#36729
X-forward: 4717ccfa
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
When adding an analytic tag on a sale order line, if there is
a default analytic tag defined matching the criteria, the tag
on the SO line is overwritten in the invoice while it should be
kept.
opw-2068196
closesodoo/odoo#36685closesodoo/odoo#36727
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-Go to Settings > General Settings and choose the external_layout_background
template.
-Set a client's language to French.
-Go to Invoicing.
-Select any invoice for this client, and click Print > Invoices
Before this commit:
At the bottom of the page you would see "XY" for the page number.
After this commit:
You now see "Page X sur Y".
closesodoo/odoo#36643
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>