Commit 5a8c1bb5 authored by Andrea Arce [Vauxoo]'s avatar Andrea Arce [Vauxoo]
Browse files

[IMP] invoice_xunnel: Added to the Document Explorer the field of related_cfdi...

[IMP] invoice_xunnel: Added to the Document Explorer the field of related_cfdi when an XML have a related CFDI
parent a1471c61
Pipeline #81630 passed with stages
in 36 minutes and 24 seconds
......@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-13 23:23+0000\n"
"PO-Revision-Date: 2020-05-13 23:23+0000\n"
"POT-Creation-Date: 2020-05-23 00:35+0000\n"
"PO-Revision-Date: 2020-05-23 00:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
......@@ -27,8 +27,15 @@ msgstr ""
"Además %s archivos han fallado al convertirse.\n"
"Te enviamos un correo con los detalles de las facturas que fallaron."
#. module: invoice_xunnel
#: code:addons/invoice_xunnel/wizards/documents.py:0
#, python-format
msgid " Also %s files have failed at the conversion."
msgstr " Además %s archivos han fallado al convertirse."
#. module: invoice_xunnel
#: code:addons/invoice_xunnel/models/res_company.py:0
#: code:addons/invoice_xunnel/wizards/documents.py:0
#, python-format
msgid "%s xml have been downloaded."
msgstr "%s xml han sido descargados."
......@@ -237,11 +244,6 @@ msgid ""
"<div><strong>Info!</strong> XML data could not be read correctly.</div>"
msgstr ""
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "<i class=\"fa fa-refresh fa-fw\"/> Sync documents"
msgstr "<i class=\"fa fa-refresh fa-fw\"/> Sincronizar adjuntos"
#. module: invoice_xunnel
#. openerp-web
#: code:addons/invoice_xunnel/static/src/js/attach_xmls_org.js:0
......@@ -314,11 +316,15 @@ msgstr "Adjunto"
#. module: invoice_xunnel
#. openerp-web
#: code:addons/invoice_xunnel/static/src/xml/attach_xmls_template.xml:0
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
#, python-format
msgid "Cancel"
msgstr "Cancelar"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
msgid "Close"
msgstr "Cerrar"
#. module: invoice_xunnel
#: model:ir.model,name:invoice_xunnel.model_res_company
msgid "Companies"
......@@ -329,11 +335,6 @@ msgstr "Compañías"
msgid "Company"
msgstr "Compañía"
#. module: invoice_xunnel
#: model:ir.model,name:invoice_xunnel.model_res_config_settings
msgid "Config Settings"
msgstr "Opciones de Configuración"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
msgid "Confirm"
......@@ -379,6 +380,21 @@ msgstr ""
msgid "Document"
msgstr "Documento"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Download attachments"
msgstr "Descargar archivos adjuntos"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Download your SAT's invoices."
msgstr "Descargar sus facturas del SAT"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.documents_search_inherit
msgid "Downloaded XMLs"
msgstr "XMLs Descargados"
#. module: invoice_xunnel
#. openerp-web
#: code:addons/invoice_xunnel/static/src/xml/attach_xmls_template.xml:0
......@@ -486,6 +502,11 @@ msgstr "Asientos contables"
msgid "Journal Item"
msgstr "Apunte contable"
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_documents_document__just_downloaded
msgid "Just Downloaded"
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_attach_xmls_wizard____last_update
#: model:ir.model.fields,field_description:invoice_xunnel.field_xunnel_documents_wizard____last_update
......@@ -494,7 +515,6 @@ msgstr "Última modificación en"
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_res_company__xunnel_last_sync
#: model:ir.model.fields,field_description:invoice_xunnel.field_res_config_settings__xunnel_last_sync
#: model:ir.model.fields,field_description:invoice_xunnel.field_xunnel_documents_wizard__date_from
msgid "Last Sync with Xunnel"
msgstr "Última sincronización con Xunnel"
......@@ -511,6 +531,16 @@ msgstr ""
msgid "Last Updated on"
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_xunnel_documents_wizard__message
msgid "Message"
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_xunnel_documents_wizard__no_attachment_action
msgid "No Attachment Action"
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,field_description:invoice_xunnel.field_attach_xmls_wizard__omit_cfdi_related
msgid "Omit Cfdi Related"
......@@ -546,6 +576,19 @@ msgstr ""
msgid "Reception"
msgstr ""
#. module: invoice_xunnel
#. openerp-web
#: code:addons/invoice_xunnel/static/src/xml/templates.xml:0
#: model:ir.model.fields,field_description:invoice_xunnel.field_documents_document__related_cfdi
#, python-format
msgid "Related CFDI"
msgstr "CFDI Relacionado"
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_documents_document__related_cfdi
msgid "Related CFDI of the XML file"
msgstr "CFDI Relacionado al archivo XML"
#. module: invoice_xunnel
#: model:documents.facet,name:invoice_xunnel.xunnel_xml_facet
msgid "SAT"
......@@ -563,6 +606,11 @@ msgstr "Facturas del SAT anteriores a esta fecha no serán recuperadas."
msgid "Save"
msgstr "Guardar"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
msgid "See XMLs"
msgstr "Ver XMLs"
#. module: invoice_xunnel
#. openerp-web
#: code:addons/invoice_xunnel/static/src/xml/attach_xmls_template.xml:0
......@@ -661,6 +709,24 @@ msgid ""
"Refund (Only as exception)"
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_documents_document__just_downloaded
msgid ""
"Used to identify the just donwloaded attachments.\n"
" To evaluate if an attachment was just downloaded, we need to\n"
" check the current context."
msgstr ""
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_xunnel_documents_wizard__message
msgid "Used to show the synchronization status."
msgstr "Se usa para mostrar el estado de sincronización."
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_xunnel_documents_wizard__no_attachment_action
msgid "Used to toggle the redirect to the attachments."
msgstr "Se usa para alternar la redirección a los archivos adjuntos."
#. module: invoice_xunnel
#: model:documents.tag,name:invoice_xunnel.with_invoice
msgid "With Invoice"
......@@ -728,6 +794,11 @@ msgstr "Facturas Xunnel"
msgid "Xunnel XML synchronization"
msgstr "Xunnel sincronización de XML"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Xunnel attachments"
msgstr "Archivos adjuntos de Xunnel"
#. module: invoice_xunnel
#: model:ir.model,name:invoice_xunnel.model_xunnel_documents_wizard
msgid "Xunnel documents sync"
......@@ -777,49 +848,3 @@ msgstr ""
#, python-format
msgid "or Click to upload the files"
msgstr ""
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
msgid "See XMLs"
msgstr "Ver XMLs"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.xunnel_documents_wizard_view
msgid "Close"
msgstr "Cerrar"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.documents_search_inherit
msgid "Downloaded XMLs"
msgstr "XMLs Descargados"
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_xunnel_documents_wizard__message
msgid "Used to show the synchronization status."
msgstr "Se usa para mostrar el estado de sincronización."
#. module: invoice_xunnel
#: model:ir.model.fields,help:invoice_xunnel.field_xunnel_documents_wizard__no_attachment_action
msgid "Used to toggle the redirect to the attachments."
msgstr "Se usa para alternar la redirección a los archivos adjuntos."
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Xunnel attachments"
msgstr "Archivos adjuntos de Xunnel"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Download your SAT's invoices."
msgstr "Descargar sus facturas del SAT"
#. module: invoice_xunnel
#: model_terms:ir.ui.view,arch_db:invoice_xunnel.view_account_config_settings_xunnel_invoice
msgid "Download attachments"
msgstr "Descargar archivos adjuntos"
#. module: invoice_xunnel
#: code:addons/invoice_xunnel/wizards/documents.py:0
#, python-format
msgid " Also %s files have failed at the conversion."
msgstr " Además %s archivos han fallado al convertirse."
......@@ -35,6 +35,12 @@ class Document(models.Model):
help="In case this is a CFDI file, show invoice's product list",
store=True,
)
related_cfdi = fields.Text(
compute="_compute_related_cfdi",
string='Related CFDI',
help="Related CFDI of the XML file",
store=True,
)
just_downloaded = fields.Boolean(
compute="_compute_just_downloaded",
search="_search_just_downloaded", store=False,
......@@ -99,3 +105,20 @@ class Document(models.Model):
except (AttributeError, SyntaxError):
xml = False
return xml
@api.depends('datas')
def _compute_related_cfdi(self):
documents = self.filtered(
lambda rec: rec.xunnel_document and rec.attachment_id)
for rec in documents:
xml = rec.get_xml_object(rec.datas)
if xml is None:
continue
try:
related_uuid = []
for related in xml.CfdiRelacionados.iter(
'{http://www.sat.gob.mx/cfd/3}CfdiRelacionado'):
related_uuid += [related.get('UUID')]
rec.related_cfdi = json.dumps(related_uuid)
except AttributeError:
rec.related_cfdi = None
......@@ -10,6 +10,7 @@ odoo.define('invoice_xunnel.documents_dashboard', (require) => {
'xunnel_document',
'invoice_total_amount',
'product_list',
'related_cfdi',
]));
}
});
......
......@@ -24,6 +24,15 @@ odoo.define('invoice_xunnel.DocumentsInspector', function( require ) {
}));
$product.appendTo(this.$('.o_inspector_product_list'));
var related_cfdi = only_xunnel[0].data.related_cfdi;
if (related_cfdi) {
var $related_cfdi = $(qweb.render('invoice_xunnel.related_cfdi',{
cfdis: JSON.parse(only_xunnel[0].data.related_cfdi)
}));
$related_cfdi.appendTo(this.$('.related_cfdi'));
}
}
}
});
......
......@@ -25,6 +25,16 @@
<li class="ellipsis" t-foreach="products" t-as="product" t-esc="product" t-att-title="product"/>
</ul>
</t>
<t t-name="invoice_xunnel.related_cfdi">
<td class="o_inspector_label align-baseline">
<label>Related CFDI</label>
</td>
<td class="o_inspector_value w-100">
<ul class="p-0 m-0 list-unstyled ">
<li t-foreach="cfdis" t-as="cfdi" t-esc="cfdi"/>
</ul>
</td>
</t>
<t t-extend="documents.DocumentsInspector.documentsInfo">
<t t-jquery=".o_inspector_fields tbody tr.product_list" t-operation="replace"/>
<t t-jquery=".o_inspector_fields tbody tr.o_inspector_divider" t-operation="after">
......@@ -40,6 +50,9 @@
</td>
</tr>
</t>
<t t-jquery=".o_inspector_fields tbody" t-operation="append">
<tr class="related_cfdi o_inspector_custom_field"/>
</t>
</t>
</templates>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment