Saturday, April 18, 2020
3 changes · master
Miscellaneous changes
Consider a sales order with a single line. Edit the sales order: remove the line, and add another line with the same subtotal. When saving, the total of the sales order is 0.0. Here is the explanation: the form view performs a `write` on the sales order, and modifies the lines with a command `2` (remove line) and a command `0` (create line). After deleting the first order line, the cache is emptied, and a call to `flush()` forces the recomputation of the total. The value is compute
Original PR description
Consider a sales order with a single line. Edit the sales order: remove the line, and add another line with the same subtotal. When saving, the total of the sales order is 0.0. Here is the…
Consider a sales order with a single line. Edit the sales order: remove the line, and add another line with the same subtotal. When saving, the total of the sales order is 0.0. Here is the explanation: the form view performs a `write` on the sales order, and modifies the lines with a command `2` (remove line) and a command `0` (create line). After deleting the first order line, the cache is emptied, and a call to `flush()` forces the recomputation of the total. The value is computed to be 0, and assigned to the field. The assignment converts the value for the cache, without prefetching the currency field (optimization), and puts 0.0 in cache. The assignment then converts the value for the database, which prefetches most fields on the sales order: the cache is now inconsistent and contains the old value V, while the database is then updated with 0.0. After creating the new order line, the total is once again recomputed. Its value is V, and because the cache also contains that value, no update is performed to the database, which remains at 0.0! The fix consists in avoiding the prefetching of fields when accessing the currency field to round a monetary value. opw-2223134 Forward-Port-Of: odoo/odoo#49733 Forward-Port-Of: odoo/odoo#49719
Following the refactoring of the ORM with odoo/odoo#35659, `_compute` methods must assign a value for each record contained in self There is no longer a default value. Forward-Port-Of: odoo/enterprise#10000
Original PR description
Following the refactoring of the ORM with odoo/odoo#35659, `_compute` methods must assign a value for each record contained in self There is no longer a default value. Forward-Port-Of: odoo/enterprise#10000
Forward-Port-Of: odoo/enterprise#10001
Original PR description
Forward-Port-Of: odoo/enterprise#10001