Merge lp:~vauxoo/openerp-mexico-localization/7.0_oml_report_multicompany_omln_dev_jorge into lp:openerp-mexico-localization/7.0

Status: Merged
Merged at revision: 341
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0_oml_report_multicompany_omln_dev_jorge
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 119 lines (+28/-33)
3 files modified
l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py (+8/-10)
l10n_mx_settings_facturae/__openerp__.py (+1/-1)
l10n_mx_settings_facturae/model/res_config.py (+19/-22)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0_oml_report_multicompany_omln_dev_jorge
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Isaac López Zúñiga Pending
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Review via email: mp+199184@code.launchpad.net

Description of the change

Se cambia todo lo del modelo ir_actions_report_xml_multicompany por report_multicompany en ir_attachment y settings

To post a comment you must log in.
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py'
2--- l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py 2013-12-09 19:21:48 +0000
3+++ l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py 2013-12-16 19:45:31 +0000
4@@ -272,13 +272,12 @@
5 #~ "account.invoice.facturae.webkit",
6 #~ fname)
7
8- actions_obj = self.pool.get('ir.actions.report.xml')
9- report_ids = actions_obj.search(
10- cr, uid, [('model', '=', 'account.invoice'),('active', '=', True), ('report_type', '=', 'webkit'),
11- ('company_id','=',invoice.company_id.id)],order='sequence', limit=1) or False
12+ report_multicompany_obj = self.pool.get('report.multicompany')
13+ report_ids = report_multicompany_obj.search(
14+ cr, uid, [('model', '=', 'account.invoice')], limit=1) or False
15
16 if report_ids:
17- report_name = actions_obj.browse(cr, uid, report_ids[0]).report_name
18+ report_name = report_multicompany_obj.browse(cr, uid, report_ids[0]).report_name
19 if report_name:
20 report = invoice_obj.create_report(
21 cr, SUPERUSER_ID, [invoice.id],
22@@ -373,12 +372,11 @@
23 'mail.compose.message')
24 email_pool = self.pool.get('email.template')
25
26- actions_obj = self.pool.get('ir.actions.report.xml')
27- report_ids = actions_obj.search(
28- cr, uid, [('model', '=', 'account.invoice'),('active', '=', True), ('report_type', '=', 'webkit'),
29- ('company_id','=',invoice.company_id.id)],order='sequence', limit=1) or False
30+ report_multicompany_obj = self.pool.get('report.multicompany')
31+ report_ids = report_multicompany_obj.search(
32+ cr, uid, [('model', '=', 'account.invoice')], limit=1) or False
33 if report_ids:
34- report_name = actions_obj.browse(cr, uid, report_ids[0]).report_name
35+ report_name = report_multicompany_obj.browse(cr, uid, report_ids[0]).report_name
36 if report_name:
37 tmp_id = email_pool.search(
38 cr, uid, [(
39
40=== modified file 'l10n_mx_settings_facturae/__openerp__.py'
41--- l10n_mx_settings_facturae/__openerp__.py 2013-11-13 18:32:55 +0000
42+++ l10n_mx_settings_facturae/__openerp__.py 2013-12-16 19:45:31 +0000
43@@ -28,7 +28,7 @@
44 'account',
45 'email_template',
46 'email_template_multicompany',
47- 'ir_actions_report_xml_multicompany'
48+ 'report_multicompany'
49 ],
50 "author": "Vauxoo",
51 "description" : """
52
53=== modified file 'l10n_mx_settings_facturae/model/res_config.py'
54--- l10n_mx_settings_facturae/model/res_config.py 2013-11-14 19:59:41 +0000
55+++ l10n_mx_settings_facturae/model/res_config.py 2013-12-16 19:45:31 +0000
56@@ -78,44 +78,41 @@
57 data = dat and dat[0] or False
58 if data:
59 email_tmp_id = email_obj.browse(cr, uid, data)
60- return {'email_tmp_id': email_tmp_id and email_tmp_id.id or False,}
61+ return {'email_tmp_id': email_tmp_id and email_tmp_id.id or False, }
62
63 def get_default_mail_server_id(self, cr, uid, fields, context=None):
64- company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
65+ company_id = self.pool.get(
66+ 'res.users')._get_company(cr, uid, context=context)
67 mail_server_obj = self.pool.get('ir.mail_server')
68- mail_server_id = mail_server_obj.search(cr, uid, [('company_id', '=', company_id),
69- ('active', '=', True)], order = 'sequence', limit = 1)
70+ mail_server_id = mail_server_obj.search(
71+ cr, uid, [('company_id', '=', company_id),
72+ ('active', '=', True)], limit = 1)
73 return {'mail_server_id': mail_server_id or False}
74
75 def get_default_temp_report_id(self, cr, uid, fields, context=None):
76- company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
77- temp_report_obj = self.pool.get('ir.actions.report.xml')
78- temp_report_id = temp_report_obj.search(cr, uid, [('company_id', '=', company_id),
79- ('active', '=', True), ('report_type', '=', 'webkit'),
80- ('model', '=', 'account.invoice')], limit = 1)
81- return {'temp_report_id': temp_report_id or False}
82+ report_id = False
83+ temp_report_obj = self.pool.get('report.multicompany')
84+ temp_report_ids = temp_report_obj.search(
85+ cr, uid, [('model', '=', 'account.invoice')], limit=1)
86+ if temp_report_ids:
87+ report_id = temp_report_obj.browse(
88+ cr, uid, temp_report_ids)[0].report_id.id
89+ return {'temp_report_id': report_id or False}
90
91 def create(self, cr, uid, values, context=None):
92 confg_id = super(facturae_config_settings, self).create(
93 cr, uid, values, context)
94+ report_company_obj = self.pool.get('report.multicompany')
95+ email_obj = self.pool.get('email.template')
96 if values.get('mail_server_id') and values.get('company_id') and values.get('email_tmp_id') and values.get('temp_report_id'):
97- email_obj = self.pool.get('email.template')
98- actions_obj = self.pool.get('ir.actions.report.xml')
99- webkit_header_obj = self.pool.get('ir.header_webkit')
100- report_data = actions_obj.browse(
101- cr, SUPERUSER_ID, [values.get('temp_report_id')])
102 confg_data = self.browse(cr, uid, confg_id, context=context)
103- if report_data:
104- actions_obj.write(cr, uid, [values.get('temp_report_id')], {
105- 'company_id': confg_data.company_id.id}, context=context)
106- webkit_header_obj.write(cr, SUPERUSER_ID, [report_data[0].webkit_header.id], {
107- 'company_id': confg_data.company_id.id}, context=context)
108 email_obj.write(cr, uid, [confg_data.email_tmp_id.id], {
109 'company_id': confg_data.company_id.id,
110 'mail_server_id': confg_data.mail_server_id.id,
111- 'report_template': values['temp_report_id']},
112+ 'report_template': values.get('temp_report_id')},
113 context=context)
114-
115+ report_company_obj.report_multicompany_create(
116+ cr, uid, values.get('temp_report_id'), context=context)
117 return confg_id
118
119 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: