Merge lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_report_multicompany_dev_jorge into lp:addons-vauxoo/7.0

Status: Merged
Merged at revision: 953
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_report_multicompany_dev_jorge
Merge into: lp:addons-vauxoo/7.0
Diff against target: 55 lines (+6/-6)
1 file modified
report_multicompany/model/report_multicompany.py (+6/-6)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_report_multicompany_dev_jorge
Reviewer Review Type Date Requested Status
Julio Serna-http://www.vauxoo.com Pending
Isaac López Zúñiga Pending
Moisés López - http://www.vauxoo.com Pending
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Review via email: mp+199543@code.launchpad.net

Commit message

[REF][report_multicompany] Add company_id in function report_multicompany_create, this for assign user.company_id.id to configuration

Description of the change

Se agrega company_id en la funcion report_multicompany_create cuando se ejecuta desde el wizard de configuración.

To post a comment you must log in.
951. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][lreport_multicompany] Added required=True in field Report Template (report_id)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'report_multicompany/model/report_multicompany.py'
2--- report_multicompany/model/report_multicompany.py 2013-12-13 18:12:03 +0000
3+++ report_multicompany/model/report_multicompany.py 2013-12-19 00:56:23 +0000
4@@ -33,7 +33,7 @@
5
6 _columns = {
7 'company_id': fields.many2one('res.company', 'Company',),
8- 'report_id': fields.many2one('ir.actions.report.xml', 'Report Template',
9+ 'report_id': fields.many2one('ir.actions.report.xml', 'Report Template', required=True,
10 help="""This report template will be assigned for electronic invoicing in your company"""),
11 'report_name': fields.related('report_id', 'report_name', type='char', string='Report Name', readonly=True),
12 'sequence': fields.integer('Sequence'),
13@@ -65,7 +65,7 @@
14 model_id = model_ids and model_ids[0] or False
15 return {'value': {'model': model_id}}
16
17- def report_multicompany_create(self, cr, uid, report_id, sequence=False, context=None):
18+ def report_multicompany_create(self, cr, uid, report_id, company_id=False, sequence=False, context=None):
19 '''
20 This function adds or updates a record in a report associated
21 with a company in which if the record exists and performs
22@@ -78,13 +78,12 @@
23
24 if sequence is False:
25 sequence=10
26-
27 actions_obj = self.pool.get('ir.actions.report.xml')
28 ir_model_obj = self.pool.get('ir.model')
29 model_id = False
30 report_data = actions_obj.browse(cr, uid, report_id)
31 sequence_min_id = self.search(
32- cr, uid, [('model', '=', report_data.model)], limit=1) or False
33+ cr, uid, [('model', '=', report_data.model),('company_id','=',company_id)], limit=1) or False
34 if sequence_min_id:
35 sequence_min = self.browse(
36 cr, uid, sequence_min_id[0]).sequence - 10
37@@ -92,7 +91,8 @@
38 sequence_min = sequence
39
40 record_id = self.search(cr, uid, [('model', '=', report_data.model),
41- ('report_id', '=', report_id)])
42+ ('report_id', '=', report_id),
43+ ('company_id','=',company_id)])
44 if record_id:
45 self.write(cr, uid, record_id, {'sequence': sequence_min})
46 else:
47@@ -100,7 +100,7 @@
48 cr, uid, [('model', '=', report_data.model)])
49 model_id = model_ids and model_ids[0] or False
50
51- data_create = {
52+ data_create = {'company_id': company_id,
53 'report_id': report_id,
54 'report_name': report_data.report_name,
55 'sequence': sequence_min,