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

Status: Merged
Merged at revision: 337
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0-oml_l10n_mx_settings_facturae_dev_jorge
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 740 lines (+543/-31)
12 files modified
l10n_mx_facturae/__openerp__.py (+1/-0)
l10n_mx_facturae_cbb/__openerp__.py (+1/-0)
l10n_mx_facturae_pac_sf/__openerp__.py (+1/-0)
l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py (+92/-31)
l10n_mx_settings_facturae/__init__.py (+23/-0)
l10n_mx_settings_facturae/__openerp__.py (+53/-0)
l10n_mx_settings_facturae/i18n/es.po (+124/-0)
l10n_mx_settings_facturae/i18n/es_MX.po (+16/-0)
l10n_mx_settings_facturae/i18n/es_VE.po (+16/-0)
l10n_mx_settings_facturae/model/__init__.py (+23/-0)
l10n_mx_settings_facturae/model/res_config.py (+121/-0)
l10n_mx_settings_facturae/view/res_config_view.xml (+72/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0-oml_l10n_mx_settings_facturae_dev_jorge
Reviewer Review Type Date Requested Status
Luis Ernesto García Medina - http://www.vauxoo.com (community) Needs Resubmitting
Isaac López Zúñiga Needs Fixing
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+192935@code.launchpad.net

Description of the change

Se agrega menú de configuración de la facturación electrónica en el cual se configura por compañía la plantilla de correo, el servidor de correo saliente, la platilla del reporte, parámetros del pac y la instalación de los modulos cfd, cfdi y cbb.
Esta propuesta depende del cambio que se realizo en el server de agrinos. pero se realizara la propuesta de merge hacia el server de open-object.

-Se corrige el detalle de enviar un id y no una lista de ids a ir_mail_server para que tome el id del servidor con el que se va enviar.

To post a comment you must log in.
Revision history for this message
Isaac López Zúñiga (isaako34) wrote :

Jorge,
Veo que estas haciendo referencia a data que solo existe como demo (email_template_template_facturae_mx), por lo que no podemos tener código cableado de esta manera.

En algunas líneas si utilizas values.get y en otras no, por lo que debemos usarlo en todas las lineas donde queremos acceder a los valores de algún diccionario.
      values['mail_server_id'] and values['company_id']

Los defaults del servidor de correo saliente no esa considerando si esta activo o inactivo.

Saludos.

review: Needs Fixing
316. By Luis Ernesto García Medina - http://www.vauxoo.com

[IMP][l10n_mx_settings_facturae] Changed the default outgoing mail server to validate that they are active

Revision history for this message
Luis Ernesto García Medina - http://www.vauxoo.com (ernesto-gm) wrote :

Isaac Quedaron los cambios que pediste en el comentario, podrías checar por favor

review: Needs Resubmitting
317. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][l10n_mx_settings_facturae] new function was added to load by default a report for the company take new fields of ir_actions_report_xml

318. By Luis Ernesto García Medina - http://www.vauxoo.com

[autopep][l10n_mx_ir_attachment_facturae] applied autopep 8 to ir_attachment_facturae.py

Revision history for this message
Luis Ernesto García Medina - http://www.vauxoo.com (ernesto-gm) wrote :

Isaac se aplico autopep8 al archivo ir_attachment_facturae.py

review: Needs Resubmitting
319. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][l10n_mx_settings_facturae] added dependence to module ir_actions_report_xml_multicompany

320. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][l10n_mx_ir_attachment_facturae] add try in function signal_cancel

321. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][l10n_mx_ir_attachment_facturae] resolve conflicts

322. By Luis Ernesto García Medina - http://www.vauxoo.com

[MERGE] from lp:openerp-mexico-localization/7.0 revno 327

323. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][l10n_mx_settings_facturae] Improvement search of template report
[IMP][l10n_mx_ir_attachment_facturae] Get name of report of model ir.actions.report.xml

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_mx_facturae/__openerp__.py'
2--- l10n_mx_facturae/__openerp__.py 2013-09-26 02:52:32 +0000
3+++ l10n_mx_facturae/__openerp__.py 2013-11-14 20:00:21 +0000
4@@ -67,6 +67,7 @@
5 "l10n_mx_base_vat_split",
6 "l10n_mx_facturae_report",
7 "l10n_mx_facturae_group_show_wizards",
8+ "l10n_mx_settings_facturae",
9 ],
10 "demo" : [
11 "demo/l10n_mx_facturae_seq_demo.xml",
12
13=== modified file 'l10n_mx_facturae_cbb/__openerp__.py'
14--- l10n_mx_facturae_cbb/__openerp__.py 2013-09-11 15:05:59 +0000
15+++ l10n_mx_facturae_cbb/__openerp__.py 2013-11-14 20:00:21 +0000
16@@ -49,6 +49,7 @@
17 "l10n_mx_ir_attachment_facturae",
18 "l10n_mx_facturae_report",
19 "l10n_mx_company_multi_address",
20+ "l10n_mx_settings_facturae",
21 ],
22 "demo" : ["demo/l10n_mx_facturae_seq_demo.xml",
23 "demo/account_invoice_cbb_demo.xml",
24
25=== modified file 'l10n_mx_facturae_pac_sf/__openerp__.py'
26--- l10n_mx_facturae_pac_sf/__openerp__.py 2013-09-10 22:43:39 +0000
27+++ l10n_mx_facturae_pac_sf/__openerp__.py 2013-11-14 20:00:21 +0000
28@@ -43,6 +43,7 @@
29 "l10n_mx_ir_attachment_facturae",
30 "l10n_mx_facturae_pac",
31 "l10n_mx_facturae_group_show_wizards",
32+ "l10n_mx_settings_facturae",
33 ],
34 "demo" : [
35 "demo/l10n_mx_facturae_pac_sf_demo.xml",
36
37=== modified file 'l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py'
38--- l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py 2013-11-13 00:00:34 +0000
39+++ l10n_mx_ir_attachment_facturae/ir_attachment_facturae.py 2013-11-14 20:00:21 +0000
40@@ -176,9 +176,9 @@
41 uid, self._name, ids[0], 'action_confirm', cr)
42 return True
43 except Exception, e:
44- error = tools.ustr( traceback.format_exc() )
45+ error = tools.ustr(traceback.format_exc())
46 self.write(cr, uid, ids, {'msj': error}, context=context)
47- _logger.error( error )
48+ _logger.error(error)
49 return False
50
51 def action_confirm(self, cr, uid, ids, context=None):
52@@ -238,9 +238,9 @@
53 wf_service.trg_validate(uid, self._name, ids[0], 'action_sign', cr)
54 return True
55 except Exception, e:
56- error = tools.ustr( traceback.format_exc() )
57+ error = tools.ustr(traceback.format_exc())
58 self.write(cr, uid, ids, {'msj': error}, context=context)
59- _logger.error( error )
60+ _logger.error(error)
61 return False
62
63 def action_sign(self, cr, uid, ids, context=None):
64@@ -261,9 +261,28 @@
65 (fileno, fname) = tempfile.mkstemp(
66 '.pdf', 'openerp_' + (invoice.fname_invoice or '') + '__facturae__')
67 os.close(fileno)
68- report = invoice_obj.create_report(cr, SUPERUSER_ID, [invoice.id],
69- "account.invoice.facturae.webkit",
70- fname)
71+ #~ report = invoice_obj.create_report(cr, uid, [invoice.id],
72+ #~ "account.invoice.facturae.webkit",
73+ #~ fname)
74+
75+ actions_obj = self.pool.get('ir.actions.report.xml')
76+ report_ids = actions_obj.search(
77+ cr, uid, [('model', '=', 'account.invoice'),('active', '=', True), ('report_type', '=', 'webkit'),
78+ ('company_id','=',invoice.company_id.id)],order='sequence', limit=1) or False
79+
80+ if report_ids:
81+ report_name = actions_obj.browse(cr, uid, report_ids[0]).report_name
82+ if report_name:
83+ report = invoice_obj.create_report(
84+ cr, SUPERUSER_ID, [invoice.id],
85+ report_name,
86+ invoice.fname_invoice)
87+ else:
88+ report = invoice_obj.create_report(
89+ cr, SUPERUSER_ID, [invoice.id],
90+ "account.invoice.facturae.webkit",
91+ invoice.fname_invoice)
92+
93 attachment_ids = attachment_obj.search(cr, uid, [
94 ('res_model', '=', 'account.invoice'),
95 ('res_id', '=', invoice.id),
96@@ -287,9 +306,9 @@
97 uid, self._name, ids[0], 'action_printable', cr)
98 return True
99 except Exception, e:
100- error = tools.ustr( traceback.format_exc() )
101+ error = tools.ustr(traceback.format_exc())
102 self.write(cr, uid, ids, {'msj': error}, context=context)
103- _logger.error( error )
104+ _logger.error(error)
105 return False
106
107 def action_printable(self, cr, uid, ids, context=None):
108@@ -346,13 +365,34 @@
109 mail_compose_message_pool = self.pool.get(
110 'mail.compose.message')
111 email_pool = self.pool.get('email.template')
112- tmp_id = email_pool.search(
113- cr, uid, [('model_id.model', '=', 'account.invoice'),
114- ('company_id', '=', company_id),
115- ('mail_server_id', '=', smtp_server.id),
116- ('report_template.report_name', '=',
117- 'account.invoice.facturae.webkit')
118- ], limit=1, context=context)
119+
120+ actions_obj = self.pool.get('ir.actions.report.xml')
121+ report_ids = actions_obj.search(
122+ cr, uid, [('model', '=', 'account.invoice'),('active', '=', True), ('report_type', '=', 'webkit'),
123+ ('company_id','=',invoice.company_id.id)],order='sequence', limit=1) or False
124+ if report_ids:
125+ report_name = actions_obj.browse(cr, uid, report_ids[0]).report_name
126+ if report_name:
127+ tmp_id = email_pool.search(
128+ cr, uid, [(
129+ 'model_id.model', '=', 'account.invoice'),
130+ ('company_id',
131+ '=', company_id),
132+ ('mail_server_id',
133+ '=', smtp_server.id),
134+ ('report_template.report_name', '=',
135+ report_name)
136+ ], limit=1, context=context)
137+ else:
138+ tmp_id = email_pool.search(
139+ cr, uid, [(
140+ 'model_id.model', '=', 'account.invoice'),
141+ ('company_id', '=', company_id),
142+ ('mail_server_id', '=', smtp_server.id),
143+ ('report_template.report_name', '=',
144+ 'account.invoice.facturae.webkit')
145+ ], limit=1, context=context)
146+
147 if tmp_id:
148 message = mail_compose_message_pool.onchange_template_id(
149 cr, uid, [], template_id=tmp_id[
150@@ -389,9 +429,10 @@
151 msj = _('Email Send Successfully.Attached is sent to %s for Outgoing Mail Server %s') % (
152 partner_mail, server_name)
153 self.write(cr, uid, ids, {
154- 'msj': msj,
155- 'last_date': time.strftime('%Y-%m-%d %H:%M:%S')})
156- wf_service.trg_validate( uid, self._name, ids[0], 'action_send_customer', cr)
157+ 'msj': msj,
158+ 'last_date': time.strftime('%Y-%m-%d %H:%M:%S')})
159+ wf_service.trg_validate(
160+ uid, self._name, ids[0], 'action_send_customer', cr)
161 return True
162 else:
163 raise osv.except_osv(
164@@ -406,9 +447,9 @@
165 raise osv.except_osv(_('Warning'), _('Not Found\
166 outgoing mail server.Configure the outgoing mail server named "FacturaE"'))
167 except Exception, e:
168- error = tools.ustr( traceback.format_exc() )
169+ error = tools.ustr(traceback.format_exc())
170 self.write(cr, uid, ids, {'msj': error}, context=context)
171- _logger.error( error )
172+ _logger.error(error)
173 return False
174
175 def action_send_customer(self, cr, uid, ids, context=None):
176@@ -428,11 +469,11 @@
177 uid, self._name, ids[0], 'action_send_backup', cr)
178 return True
179 except Exception, e:
180- error = tools.ustr( traceback.format_exc() )
181+ error = tools.ustr(traceback.format_exc())
182 self.write(cr, uid, ids, {'msj': error}, context=context)
183- _logger.error( error )
184+ _logger.error(error)
185 return False
186-
187+
188 def action_send_backup(self, cr, uid, ids, context=None):
189 return self.write(cr, uid, ids, {'state': 'sent_backup'}, context=context)
190
191@@ -449,9 +490,9 @@
192 wf_service.trg_validate(uid, self._name, ids[0], 'action_done', cr)
193 return True
194 except Exception, e:
195- error = tools.ustr( traceback.format_exc() )
196+ error = tools.ustr(traceback.format_exc())
197 self.write(cr, uid, ids, {'msj': error}, context=context)
198- _logger.error( error )
199+ _logger.error(error)
200 return False
201
202 def action_done(self, cr, uid, ids, context=None):
203@@ -545,9 +586,9 @@
204 }, context=context)
205 status_forward = True
206 except Exception, e:
207- error = tools.ustr( traceback.format_exc() )
208+ error = tools.ustr(traceback.format_exc())
209 self.write(cr, uid, ids, {'msj': error}, context=context)
210- _logger.error( error )
211+ _logger.error(error)
212 status_forward = False
213 return status_forward
214
215@@ -556,10 +597,30 @@
216 _inherit = 'ir.attachment'
217
218 def unlink(self, cr, uid, ids, context=None):
219- attachments = self.pool.get('ir.attachment.facturae.mx').search(cr, SUPERUSER_ID, ['|',
220- '|', ( 'file_input', 'in', ids), ('file_xml_sign', 'in', ids), ('file_pdf', 'in',
221- ids)])
222+ attachments = self.pool.get(
223+ 'ir.attachment.facturae.mx').search(cr, SUPERUSER_ID, ['|',
224+ '|', ('file_input', 'in', ids), ('file_xml_sign', 'in', ids), ('file_pdf', 'in',
225+ ids)])
226 if attachments:
227 raise osv.except_osv(_('Warning!'), _(
228 'You can not remove an attachment of an invoice'))
229 return super(ir_attachment, self).unlink(cr, uid, ids, context=context)
230+
231+
232+class ir_mail_server(osv.Model):
233+ _inherit = 'ir.mail_server'
234+
235+ def send_email(
236+ self, cr, uid, message, mail_server_id=None, smtp_server=None, smtp_port=None,
237+ smtp_user=None, smtp_password=None, smtp_encryption=None, smtp_debug=False,
238+ context=None):
239+ obj_ir_mail_server = self.pool.get('ir.mail_server')
240+ company_id = self.pool.get('res.users').browse(
241+ cr, uid, uid, context=context).company_id.id
242+ mail_server_id = obj_ir_mail_server.search(cr, uid,
243+ ['|', ('company_id', '=', company_id), ('company_id', '=', False)], limit=1, order='sequence', context=None)[0]
244+ super(
245+ ir_mail_server, self).send_email(cr, uid, message, mail_server_id=mail_server_id, smtp_server=None, smtp_port=None,
246+ smtp_user=None, smtp_password=None, smtp_encryption=None, smtp_debug=False,
247+ context=None)
248+ return True
249
250=== added directory 'l10n_mx_settings_facturae'
251=== added file 'l10n_mx_settings_facturae/__init__.py'
252--- l10n_mx_settings_facturae/__init__.py 1970-01-01 00:00:00 +0000
253+++ l10n_mx_settings_facturae/__init__.py 2013-11-14 20:00:21 +0000
254@@ -0,0 +1,23 @@
255+#!/usr/bin/python
256+# -*- encoding: utf-8 -*-
257+#
258+# Module Writen to OpenERP, Open Source Management Solution
259+# Copyright (C) Vauxoo (<http://vauxoo.com>).
260+# All Rights Reserved
261+#
262+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@vauxoo.com)
263+#
264+# This program is free software: you can redistribute it and/or modify
265+# it under the terms of the GNU Affero General Public License as published by
266+# the Free Software Foundation, either version 3 of the License, or
267+# (at your option) any later version.
268+#
269+# This program is distributed in the hope that it will be useful,
270+# but WITHOUT ANY WARRANTY; without even the implied warranty of
271+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
272+# GNU Affero General Public License for more details.
273+#
274+# You should have received a copy of the GNU Affero General Public License
275+# along with this program. If not, see <http://www.gnu.org/licenses/>.
276+#
277+import model
278
279=== added file 'l10n_mx_settings_facturae/__openerp__.py'
280--- l10n_mx_settings_facturae/__openerp__.py 1970-01-01 00:00:00 +0000
281+++ l10n_mx_settings_facturae/__openerp__.py 2013-11-14 20:00:21 +0000
282@@ -0,0 +1,53 @@
283+#!/usr/bin/python
284+# -*- encoding: utf-8 -*-
285+#
286+# Module Writen to OpenERP, Open Source Management Solution
287+# Copyright (C) Vauxoo (<http://vauxoo.com>).
288+# All Rights Reserved
289+#
290+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@vauxoo.com)
291+#
292+# This program is free software: you can redistribute it and/or modify
293+# it under the terms of the GNU Affero General Public License as published by
294+# the Free Software Foundation, either version 3 of the License, or
295+# (at your option) any later version.
296+#
297+# This program is distributed in the hope that it will be useful,
298+# but WITHOUT ANY WARRANTY; without even the implied warranty of
299+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
300+# GNU Affero General Public License for more details.
301+#
302+# You should have received a copy of the GNU Affero General Public License
303+# along with this program. If not, see <http://www.gnu.org/licenses/>.
304+#
305+{
306+ "name": "Electronic Invoicing Settings",
307+ "version": "1.0",
308+ "depends": [
309+ 'base',
310+ 'account',
311+ 'email_template',
312+ 'email_template_multicompany',
313+ 'ir_actions_report_xml_multicompany'
314+ ],
315+ "author": "Vauxoo",
316+ "description" : """
317+Electronic Invoicing Settings
318+=============================
319+
320+This module helps to configure the electronic invoicing CFD, CBB and CFDI,
321+with this module you can configure the email template and report template
322+for electronic invoicing, also your outgoing mail server by company.
323+
324+ """,
325+ "website": "http://vauxoo.com",
326+ "category": "Addons Vauxoo",
327+ "demo": [],
328+ "test": [],
329+ "data": [
330+ 'view/res_config_view.xml',
331+ ],
332+ 'application': True,
333+ "active": False,
334+ "installable": True,
335+}
336
337=== added directory 'l10n_mx_settings_facturae/i18n'
338=== added file 'l10n_mx_settings_facturae/i18n/es.po'
339--- l10n_mx_settings_facturae/i18n/es.po 1970-01-01 00:00:00 +0000
340+++ l10n_mx_settings_facturae/i18n/es.po 2013-11-14 20:00:21 +0000
341@@ -0,0 +1,124 @@
342+# Translation of OpenERP Server.
343+# This file contains the translation of the following modules:
344+# * l10n_mx_settings_facturae
345+#
346+msgid ""
347+msgstr ""
348+"Project-Id-Version: OpenERP Server 7.0\n"
349+"Report-Msgid-Bugs-To: \n"
350+"POT-Creation-Date: 2013-10-07 15:01+0000\n"
351+"PO-Revision-Date: 2013-10-07 15:01+0000\n"
352+"Last-Translator: <>\n"
353+"Language-Team: \n"
354+"MIME-Version: 1.0\n"
355+"Content-Type: text/plain; charset=UTF-8\n"
356+"Content-Transfer-Encoding: \n"
357+"Plural-Forms: \n"
358+
359+#. module: l10n_mx_settings_facturae
360+#: view:facturae.config.settings:0
361+#: model:ir.actions.act_window,name:l10n_mx_settings_facturae.action_facturae_config
362+#: model:ir.ui.menu,name:l10n_mx_settings_facturae.menu_facturae_config
363+msgid "Electronic Invoicing Settings"
364+msgstr "Configuraciones de Facturación Electrónica"
365+
366+#. module: l10n_mx_settings_facturae
367+#: field:facturae.config.settings,module_l10n_mx_facturae_pac_sf:0
368+msgid "Electronic Invoicing CFDI"
369+msgstr "Facturación Electrónica CFDI"
370+
371+#. module: l10n_mx_settings_facturae
372+#: model:ir.model,name:l10n_mx_settings_facturae.model_facturae_config_settings
373+msgid "facturae.config.settings"
374+msgstr "facturae.config.settings"
375+
376+#. module: l10n_mx_settings_facturae
377+#: field:facturae.config.settings,module_l10n_mx_facturae:0
378+msgid "Electronic Invoicing CFD"
379+msgstr "Facturación Electrónica CFD"
380+
381+#. module: l10n_mx_settings_facturae
382+#: field:facturae.config.settings,email_tmp_id:0
383+msgid "Email Template"
384+msgstr "Plantilla email"
385+
386+#. module: l10n_mx_settings_facturae
387+#: field:facturae.config.settings,module_l10n_mx_facturae_cbb:0
388+msgid "Electronic Invoicing CBB"
389+msgstr "Facturación Electrónica CBB"
390+
391+#. module: l10n_mx_settings_facturae
392+#: field:facturae.config.settings,company_id:0
393+msgid "Company"
394+msgstr "Compañía"
395+
396+#. module: l10n_mx_settings_facturae
397+#: field:facturae.config.settings,mail_server_id:0
398+msgid "Outgoing Mail Server"
399+msgstr "Servidores de correo saliente"
400+
401+#. module: l10n_mx_settings_facturae
402+#: help:facturae.config.settings,mail_server_id:0
403+msgid "This outgoing mail server will be assigned by your company"
404+msgstr "Este servidor de correo saliente será asigando por su compañia"
405+
406+#. module: l10n_mx_settings_facturae
407+#: help:facturae.config.settings,temp_report_id:0
408+msgid "This report template will be assigned for electronic invoicing in your company"
409+msgstr "Esta plantilla de reporte será asignada para la facturación electrónica en su empresa"
410+
411+#. module: l10n_mx_settings_facturae
412+#: view:facturae.config.settings:0
413+msgid "Parameters PAC"
414+msgstr "Parametros PAC"
415+
416+#. module: l10n_mx_settings_facturae
417+#: help:facturae.config.settings,email_tmp_id:0
418+msgid "This email template will be assigned for electronic invoicing in your company"
419+msgstr "Esta plantilla de email será asignada para la facturación electrónica en su empresa"
420+
421+#. module: l10n_mx_settings_facturae
422+#: help:facturae.config.settings,module_l10n_mx_facturae_cbb:0
423+msgid "This installs the module electronic invoicing CBB"
424+msgstr "Se instalará el módulo de Facturación Electrónica CBB"
425+
426+#. module: l10n_mx_settings_facturae
427+#: help:facturae.config.settings,module_l10n_mx_facturae:0
428+msgid "This installs the module electronic invoicing CFD"
429+msgstr "Se instalará el módulo de Facturación Electrónica CFD"
430+
431+#. module: l10n_mx_settings_facturae
432+#: view:facturae.config.settings:0
433+msgid "Electronic Invoicing"
434+msgstr "Facturación Electrónica"
435+
436+#. module: l10n_mx_settings_facturae
437+#: view:facturae.config.settings:0
438+msgid "Cancel"
439+msgstr "Cancelar"
440+
441+#. module: l10n_mx_settings_facturae
442+#: view:facturae.config.settings:0
443+msgid "Apply"
444+msgstr "Aplicar"
445+
446+#. module: l10n_mx_settings_facturae
447+#: help:facturae.config.settings,module_l10n_mx_facturae_pac_sf:0
448+msgid "This installs the module electronic invoicing CFDI"
449+msgstr "Se instalará el módulo de Facturación Electrónica CFDI"
450+
451+#. module: l10n_mx_settings_facturae
452+#: view:facturae.config.settings:0
453+msgid "or"
454+msgstr "ó"
455+
456+#. module: l10n_mx_settings_facturae
457+#: view:facturae.config.settings:0
458+msgid "Configure your Parameters PAC"
459+msgstr "Configurar sus Parametros de PAC"
460+
461+#. module: l10n_mx_settings_facturae
462+#: field:facturae.config.settings,temp_report_id:0
463+msgid "Report Template"
464+msgstr "Plantilla de reporte"
465+
466
467=== added file 'l10n_mx_settings_facturae/i18n/es_MX.po'
468--- l10n_mx_settings_facturae/i18n/es_MX.po 1970-01-01 00:00:00 +0000
469+++ l10n_mx_settings_facturae/i18n/es_MX.po 2013-11-14 20:00:21 +0000
470@@ -0,0 +1,16 @@
471+# Translation of OpenERP Server.
472+# This file contains the translation of the following modules:
473+# * l10n_mx_settings_facturae
474+#
475+msgid ""
476+msgstr ""
477+"Project-Id-Version: OpenERP Server 7.0\n"
478+"Report-Msgid-Bugs-To: \n"
479+"POT-Creation-Date: 2013-10-07 15:01+0000\n"
480+"PO-Revision-Date: 2013-10-07 15:01+0000\n"
481+"Last-Translator: <>\n"
482+"Language-Team: \n"
483+"MIME-Version: 1.0\n"
484+"Content-Type: text/plain; charset=UTF-8\n"
485+"Content-Transfer-Encoding: \n"
486+"Plural-Forms: \n"
487
488=== added file 'l10n_mx_settings_facturae/i18n/es_VE.po'
489--- l10n_mx_settings_facturae/i18n/es_VE.po 1970-01-01 00:00:00 +0000
490+++ l10n_mx_settings_facturae/i18n/es_VE.po 2013-11-14 20:00:21 +0000
491@@ -0,0 +1,16 @@
492+# Translation of OpenERP Server.
493+# This file contains the translation of the following modules:
494+# * l10n_mx_settings_facturae
495+#
496+msgid ""
497+msgstr ""
498+"Project-Id-Version: OpenERP Server 7.0\n"
499+"Report-Msgid-Bugs-To: \n"
500+"POT-Creation-Date: 2013-10-07 15:01+0000\n"
501+"PO-Revision-Date: 2013-10-07 15:01+0000\n"
502+"Last-Translator: <>\n"
503+"Language-Team: \n"
504+"MIME-Version: 1.0\n"
505+"Content-Type: text/plain; charset=UTF-8\n"
506+"Content-Transfer-Encoding: \n"
507+"Plural-Forms: \n"
508
509=== added directory 'l10n_mx_settings_facturae/model'
510=== added file 'l10n_mx_settings_facturae/model/__init__.py'
511--- l10n_mx_settings_facturae/model/__init__.py 1970-01-01 00:00:00 +0000
512+++ l10n_mx_settings_facturae/model/__init__.py 2013-11-14 20:00:21 +0000
513@@ -0,0 +1,23 @@
514+#!/usr/bin/python
515+# -*- encoding: utf-8 -*-
516+#
517+# Module Writen to OpenERP, Open Source Management Solution
518+# Copyright (C) Vauxoo (<http://vauxoo.com>).
519+# All Rights Reserved
520+#
521+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@vauxoo.com)
522+#
523+# This program is free software: you can redistribute it and/or modify
524+# it under the terms of the GNU Affero General Public License as published by
525+# the Free Software Foundation, either version 3 of the License, or
526+# (at your option) any later version.
527+#
528+# This program is distributed in the hope that it will be useful,
529+# but WITHOUT ANY WARRANTY; without even the implied warranty of
530+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
531+# GNU Affero General Public License for more details.
532+#
533+# You should have received a copy of the GNU Affero General Public License
534+# along with this program. If not, see <http://www.gnu.org/licenses/>.
535+#
536+import res_config
537
538=== added file 'l10n_mx_settings_facturae/model/res_config.py'
539--- l10n_mx_settings_facturae/model/res_config.py 1970-01-01 00:00:00 +0000
540+++ l10n_mx_settings_facturae/model/res_config.py 2013-11-14 20:00:21 +0000
541@@ -0,0 +1,121 @@
542+# -*- coding: utf-8 -*-
543+#
544+#
545+# OpenERP, Open Source Business Applications
546+# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
547+#
548+# This program is free software: you can redistribute it and/or modify
549+# it under the terms of the GNU Affero General Public License as
550+# published by the Free Software Foundation, either version 3 of the
551+# License, or (at your option) any later version.
552+#
553+# This program is distributed in the hope that it will be useful,
554+# but WITHOUT ANY WARRANTY; without even the implied warranty of
555+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
556+# GNU Affero General Public License for more details.
557+#
558+# You should have received a copy of the GNU Affero General Public License
559+# along with this program. If not, see <http://www.gnu.org/licenses/>.
560+#
561+#
562+
563+import time
564+import datetime
565+from dateutil.relativedelta import relativedelta
566+from operator import itemgetter
567+from os.path import join as opj
568+
569+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
570+from openerp.tools.translate import _
571+from openerp.osv import fields, osv
572+from openerp import tools
573+from openerp import SUPERUSER_ID
574+
575+
576+class facturae_config_settings(osv.osv_memory):
577+ _name = 'facturae.config.settings'
578+ _inherit = 'res.config.settings'
579+
580+ _columns = {
581+ 'company_id': fields.many2one('res.company', 'Company',),
582+ 'module_l10n_mx_facturae': fields.boolean('Electronic Invoicing CFD',
583+ help="""This installs the module electronic invoicing CFD"""),
584+ 'module_l10n_mx_facturae_cbb': fields.boolean('Electronic Invoicing CBB',
585+ help="""This installs the module electronic invoicing CBB"""),
586+ 'module_l10n_mx_facturae_pac_sf': fields.boolean('Electronic Invoicing CFDI',
587+ help="""This installs the module electronic invoicing CFDI"""),
588+ 'email_tmp_id': fields.many2one('email.template', 'Email Template',
589+ help="""This email template will be assigned for electronic invoicing in your company"""),
590+ 'temp_report_id': fields.many2one('ir.actions.report.xml', 'Report Template',
591+ help="""This report template will be assigned for electronic invoicing in your company"""),
592+ 'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing Mail Server',
593+ help="""This outgoing mail server will be assigned by your company"""),
594+ }
595+
596+ def open_parameters_pac(self, cr, uid, ids, context=None):
597+ return {
598+ 'type': 'ir.actions.act_window',
599+ 'name': 'Parameters Pac',
600+ 'view_mode': 'tree,form',
601+ 'res_model': 'params.pac',
602+ }
603+
604+ def _default_company(self, cr, uid, context=None):
605+ user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
606+ return user.company_id.id
607+
608+ _defaults = {
609+ 'company_id': _default_company,
610+ }
611+
612+ def get_default_email_tmp_id(self, cr, uid, fields, context=None):
613+ company_id = self.pool.get('res.users').browse(
614+ cr, uid, uid, context=context).company_id.id
615+ email_obj = self.pool.get('email.template')
616+ email_tmp_id = False
617+ dat = email_obj.search(
618+ cr, uid, [('model', 'like', 'account.invoice'), ('company_id', '=', company_id)])
619+ data = dat and dat[0] or False
620+ if data:
621+ email_tmp_id = email_obj.browse(cr, uid, data)
622+ return {'email_tmp_id': email_tmp_id and email_tmp_id.id or False,}
623+
624+ def get_default_mail_server_id(self, cr, uid, fields, context=None):
625+ company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
626+ mail_server_obj = self.pool.get('ir.mail_server')
627+ mail_server_id = mail_server_obj.search(cr, uid, [('company_id', '=', company_id),
628+ ('active', '=', True)], order = 'sequence', limit = 1)
629+ return {'mail_server_id': mail_server_id or False}
630+
631+ def get_default_temp_report_id(self, cr, uid, fields, context=None):
632+ company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
633+ temp_report_obj = self.pool.get('ir.actions.report.xml')
634+ temp_report_id = temp_report_obj.search(cr, uid, [('company_id', '=', company_id),
635+ ('active', '=', True), ('report_type', '=', 'webkit'),
636+ ('model', '=', 'account.invoice')], limit = 1)
637+ return {'temp_report_id': temp_report_id or False}
638+
639+ def create(self, cr, uid, values, context=None):
640+ confg_id = super(facturae_config_settings, self).create(
641+ cr, uid, values, context)
642+ if values.get('mail_server_id') and values.get('company_id') and values.get('email_tmp_id') and values.get('temp_report_id'):
643+ email_obj = self.pool.get('email.template')
644+ actions_obj = self.pool.get('ir.actions.report.xml')
645+ webkit_header_obj = self.pool.get('ir.header_webkit')
646+ report_data = actions_obj.browse(
647+ cr, SUPERUSER_ID, [values.get('temp_report_id')])
648+ confg_data = self.browse(cr, uid, confg_id, context=context)
649+ if report_data:
650+ actions_obj.write(cr, uid, [values.get('temp_report_id')], {
651+ 'company_id': confg_data.company_id.id}, context=context)
652+ webkit_header_obj.write(cr, SUPERUSER_ID, [report_data[0].webkit_header.id], {
653+ 'company_id': confg_data.company_id.id}, context=context)
654+ email_obj.write(cr, uid, [confg_data.email_tmp_id.id], {
655+ 'company_id': confg_data.company_id.id,
656+ 'mail_server_id': confg_data.mail_server_id.id,
657+ 'report_template': values['temp_report_id']},
658+ context=context)
659+
660+ return confg_id
661+
662+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
663
664=== added directory 'l10n_mx_settings_facturae/view'
665=== added file 'l10n_mx_settings_facturae/view/res_config_view.xml'
666--- l10n_mx_settings_facturae/view/res_config_view.xml 1970-01-01 00:00:00 +0000
667+++ l10n_mx_settings_facturae/view/res_config_view.xml 2013-11-14 20:00:21 +0000
668@@ -0,0 +1,72 @@
669+<?xml version="1.0" encoding="utf-8"?>
670+<openerp>
671+ <data>
672+ <record id="view_facturae_config_settings" model="ir.ui.view">
673+ <field name="name">facturae settings</field>
674+ <field name="model">facturae.config.settings</field>
675+ <field name="arch" type="xml">
676+ <form string="Electronic Invoicing Settings" version="7.0" class="oe_form_configuration">
677+ <header>
678+ <button string="Apply" type="object" name="execute" class="oe_highlight"/>
679+ or
680+ <button string="Cancel" type="object" name="cancel" class="oe_link"/>
681+ </header>
682+ <separator string="Electronic Invoicing Settings"/>
683+ <group id="electronic_invoicing_group">
684+ <label for="electronic_invoicing_group" string="Electronic Invoicing"/>
685+ <div>
686+ <div>
687+ <field name="module_l10n_mx_facturae" class="oe_inline"/>
688+ <label for="module_l10n_mx_facturae"/>
689+ </div>
690+ <div>
691+ <field name="module_l10n_mx_facturae_cbb" class="oe_inline"/>
692+ <label for="module_l10n_mx_facturae_cbb"/>
693+ </div>
694+ <div>
695+ <field name="module_l10n_mx_facturae_pac_sf" class="oe_inline"/>
696+ <label for="module_l10n_mx_facturae_pac_sf"/>
697+ </div>
698+ <div>
699+ <label for="company_id"/>
700+ <field name="company_id" class="oe_inline" />
701+ </div>
702+ <div>
703+ <label for="mail_server_id" />
704+ <field name="mail_server_id" class="oe_inline" domain="[('company_id', '=', company_id)]"/>
705+ </div>
706+ <div>
707+ <label for="email_tmp_id" />
708+ <field name="email_tmp_id" class="oe_inline" domain="['|', ('company_id', '=', company_id), ('model','=','account.invoice')]"/>
709+ </div>
710+ <div>
711+ <label for="temp_report_id" />
712+ <field name="temp_report_id" class="oe_inline" domain="[('model','=','account.invoice'),('report_type','=','webkit')]"/>
713+ </div>
714+ </div>
715+ </group>
716+ <group >
717+ <label for="id" string="Parameters PAC" attrs="{'invisible':[('module_l10n_mx_facturae_pac_sf', '!=', True)]}" />
718+ <div>
719+ <div>
720+ <button type="object" name="open_parameters_pac" attrs="{'invisible':[('module_l10n_mx_facturae_pac_sf', '!=', True)]}" string="Configure your Parameters PAC" icon="gtk-execute" class="oe_inline oe_link"/>
721+ </div>
722+ </div>
723+ </group>
724+ </form>
725+ </field>
726+ </record>
727+
728+ <record id="action_facturae_config" model="ir.actions.act_window">
729+ <field name="name">Electronic Invoicing Settings</field>
730+ <field name="type">ir.actions.act_window</field>
731+ <field name="res_model">facturae.config.settings</field>
732+ <field name="view_mode">form</field>
733+ <field name="target">inline</field>
734+ </record>
735+
736+ <menuitem id="menu_facturae_config" name="Electronic Invoicing Settings" parent="base.menu_config"
737+ sequence="27" action="action_facturae_config"/>
738+
739+ </data>
740+</openerp>