[FIX] Setup : Currencies should appear as name(code) format
bzr revid: jvo@tinyerp.com-20100518122220-njcg7b4eztrpsek1
This commit is contained in:
parent
3a1c5f23a4
commit
b670558fdb
|
@ -74,20 +74,22 @@ class base_gtkcontactform(osv.osv_memory):
|
|||
'contact_me':fields.boolean('Contact Me'),
|
||||
}
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
company_id = self.pool.get('base.setup.company').search(cr, uid, [])
|
||||
company_data = self.pool.get('base.setup.company').read(cr, uid, company_id)
|
||||
company_data = company_data and company_data[0] or False
|
||||
country1 = ''
|
||||
if company_data and company_data.get('country_id', False):
|
||||
country = self.pool.get('res.country').read(cr, uid, company_data['country_id'],['name'])['name']
|
||||
for res in self.read(cr, uid, ids):
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = self.pool.get('base.setup.company').search(cr, uid, [], context=context)
|
||||
company_data = self.pool.get('base.setup.company').read(cr, uid, company_id, context=context)
|
||||
company_data = company_data and company_data[0] or {}
|
||||
country = ''
|
||||
if company_data.get('country_id', False):
|
||||
country = self.pool.get('res.country').read(cr, uid, company_data['country_id'],['name'], context=context)['name']
|
||||
for res in self.read(cr, uid, ids, context=context):
|
||||
email = res.get('email','')
|
||||
result = "\ncompany: "+ str(company_data.get('name',''))
|
||||
result += "\nname: " + str(res.get('name',''))
|
||||
result = "\ncompany: "+ tools.ustr(company_data.get('name',''))
|
||||
result += "\nname: " + tools.ustr(res.get('name',''))
|
||||
result += "\nphone: " + str(res.get('phone',''))
|
||||
result += "\ncity: " + str(company_data.get('city',''))
|
||||
result += "\ncity: " + tools.ustr(company_data.get('city',''))
|
||||
result += "\ncountry: " + str(country)
|
||||
result += "\nindustry: " + str(res.get('industry', ''))
|
||||
result += "\nindustry: " + tools.ustr(res.get('industry', ''))
|
||||
result += "\ntotal_employees: " + str(res.get('total_employees', ''))
|
||||
result += "\nplan_use: " + str(res.get('use_openerp', False))
|
||||
result += "\nsell_openerp: " + str(res.get('sell_openerp', False))
|
||||
|
|
|
@ -152,5 +152,23 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''),
|
|||
context=context)
|
||||
base_setup_company()
|
||||
|
||||
class res_currency(osv.osv):
|
||||
_inherit = 'res.currency'
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
# We can use the following line,if we want to restrict this name_get for company setup only
|
||||
# But, its better to show currencies as name(Code).
|
||||
# if not (context.get('active_model','') == 'ir.actions.todo'):
|
||||
# return super(res_currency,self).name_get(cr, uid, ids, context=context)
|
||||
if not len(ids):
|
||||
return []
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
reads = self.read(cr, uid, ids, ['name','code'], context, load='_classic_write')
|
||||
return [(x['id'], tools.ustr(x['name']) + ' (' + tools.ustr(x['code']) + ')') for x in reads]
|
||||
|
||||
res_currency()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue