New CRM controller for list_languagelist

This commit is contained in:
osarrat 2018-04-20 12:19:21 +02:00
parent de1487730d
commit d3690d231e

View File

@ -17,7 +17,8 @@ class GroupeURD_CRM(http.Controller):
select mmml.name as mailing_list, imd.name as external_id
from ir_model_data imd
inner join mail_mass_mailing_list mmml on mmml.id = imd.res_id
where imd.model = 'mail.mass_mailing.list';
where imd.model = 'mail.mass_mailing.list'
order by mmml.name;
""")
mailing_lists = http.request.cr.dictfetchall()
output = ""
@ -33,7 +34,8 @@ where imd.model = 'mail.mass_mailing.list';
select rpc.name as category, imd.name as external_id
from ir_model_data imd
inner join res_partner_category rpc on rpc.id = imd.res_id
where imd.model = 'res.partner.category';
where imd.model = 'res.partner.category'
order by rpc.name;
""")
partner_categories = http.request.cr.dictfetchall()
output = ""
@ -50,10 +52,29 @@ where imd.model = 'res.partner.category';
select rpt.name as title, imd.name as external_id
from ir_model_data imd
inner join res_partner_title rpt on rpt.id = imd.res_id
where imd.model = 'res.partner.title';
where imd.model = 'res.partner.title'
order by rpt.name;
""")
partner_titles = http.request.cr.dictfetchall()
output = ""
for i, val in enumerate(partner_titles):
output = output + val['title'] + "\t" + val['external_id'] + "\n"
return output
#Example: /crm/list_languagelist?db=groupeurd-openacademy
@http.route('/crm/list_languagelist', auth='public')
def view_languagelist(self, db):
http.request.session.db = db
http.request.cr.execute("""
select gcl.name as language, imd.name as external_id
from ir_model_data imd
inner join groupeurd_crm_languagelist gcl on gcl.id = imd.res_id
where imd.model = 'groupeurd_crm.languagelist'
order by gcl.name;
""")
languagelist = http.request.cr.dictfetchall()
output = ""
for i, val in enumerate(languagelist):
output = output + val['language'] + "\t" + val['external_id'] + "\n"
return output