[FIX] ir_values: fallback when no condition
When searching for default values, if we set a condition (e.g. 'type=out_invoice'), fetch also the default values without any condition set. Thanks to the order by clause, the one with a condition have an higher priority than the one without and will not affect existing result. This fixes default journal/currency on an invoice where the journal is retrieved in the onchange_company_id method (domain is forced). Without this patch only ir.values with a domain set will match, opw 610645
This commit is contained in:
parent
7a928b151a
commit
3dec09079e
|
@ -310,10 +310,10 @@ class ir_values(osv.osv):
|
||||||
(SELECT company_id from res_users where id = %%s)
|
(SELECT company_id from res_users where id = %%s)
|
||||||
)
|
)
|
||||||
%s
|
%s
|
||||||
ORDER BY v.user_id, u.company_id"""
|
ORDER BY v.user_id, u.company_id, v.key2"""
|
||||||
params = ('default', model, uid, uid)
|
params = ('default', model, uid, uid)
|
||||||
if condition:
|
if condition:
|
||||||
query %= 'AND v.key2 = %s'
|
query %= 'AND (v.key2 = %s OR v.key2 IS NULL)'
|
||||||
params += (condition[:200],)
|
params += (condition[:200],)
|
||||||
else:
|
else:
|
||||||
query %= 'AND v.key2 is NULL'
|
query %= 'AND v.key2 is NULL'
|
||||||
|
|
Loading…
Reference in New Issue