Currently when importing files, the parent left and right are recomputed on each record creation/update, which could lead to a lot a request.
This commit will defer the parent field recomputation to the end on the `load` function by recomputing the values from the MPTT and inserting directly the new values on the records.
Tested on a customer instance, this will reduce the execution time when importing a thousand stock.location from 15 minutes to several seconds.
When deciding to prefetch records (getting records from the cache with
no value for the field being fetched), if the field was computed
`determine_value` would just get all records, not limited by the normal
prefetch limit; for large recordsets this would generate gigantic
prefetch lists for records we may not need at all.
Fix by applying the `PREFETCH_MAX` limit to records from the cache as is
done in `_prefetch_field`.
Complementarily, when traversing related fields the prefetch
environment would be lost and every record would get an empty prefetch
environment, so the values would ultimately be read one by one.
Example: select (search) 1000 product.product records, access a
related field (e.g. categ_id) in a loop, on the first iteration the
system would first read 1000 templates, then it would read each
categ_id individually, resulting in >1000 SQL queries rather than the
~2 we would expect.
Fixes#18511
IE11 seems to be always using cache when doin an XHR request with the
same GET request.
It can be changed in several ways:
- returning a header: "Cache-Control: no-cache"
- altering the GET request with a nonce
- using the POST method instead of GET
to solve it, in this change the HTTP header is added on the response.
opw-752270
closes#18787
Backport of 0de067cae9
(and 9b8bc5e5a1)
Rev. c5bd509274 attempted to improve the
pad sync mechanism when merging records (tasks), but failed to consider
the case where the pad_url field is not set yet.
This happens at create(), due to the chicken-and-egg problem with the
pad URL depending on the record ID, and therefore set *after* creation.
Ignoring the sync when the URL is not yet set should be enough, as the
URL generation method also takes care of that first sync.
Before this commit, when creating a pos_order_line_pro_forma, which inherits from pos_order_line but in a different table, the create confused an overriden field (order_id)
When pos_blackbox was installed, pro forma lines would search for an pos_order instead of a pos_order_proforma upon their creation
This commit allows an inheritant of pos_order_line to use the super.create function
OPW 745685
Closes#18755
Steps to reproduce the bug:
On an empty database, install the sale module
-Activate product variants : Sales > Settings > Check Products can have
several attributes, defining variants (Example: size, color,...)
-Activate advanced pricelists : Sales > Settings > Check Advanced pricing based
on formulas (discounts, margins, rounding)
-Activate the developer mode
-Go to the product.templates list : Sales > Products
-Go to the debug menu > Edit TreeView and add the price field in the view
-Go to the debug menu > Edit Action and add the value 'uom': 1 in the context field
-Search for a pricelist : Type the name of an existing pricelist, then go to the pricelists
proposal, open the list of proposed pricelists, and select the pricelist
Bug:
The wrong value was sometimes displayed in the price field. To be more exact, the displayed
value for each product.template was the price of the product.product that has the same id.
If a product.template has an id which doesn't exist in the product_product table,
this product disapears from the list.
opw:762663
Steps to reproduce the bug:
-On an empty database, install the sale module
-Activate product variants : Sales > Settings > Check Products can have several attributes, defining variants (Example: size, color,...)
-Activate advanced pricelists : Sales > Settings > Check Advanced pricing based on formulas (discounts, margins, rounding)
-Activate the developer mode
-Go to the product.templates list : Sales > Products
-Go to the debug menu > Edit TreeView and add the price field in the view
-Search for a pricelist : Type the name of an existing pricelist, then go to the pricelists proposal,
open the list of proposed pricelists, and select the pricelist
Bug:
A traceback was raised.
opw:762663
A `currency_id` field on a `hr.expense.sheet` only makes sense if all
expense lines are in the same currency. It is very likely to not be the
case, so don't format the total amount.
In master, the fild should simply be completely removed.
opw-761098
When creating a customer invoice with description/reference with more than
64 characters, the description was cut to generate the name of the account move
lines. But it's possible to create an entry with more than 64 characters as name
by the interface. The limitation is deprecated.
opw:760316
before this commit, when a portal SO was done with a product that hasn't been "website_published", a placeholder was displayed instead of the image
After this commit, the correct product image is displayed in base64 (always image_small though)
OPW 760880
Closes#18709
before this commit, when a product had its asset_category set, the account attachement to the asset_categ was righfully selected on the invoice line when creating the invoice from scratch
Though, that was not the case when the invoice was created from the po
after this commit the right symmetric behavior is back: the default account that will be selected on invoice line is the asset_category one.
opw 761033
Closes#18687
Commit 14d1f6f6c1 responded to the need to have clean server answers for SEO purposes
and specifically when the products on event tickets have been archived
BUT
it introduced an infinite redirect loop when the event was in state == done
This present commit normalize the behavior in a comprehensive manner and cleans up the code a bit
OPW 757117
Closes#18667
Use case:
- 2 invoices in foreign currencies, made at different times (and different exchange rates)
- 2 payments (same characteristics as invoices)
- allocate the 1st payment to inv A
- allocate the 2nd payment to inv A and then B so that A is fully paid, but B is not
- try to make the final payment on B to fully reconcile everything
Results (all in the payable account)
- let CB be the credit line of B
- let D2 be the debit line of 2nd payment
- let D3 be the debit line of the 3rd and final payment
Before this commit, the exchange difference computation dailed because:
- There were 2 amls that had an amount_residual and needed to be reconciled (CB and D2)
- Also, there was a structural flaw in the code that did not allow for multiple lines to have a residual
After this commit, we still make 1 move to log the exchange difference,
but we make exchange difference lines for each line that need to be reconciled: CB and D2
OPW 751710
Commit in master c36f70f6726e0c7ccca1002f78e4d402e27cae3d (2017-07-20)
Closes#18347
[FIX] account: testing partial and full reconciliation
To reproduce:
- Go Website Admin > Configuration > Settings
- Change the Website Name
- Click on 'Cancel'
The name is saved.
When the "Cancel" button is clicked, we automatically save the record
(which is a transient model). Since the field is a related to the
company, the name is changed even if we canceled.
opw-760749
This patch modifies Root#dispatch() in order to keep the httprequest url
in the current thread's attribute and use if for dumpstacks and the
phantomjs tests remaining requests handling.
Also added a counter in order to avoid looping forever when trying to join unclosed http requests
in phantomjs test suite after a phantomjs failure + added a log.warning in such a case so it's easier to troubleshoot runbot's ir.logging.
Use case: click on "reconcile X items" on a journal which doesn't have its default credit or debit account set.
Result: Before this commit, a useless traceback popped to the user.
After this commit, move lines are searched without taking into account the journal's default accounts for debit or credit
OPW 760305
Closes#18485
Before this commit, the view selected to be edited by the html editor was the wrong one
This was caused by the simplification brought about by commit a2ae219d4e
which transfered from python to js the decision to make a view a header for the [customize] menu (on the website
In this case, the first view in the return list of python was the header, and the second the actual view
Now that python just sends a list of unique views without any distinction whatsoever, the right view to pick when entering the html editor is the first one, at index 0
opw 760279
Closes#18603
In anglosaxon accounting's stock valuation, the case where invoice and company currencies are different was not managed properly, because of a syntactic error in the condition checking this case.
(this has already been merged on saas-14, but the PR should have initially been made for 10.0 ... my mistake ! See https://github.com/odoo/odoo/pull/17259 )
Before this commit, the iframe tags were sanitized as the should, but never spawn back from JS.
Now, the iframe is actually created
opw 750830
Closes#18643
When a unique variant was created from a product template with function create_variant_ids,
two product price history were created:
-One was created from function create on product.product
-The other one was created from function _set_standard_price on
product.template
The first product.price.history created in this situation was all the time
set to 0 and it lead to some problems in the report inventory date.
This first product.price.history doesn't have to be created.
opw:747857
- Activate multi-company
- Company B is parent of Company A
- Admin is in Company A
- Demo is in Company B
- Create a rate with Demo
The rate is recorded on Company A, not Company B as expected.
This is because we call: `self.env.user._get_company()` which would be
equivalent to `self.env.user.env.user.company_id`. Since the user is
browsed as `sudo`, it returns the company of the Admin.
opw-753139