bzr revid: nch@tinyerp.com-20090513061355-zzs2e20u971dbhog
This commit is contained in:
Naresh Choksy
2009-05-13 11:43:55 +05:30
4 changed files with 17 additions and 8 deletions
+10 -1
View File
@@ -118,6 +118,15 @@ def _partner_title_get(self, cr, uid, context={}):
res = obj.read(cr, uid, ids, ['shortcut','name'], context)
return [(r['shortcut'], r['name']) for r in res]
def _lang_get(self, cr, uid, context={}):
obj = self.pool.get('res.lang')
ids = obj.search(cr, uid, [], context=context)
res = obj.read(cr, uid, ids, ['code', 'name'], context)
return [(r['code'], r['name']) for r in res] + [('','')]
class res_partner(osv.osv):
_description='Partner'
_name = "res.partner"
@@ -129,7 +138,7 @@ class res_partner(osv.osv):
'parent_id': fields.many2one('res.partner','Main Company', select=2),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Partner Ref.'),
'ref': fields.char('Code', size=64),
'lang': fields.many2one('res.lang', 'Language', help="If the selected language is loaded in the system, all documents related to this partner will be printed in this language. If not, it will be english."),
'lang': fields.selection(_lang_get, 'Language', size=5, help="If the selected language is loaded in the system, all documents related to this partner will be printed in this language. If not, it will be english."),
'user_id': fields.many2one('res.users', 'Dedicated Salesman', help='The internal user that is in charge of communicating with this partner if any.'),
'vat': fields.char('VAT',size=32 ,help="Value Added Tax number. Check the box if the partner is subjected to the VAT. Used by the VAT legal statement."),
'bank_ids': fields.one2many('res.partner.bank', 'partner_id', 'Banks'),
+1 -1
View File
@@ -229,7 +229,7 @@
<field name="ref" select="1"/>
<field name="customer" select="1"/>
<field domain="[('domain', '=', 'partner')]" name="title"/>
<field name="lang" select="2" widget="selection"/>
<field name="lang" select="2"/>
<field name="supplier" select="2"/>
</group>
<notebook colspan="4">
+3 -4
View File
@@ -26,13 +26,13 @@ from locale import localeconv
class lang(osv.osv):
_name = "res.lang"
_description = "Languages"
def _get_default_date_format(self,cursor,user,context={}):
return '%m/%d/%Y'
def _get_default_time_format(self,cursor,user,context={}):
return '%H:%M:%S'
_columns = {
'name': fields.char('Name', size=64, required=True),
'code': fields.char('Code', size=5, required=True),
@@ -59,7 +59,6 @@ class lang(osv.osv):
('name_uniq', 'unique (name)', 'The name of the language must be unique !'),
('code_uniq', 'unique (code)', 'The code of the language must be unique !'),
]
def _group(self,cr,uid,ids,s, monetary=False):
conv = localeconv()
+3 -2
View File
@@ -254,11 +254,12 @@ class expression(object):
query = '(%s OR %s IS NULL)' % (query, left)
else:
params = []
if right == False and table._columns[leaf[0]]._type=="boolean" and (operator == '='):
if right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator == '='):
query = '%s.%s IS NULL or %s.%s = false ' % (table._table, left,table._table, left)
elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
query = '%s.%s IS NULL ' % (table._table, left)
elif right == False and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
elif right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
query = '%s.%s IS NOT NULL and %s.%s != false' % (table._table, left,table._table, left)
elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
query = '%s.%s IS NOT NULL' % (table._table, left)