You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
often Odoo gives us domains as string (in views for instance). But we may need to send them back in json to Odoo. This would help to translate forms better in Aktooor for instance.
Idea: change the domain string a bit and do a JSON.parse on it.
Elements of code:
m = string_domain.match(/time\.strftime\(.*\)/)
m.each do |python_time|
ruby_time = python_time.gsub("time.strftime(", "Time.now.strftime(")
string_domain.gsub!(python_time, ruby_time)
end
replaces = {
"(" =>"[",
")" =>"]",
"True" =>"true",
"False" =>"false",
}
replaces.each do |k, v|
string_domain.gsub!(k, v)
end
domain_rb = JSON.parse(string_domain)
TODO:
avoid that () replacements screw time function.
deal with variable injections. JSon.parse won't let us bind variables. An idea would be to pass an Ooor object to the domain conversion method. For each field key, we would try to replace the key with its value (send key). To avoid overlapping, the idea would be to match [not azAZ _]key[not azAZ _].
The text was updated successfully, but these errors were encountered:
often Odoo gives us domains as string (in views for instance). But we may need to send them back in json to Odoo. This would help to translate forms better in Aktooor for instance.
Idea: change the domain string a bit and do a JSON.parse on it.
Elements of code:
TODO:
The text was updated successfully, but these errors were encountered: