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

Proposed by Juan Carlos Hernandez
Status: Merged
Merged at revision: 335
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0_oml_cr_uid_ids_dev_jc
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 152 lines (+45/-18)
3 files modified
l10n_mx_facturae/invoice.py (+2/-2)
l10n_mx_facturae_cer/res_company.py (+15/-15)
l10n_mx_facturae_lib/facturae_lib.py (+28/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0_oml_cr_uid_ids_dev_jc
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Pending
Isaac López Zúñiga Pending
Review via email: mp+197134@code.launchpad.net

Description of the change

se corrigio bug 1256142 de los cr,uid,ids

To post a comment you must log in.
336. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib,l10n_mx_facturae_cer]add validation for cer and key and context

337. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]corrected base64 to write

338. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]add strict

339. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]add base64.b64decode(b64_str, '-_')

340. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]corrected decode_base64

341. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]corrected decode_base64

342. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]ADD base64.b64decode(data.encode('ascii'))

343. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]add strict

344. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]add data = base64.b64decode(data.decode('ascii'))

345. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]add data = repr(data)

346. By Juan Carlos Hernandez

[IMP][l10n_mx_facturae_lib]corrected bug

347. By Isaac López Zúñiga

[IMP][l10n_mx_facturae_cer] encodestring added

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_mx_facturae/invoice.py'
2--- l10n_mx_facturae/invoice.py 2013-11-08 03:10:17 +0000
3+++ l10n_mx_facturae/invoice.py 2013-12-04 17:14:19 +0000
4@@ -483,14 +483,14 @@
5 certificate_lib = self.pool.get('facturae.certificate.library')
6 fname_repmensual_xslt = self._get_file_globals(
7 cr, uid, ids, context=context)['fname_repmensual_xslt']
8- fname_tmp = certificate_lib.b64str_to_tempfile(base64.encodestring(''),
9+ fname_tmp = certificate_lib.b64str_to_tempfile(cr, uid, ids, base64.encodestring(''),
10 file_suffix='.txt', file_prefix='openerp__' + (False or '') + \
11 '__repmensual__')
12 rep_mensual = ''
13 for invoice in self.browse(cr, uid, ids, context=context):
14 xml_b64 = invoice.cfd_xml_id and invoice.cfd_xml_id.datas or False
15 if xml_b64:
16- fname_xml = certificate_lib.b64str_to_tempfile(
17+ fname_xml = certificate_lib.b64str_to_tempfile(cr, uid, ids,
18 xml_b64 or '', file_suffix='.xml',
19 file_prefix='openerp__' + (False or '') + '__xml__')
20 rep_mensual += certificate_lib._transform_xml(
21
22=== modified file 'l10n_mx_facturae_cer/res_company.py'
23--- l10n_mx_facturae_cer/res_company.py 2013-05-30 21:28:32 +0000
24+++ l10n_mx_facturae_cer/res_company.py 2013-12-04 17:14:19 +0000
25@@ -96,13 +96,15 @@
26 'title'], data['warning']['message'])
27 return self.write(cr, uid, ids, data['value'], context)
28
29- def onchange_certificate_info(self, cr, uid, ids, cer_der_b64str,
30- key_der_b64str, password, context=None):
31+ def onchange_certificate_info(self, cr, uid, ids, cer_der_b64str = None,
32+ key_der_b64str = None, password = None, context = None):
33 """
34 @param cer_der_b64str : File .cer in Base 64
35 @param key_der_b64str : File .key in Base 64
36 @param password : Password inserted in the certificate configuration
37 """
38+ if context is None:
39+ contex={}
40 certificate_lib = self.pool.get('facturae.certificate.library')
41 value = {}
42 warning = {}
43@@ -110,19 +112,18 @@
44 certificate_key_file_pem = False
45 invoice_obj = self.pool.get('account.invoice')
46 if cer_der_b64str and key_der_b64str and password:
47-
48- fname_cer_der = certificate_lib.b64str_to_tempfile(
49+ fname_cer_der = certificate_lib.b64str_to_tempfile(cr, uid, ids,
50 cer_der_b64str, file_suffix='.der.cer',
51- file_prefix='openerp__' + (False or '') + '__ssl__', )
52- fname_key_der = certificate_lib.b64str_to_tempfile(
53+ file_prefix='openerp__' + (False or '') + '__ssl__', context=context )
54+ fname_key_der = certificate_lib.b64str_to_tempfile(cr, uid, ids,
55 key_der_b64str, file_suffix='.der.key',
56- file_prefix='openerp__' + (False or '') + '__ssl__', )
57- fname_password = certificate_lib.b64str_to_tempfile(
58- base64.encodestring(password), file_suffix='der.txt',
59- file_prefix='openerp__' + (False or '') + '__ssl__', )
60- fname_tmp = certificate_lib.b64str_to_tempfile(
61+ file_prefix='openerp__' + (False or '') + '__ssl__', context=context)
62+ fname_password = certificate_lib.b64str_to_tempfile(cr, uid, ids,
63+ base64.encodestring(password), file_suffix='der.txt',
64+ file_prefix='openerp__' + (False or '') + '__ssl__', context=context)
65+ fname_tmp = certificate_lib.b64str_to_tempfile(cr, uid, ids,
66 '', file_suffix='tmp.txt', file_prefix='openerp__' + (
67- False or '') + '__ssl__', )
68+ False or '') + '__ssl__', context=context)
69
70 cer_pem = certificate_lib._transform_der_to_pem(
71 fname_cer_der, fname_tmp, type_der='cer')
72@@ -132,11 +133,10 @@
73 fname_key_der, fname_tmp, fname_password, type_der='key')
74 key_pem_b64 = base64.encodestring(key_pem)
75
76- # date_fmt_return='%Y-%m-%d %H:%M:%S'
77 date_fmt_return = '%Y-%m-%d'
78 serial = False
79 try:
80- serial = certificate_lib._get_param_serial(
81+ serial = certificate_lib._get_param_serial(cr, uid, ids,
82 fname_cer_der, fname_tmp, type='DER')
83 value.update({
84 'serial_number': serial,
85@@ -146,7 +146,7 @@
86 date_start = False
87 date_end = False
88 try:
89- dates = certificate_lib._get_param_dates(fname_cer_der,
90+ dates = certificate_lib._get_param_dates(cr, uid, ids, fname_cer_der,
91 fname_tmp, date_fmt_return=date_fmt_return, type='DER')
92 date_start = dates.get('startdate', False)
93 date_end = dates.get('enddate', False)
94
95=== modified file 'l10n_mx_facturae_lib/facturae_lib.py'
96--- l10n_mx_facturae_lib/facturae_lib.py 2013-11-08 03:10:17 +0000
97+++ l10n_mx_facturae_lib/facturae_lib.py 2013-12-04 17:14:19 +0000
98@@ -34,6 +34,7 @@
99 import time
100 import tempfile
101 import base64
102+import binascii
103 import logging
104 _logger = logging.getLogger(__name__)
105 from l10n_mx_facturae_lib import facturae_lib
106@@ -64,6 +65,30 @@
107 app_openssl = 'openssl'
108 app_xmlstarlet = 'xmlstarlet'
109
110+app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
111+if not os.path.isfile(app_openssl_fullpath):
112+ app_openssl_fullpath = tools.find_in_path(app_openssl)
113+ if not os.path.isfile(app_openssl_fullpath):
114+ app_openssl_fullpath = False
115+ _logger.warning('Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.')
116+
117+app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc) or False
118+try:
119+ if not os.path.isfile(app_xsltproc_fullpath):
120+ app_xsltproc_fullpath = tools.find_in_path(app_xsltproc) or False
121+ if not os.path.isfile(app_xsltproc_fullpath):
122+ app_xsltproc_fullpath = False
123+ _logger.warning('Install xsltproc "sudo apt-get install xsltproc" to use l10n_mx_facturae_lib module.')
124+except Exception, e:
125+ _logger.warning("Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module.")
126+
127+app_xmlstarlet_fullpath = os.path.join(xmlstarlet_path, app_xmlstarlet)
128+if not os.path.isfile( app_xmlstarlet_fullpath ):
129+ app_xmlstarlet_fullpath = tools.find_in_path( app_xmlstarlet )
130+ if not app_xmlstarlet_fullpath:
131+ app_xmlstarlet_fullpath = False
132+ _logger.warning('Install xmlstarlet "sudo apt-get install xmlstarlet" to use l10n_mx_facturae_lib module.')
133+
134 def library_openssl_xsltproc_xmlstarlet(self, cr, uid, ids, context=None):
135 if context is None:
136 context = {}
137@@ -103,12 +128,14 @@
138 _auto = False
139 # Agregar find subpath
140
141- def b64str_to_tempfile(self, cr, uid, ids, b64_str="", file_suffix="", file_prefix=""):
142+ def b64str_to_tempfile(self, cr, uid, ids, b64_str=None, file_suffix=None, file_prefix=None, context=None):
143 """
144 @param b64_str : Text in Base_64 format for add in the file
145 @param file_suffix : Sufix of the file
146 @param file_prefix : Name of file in TempFile
147 """
148+ if context is None:
149+ context = {}
150 (fileno, fname) = tempfile.mkstemp(file_suffix, file_prefix)
151 f = open(fname, 'wb')
152 f.write(base64.decodestring(b64_str or ''))