Corrección V15: Factura en pesos pago en dólar mismo tipo de cambio
Resumen
Al tener una factura emitida en pesos mexicanos ya timbrada, se requiere timbrar un pago en dólares americanos, pero al intentar timbrarlo arroja un error.
Pasos para reproducirlo
- Crear una factura con cualquier cliente, esta debe ser en pesos mexicanos y debemos agregar un producto a las líneas de la factura con IVA 16.
- Timbrar la factura
- Registrar pago para la factura creada anteriormente en dólares
- Timbrar pago
¿Cuál es el comportamiento equivocado que se está presentando?
Marca el siguiente error al intentar timbrar el pago
odoo.addons.base.models.qweb.QWebException: 'account.payment' object has no attribute 'payment_rate'
Traceback (most recent call last):
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/qweb.py", line 221, in render_template
yield from compiled_fn(self, values, log)
File "<template_815>", line 17, in template_815
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 347, in totales_p
impuestos = self.impuestos_p(tax_type=tax_type)
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 403, in impuestos_p
special_currency_rate=(1 / self.tipocambiodr(invoice)),
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 303, in tipocambiodr
special_currency_rate=(1 / self.payment_rate),
AttributeError: 'account.payment' object has no attribute 'payment_rate'
Error when render the template
AttributeError: 'account.payment' object has no attribute 'payment_rate'
Template: 815
Path: /t/t[5]
Node: <t t-set="traslados" t-value="payment.totales_p()"/>
¿Cuál es el comportamiento correcto esperado?
Al intentar timbrar el pago en dólares americanos de una factura emitida en pesos mexicanos se debe timbrar de manera correcta generando el UUID, el xml y pdf.
Logs relevantes y/o capturas de pantalla
Traceback (most recent call last):
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/qweb.py", line 221, in render_template
yield from compiled_fn(self, values, log)
File "<template_815>", line 17, in template_815
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 347, in totales_p
impuestos = self.impuestos_p(tax_type=tax_type)
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 403, in impuestos_p
special_currency_rate=(1 / self.tipocambiodr(invoice)),
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 303, in tipocambiodr
special_currency_rate=(1 / self.payment_rate),
AttributeError: 'account.payment' object has no attribute 'payment_rate'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 921, in __call__
return self.method(*args, **kw)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/addons/web/controllers/main.py", line 1328, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/addons/web/controllers/main.py", line 1316, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/api.py", line 471, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/api.py", line 456, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 114, in sign_payment
receipt.create_cfdi()
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_ir_attachment_facturae/l10n_mx_ir_attachment_facturae/models/base_cfdi_mixin.py", line 141, in create_cfdi
record.cfdi_id.action_validate()
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_ir_attachment_facturae/l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py", line 533, in action_validate
self.sign_cfdi_sat()
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_ir_attachment_facturae/l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py", line 917, in sign_cfdi_sat
self.create_report_xml()
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_ir_attachment_facturae/l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py", line 839, in create_report_xml
result = self.create_report(record.id, config.template_xml_sign, record._name)
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_ir_attachment_facturae/l10n_mx_ir_attachment_facturae/models/ir_attachment_facturae.py", line 817, in create_report
result, dummy = report._render(
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_actions_report.py", line 980, in _render
return render_func(res_ids, data=data)
File "/home/openpyme/Documentos/locales/bench_15/parts/reporting-engine/report_xml/models/ir_actions_report.py", line 59, in _render_qweb_xml
content, ttype = report_model.generate_report(
File "/home/openpyme/Documentos/locales/bench_15/parts/reporting-engine/report_xml/reports/report_report_xml_abstract.py", line 54, in generate_report
result_bin = ir_report._render_template(ir_report.report_name, data)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_actions_report.py", line 682, in _render_template
return view_obj._render_template(template, values).encode()
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_ui_view.py", line 1994, in _render_template
return self.browse(self.get_view_id(template))._render(values, engine)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/addons/web_editor/models/ir_ui_view.py", line 35, in _render
return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_ui_view.py", line 2002, in _render
return self.env[engine]._render(self.id, qcontext)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/tools/profiler.py", line 292, in _tracked_method_render
return method_render(self, template, values, **options)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/ir_qweb.py", line 76, in _render
result = super()._render(template, values=values, **compile_options)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/qweb.py", line 134, in _render
result = ''.join(rendering)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/qweb.py", line 225, in render_template
raise QWebException("Error when render the template", self, options,
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.addons.base.models.qweb.QWebException: 'account.payment' object has no attribute 'payment_rate'
Traceback (most recent call last):
File "/home/openpyme/Documentos/locales/bench_15/parts/server/odoo/addons/base/models/qweb.py", line 221, in render_template
yield from compiled_fn(self, values, log)
File "<template_815>", line 17, in template_815
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 347, in totales_p
impuestos = self.impuestos_p(tax_type=tax_type)
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 403, in impuestos_p
special_currency_rate=(1 / self.tipocambiodr(invoice)),
File "/home/openpyme/Documentos/locales/bench_15/parts/l10n_mx_facturae/l10n_mx_facturae/models/account_payment.py", line 303, in tipocambiodr
special_currency_rate=(1 / self.payment_rate),
AttributeError: 'account.payment' object has no attribute 'payment_rate'
Error when render the template
AttributeError: 'account.payment' object has no attribute 'payment_rate'
Template: 815
Path: /t/t[5]
Node: <t t-set="traslados" t-value="payment.totales_p()"/>
Versión del sistema y de los módulos
- bench en la rama feat_bench_odoo_15
- l10n_mx_facturae en la rama feat_odoo_15