-
- Downloads
[FIX] sale: fix add missing values at line create
Create a new sale.order.line with only values = {'product_id': x, 'order_id': y} Then line.company_id == res.company() whereas line.order_id.company_id == res.company(1). Since company_id is a related on order_id.company_id, this is kind of wrong. This is because we have a new record, so its values exist only in cache; however when accessing the related the default is that related_sudo=True. So we try to access the related value in another environment; but this sudo environment does not have the line.order_id in cache. Knowing this behaviour, the cache is copied to the sudo environment but only in onchange, since it's the only supported use-case for new records. Of note is that _prepare_add_missing_fields calls product_id_change, which calls functions that expect all related to have the correct value. For instance price computations rely on the _convert method, which depends on the currency and the company of the line, so this can trigger tracebacks. Note that in particular commit 3e61dab2 is an explicit workaround for this issue. opw 2062123
Loading
Please register or sign in to comment