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

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 234
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0_l10n_mx_facturae_notes_invoice_dinamic_field_promissory_de_luis
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 208 lines (+148/-4)
5 files modified
l10n_mx_facturae_report/i18n/es.po (+93/-0)
l10n_mx_facturae_report/report/invoice_facturae_html.mako (+1/-1)
l10n_mx_facturae_report/report/invoice_facturae_html.py (+16/-0)
l10n_mx_notes_invoice/res_company.py (+26/-2)
l10n_mx_notes_invoice/res_company_view.xml (+12/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0_l10n_mx_facturae_notes_invoice_dinamic_field_promissory_de_luis
Reviewer Review Type Date Requested Status
Luis Ernesto García Medina - http://www.vauxoo.com (community) Needs Resubmitting
Luis Torres - http://www.vauxoo.com (community) Needs Resubmitting
Julio Serna-http://www.vauxoo.com Pending
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+172187@code.launchpad.net

Description of the change

Se cambio el campo que se agrega en el reporte de la factura electronica como el 'Debemos y ...', para que sea dinamico

To post a comment you must log in.
231. By Luis Torres - http://www.vauxoo.com

[IMP][l10n_mx_notes_invoice]Better functions and added fields to help

232. By Luis Torres - http://www.vauxoo.com

[IMP][l10n_mx_facturae_report]Added translation

Revision history for this message
Luis Torres - http://www.vauxoo.com (luis-cleto-) wrote :

Se mejoro la manera de realizar la funcion, se agrego ayuda y se agrego traduccion

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

se uso "try-except" para evitar problemas con "dict_var" en caso de que este vacio

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'l10n_mx_facturae_report/i18n'
2=== added file 'l10n_mx_facturae_report/i18n/es.po'
3--- l10n_mx_facturae_report/i18n/es.po 1970-01-01 00:00:00 +0000
4+++ l10n_mx_facturae_report/i18n/es.po 2013-07-16 19:12:25 +0000
5@@ -0,0 +1,93 @@
6+# Translation of OpenERP Server.
7+# This file contains the translation of the following modules:
8+# * l10n_mx_notes_invoice
9+#
10+msgid ""
11+msgstr ""
12+"Project-Id-Version: OpenERP Server 7.0\n"
13+"Report-Msgid-Bugs-To: \n"
14+"POT-Creation-Date: 2013-06-30 06:59+0000\n"
15+"PO-Revision-Date: 2013-06-30 06:59+0000\n"
16+"Last-Translator: <>\n"
17+"Language-Team: \n"
18+"MIME-Version: 1.0\n"
19+"Content-Type: text/plain; charset=UTF-8\n"
20+"Content-Transfer-Encoding: \n"
21+"Plural-Forms: \n"
22+
23+#. module: l10n_mx_notes_invoice
24+#: view:res.company:0
25+msgid "Why fill the information?"
26+msgstr "¿Como llenar la información?"
27+
28+#. module: l10n_mx_notes_invoice
29+#: field:res.company,details:0
30+#: field:res.company,dict_var:0
31+#: field:res.company,sample:0
32+#: field:res.company,sample_dict:0
33+msgid "Variables to use in text"
34+msgstr "Variables usar"
35+
36+#. module: l10n_mx_notes_invoice
37+#: code:addons/l10n_mx_notes_invoice/res_company.py:57
38+#, python-format
39+msgid "If you like put the text \n"
40+"I Partner pay to the order of My Company the amount of $500.00, you need put:"
41+msgstr "Si se quiere colocar el texto \n"
42+"Yo Partner pagaré a la orden de Mi Compañia la cantidad de $500.00, Necesitas colocar:"
43+
44+#. module: l10n_mx_notes_invoice
45+#: field:res.company,sample_text:0
46+msgid "Promissory not"
47+msgstr "Notas Pagaré"
48+
49+#. module: l10n_mx_notes_invoice
50+#: code:addons/l10n_mx_notes_invoice/res_company.py:48
51+#, python-format
52+msgid "In the field 'Promissory note' you need put the text that you like that was colocate in the report as promissory, if you like take a data from the parner, company or the invoice you need create a new variable in the field 'Variables to use in text' as follows : \n'name_variable' : object.value of object, and when you need use an variable you put %(variable)s for use information from an object. \n"
53+"When you need information from the partner, use partner.field that you need from the partner, for company use company.field an equal for an field from invoice."
54+msgstr "En el campo 'Notas pagaré' se necesita colocar el texto que se quiere colocar en el Reporte como leyenda de pagaré, si se quiere tomar un dato del partner, compañia o de la factura se necesita crear una nueva variabe en el campo 'Variables para el texto' como se muestra: \n'nombre_variable' : objeto.valor del objeto, y cuando se necesite usar una variable se colocará %(variable)s para utilizar a informacion del objeto. \n"
55+"Cuando se necesite informacion del partner, usar partner.campo que se necesita, para la compañia usar company.campo, al igual para la factura."
56+
57+#. module: l10n_mx_notes_invoice
58+#: help:res.company,dinamic_text:0
59+msgid "This text will put in the report of Invoice"
60+msgstr "Este texto será utilizado en el reporte de FacturaE"
61+
62+#. module: l10n_mx_notes_invoice
63+#: model:ir.model,name:l10n_mx_notes_invoice.model_res_company
64+msgid "Companies"
65+msgstr "Compañías"
66+
67+#. module: l10n_mx_notes_invoice
68+#: code:addons/l10n_mx_notes_invoice/res_company.py:61
69+#, python-format
70+msgid "'partner_name' : partner.name, 'company_name' : company.name, 'invoice_amount' : invoice.amount_total"
71+msgstr "'partner_name' : partner.name, 'company_name' : company.name, 'invoice_amount' : invoice.amount_total"
72+
73+#. module: l10n_mx_notes_invoice
74+#: view:res.company:0
75+msgid "Sample"
76+msgstr "Ejemplo"
77+
78+#. module: l10n_mx_notes_invoice
79+#: help:res.company,dict_var:0
80+msgid "Put te variables used in text"
81+msgstr "Coloca las variables usadas en el texto"
82+
83+#. module: l10n_mx_notes_invoice
84+#: field:res.company,dinamic_text:0
85+msgid "Promissory note"
86+msgstr "Notas pagaré"
87+
88+#. module: l10n_mx_notes_invoice
89+#: code:addons/l10n_mx_notes_invoice/res_company.py:59
90+#, python-format
91+msgid "'I %(partner_name)s pay to the order of %(company_name)s the amount of %(invoice_amount)s'"
92+msgstr "'Yo %(partner_name)s pagaré a la orden de %(company_name)s la cantidad de %(invoice_amount)s'"
93+
94+#. module: l10n_mx_notes_invoice
95+#: view:res.company:0
96+msgid "Notes Invoice"
97+msgstr "Notas de Factura"
98+
99
100=== modified file 'l10n_mx_facturae_report/report/invoice_facturae_html.mako'
101--- l10n_mx_facturae_report/report/invoice_facturae_html.mako 2013-06-10 20:23:17 +0000
102+++ l10n_mx_facturae_report/report/invoice_facturae_html.mako 2013-07-16 19:12:25 +0000
103@@ -281,7 +281,7 @@
104 </table>
105 %endif
106 <table class="basic_table">
107- <tr><td class="center_td">${ o.company_emitter_id.promissory or ''|entity }</td></tr>
108+ <tr><td class="center_td">${ get_text_promissory(o.company_id, o.partner_id, o) or ''|entity }</td></tr>
109 </table>
110 <!--code for cfd 3.2-->
111 %if o.invoice_sequence_id.approval_id.type == 'cfdi32':
112
113=== modified file 'l10n_mx_facturae_report/report/invoice_facturae_html.py'
114--- l10n_mx_facturae_report/report/invoice_facturae_html.py 2013-06-11 06:21:43 +0000
115+++ l10n_mx_facturae_report/report/invoice_facturae_html.py 2013-07-16 19:12:25 +0000
116@@ -55,6 +55,7 @@
117 'get_sum_total': self._get_sum_total,
118 'has_disc': self._has_disc,
119 'get_data_certificate': self._get_data_certificate,
120+ 'get_text_promissory' : self._get_text_promissory,
121 })
122 self.taxes = []
123
124@@ -237,6 +238,21 @@
125 })
126 return res
127
128+ def _get_text_promissory(self, company, partner, invoice):
129+ text = ''
130+ context = {}
131+ lang = self.pool.get('res.partner').browse(self.cr, self.uid,\
132+ partner.id).lang
133+ if lang:
134+ context.update({'lang' : lang})
135+ company = self.pool.get('res.company').browse(self.cr, self.uid,\
136+ company.id, context=context)
137+ if company.dinamic_text:
138+ try:
139+ text = company.dinamic_text % eval("{" + company.dict_var + "}")
140+ except:
141+ return text
142+ return text
143
144
145 report_sxw.report_sxw('report.account.invoice.facturae.webkit',
146
147=== modified file 'l10n_mx_notes_invoice/res_company.py'
148--- l10n_mx_notes_invoice/res_company.py 2013-05-15 17:48:49 +0000
149+++ l10n_mx_notes_invoice/res_company.py 2013-07-16 19:12:25 +0000
150@@ -34,8 +34,32 @@
151 _inherit = 'res.company'
152
153 _columns = {
154- 'promissory': fields.text('Text promissory facturae',
155- help='This legend is used for the report of Electronic Invoice in the legend of promissory'),
156+ 'dinamic_text' : fields.text('Promissory note', translate=True,
157+ help='This text will put in the report of Invoice'),
158+ 'dict_var' : fields.text('Variables to use in text',
159+ help='Put te variables used in text'),
160+ 'sample_text' : fields.text('Promissory note', readonly=True),
161+ 'sample_dict' : fields.text('Variables to use in text', readonly=True),
162+ 'details' : fields.text('Variables to use in text', readonly=True),
163+ 'sample' : fields.text('Variables to use in text', readonly=True),
164+ }
165+
166+ _defaults = {
167+ 'details' : _("In the field 'Promissory note' you need put the text "\
168+ "that you like that was colocate in the report as promissory, if "\
169+ "you like take a data from the parner, company or the invoice "\
170+ "you need create a new variable in the field 'Variables to use "\
171+ "in text' as follows : \n'name_variable' : object.value of object, "\
172+ "and when you need use an variable you put %(variable)s for use "\
173+ "information from an object. \nWhen you need information from "\
174+ "the partner, use partner.field that you need from the partner, "\
175+ "for company use company.field an equal for an field from invoice."),
176+ 'sample' : _('If you like put the text \nI Partner pay to the order of '\
177+ 'My Company the amount of $500.00, you need put:'),
178+ 'sample_text' : _("'I %(partner_name)s pay to the order of %(company_"\
179+ "name)s the amount of %(invoice_amount)s'"),
180+ 'sample_dict' : _("'partner_name' : partner.name, 'company_name' : "\
181+ "company.name, 'invoice_amount' : invoice.amount_total"),
182 }
183
184 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
185
186=== modified file 'l10n_mx_notes_invoice/res_company_view.xml'
187--- l10n_mx_notes_invoice/res_company_view.xml 2013-04-20 00:14:08 +0000
188+++ l10n_mx_notes_invoice/res_company_view.xml 2013-07-16 19:12:25 +0000
189@@ -9,7 +9,18 @@
190 <field name="arch" type="xml">
191 <xpath expr="//page[@string='Configuration']" position="after">
192 <page string="Notes Invoice">
193- <field name="promissory"/>
194+ <group>
195+ <field name="dinamic_text"/>
196+ <field name="dict_var"/>
197+ </group>
198+ <separator string='Why fill the information?'/>
199+ <field name="details"/>
200+ <separator string='Sample'/>
201+ <field name="sample"/>
202+ <group>
203+ <field name="sample_text"/>
204+ <field name="sample_dict"/>
205+ </group>
206 </page>
207 </xpath>
208 </field>