Merge lp:~openerp-dev/openobject-server/trunk-bug-844651-vme into lp:openobject-server

Proposed by Vidhin Mehta (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/trunk-bug-844651-vme
Merge into: lp:openobject-server
Diff against target: 22 lines (+12/-0)
1 file modified
openerp/osv/expression.py (+12/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-bug-844651-vme
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+136869@code.launchpad.net

Description of the change

> To support string search from Advance search view for reference type field.
> web branch: https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-844651-vme/+merge/136868

To post a comment you must log in.

Unmerged revisions

4607. By Vidhin Mehta (OpenERP)

[IMP]minor improvement.

4606. By Vidhin Mehta (OpenERP)

[IMP]code improve.

4605. By Vidhin Mehta (OpenERP)

[IMP]reference field can works on string attribute.implement for advance search reference widget.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/osv/expression.py'
--- openerp/osv/expression.py 2012-10-18 12:47:50 +0000
+++ openerp/osv/expression.py 2012-11-29 08:49:23 +0000
@@ -627,6 +627,18 @@
627 else:627 else:
628 # other field type628 # other field type
629 # add the time part to datetime field when it's not there:629 # add the time part to datetime field when it's not there:
630 if field._type == 'reference' and isinstance(right, str):
631 ref_obj, ref_id = right.split(',')
632 if not ref_id.isdigit():
633 dic_opt = {'!=':'=','not like':'like','not ilike':'ilike','not in':'in'}
634 records = table.pool[ref_obj].name_search(cr, uid, ref_id, [], dic_opt.get(operator,operator), context=context, limit=None)
635 if records:
636 exp_list = [("%s,%d"%(ref_obj,res[0])) for res in records]
637 if operator in NEGATIVE_TERM_OPERATORS:
638 self.__exp[i] = (left,"not in",exp_list)
639 else:
640 self.__exp[i] = (left,"in",exp_list)
641
630 if field._type == 'datetime' and self.__exp[i][2] and len(self.__exp[i][2]) == 10:642 if field._type == 'datetime' and self.__exp[i][2] and len(self.__exp[i][2]) == 10:
631643
632 self.__exp[i] = list(self.__exp[i])644 self.__exp[i] = list(self.__exp[i])