Преглед на файлове

Merge pull request #15 from M22TechConsulting/change_rate

[ADD] custom_report_invoice: add exchange rate in prod
FernizaM22 преди 2 години
родител
ревизия
aa1fcfe205

+ 1 - 0
cutom_report_invoice/__init__.py

@@ -0,0 +1 @@
+from . import models

+ 2 - 1
cutom_report_invoice/__manifest__.py

@@ -3,7 +3,7 @@
     'description': """
         Custom Report Invoice M22      
     """,
-    "version": "16.0.1.0.0",
+    "version": "16.0.1.0.1",
     "category": "Partner",
     "author": "M22",
     'website': "https://www.m22.mx",
@@ -11,6 +11,7 @@
     "depends": ["account", "l10n_mx_edi_40", ],
     "data": [
         "views/report_invoice_view.xml",
+        "views/account_move_views.xml",
         "report/report_invoice.xml",
         ],
     "installable": True,

BIN
cutom_report_invoice/__pycache__/__init__.cpython-310.pyc


+ 32 - 6
cutom_report_invoice/i18n/es_MX.po

@@ -6,8 +6,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 16.0+e\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-08-31 00:15+0000\n"
-"PO-Revision-Date: 2023-08-31 00:15+0000\n"
+"POT-Creation-Date: 2023-09-26 03:08+0000\n"
+"PO-Revision-Date: 2023-09-26 03:08+0000\n"
 "Last-Translator: \n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
@@ -15,6 +15,11 @@ msgstr ""
 "Content-Transfer-Encoding: \n"
 "Plural-Forms: \n"
 
+#. module: cutom_report_invoice
+#: model:ir.actions.report,print_report_name:cutom_report_invoice.custom_report_invoice
+msgid "(object._get_report_base_filename())"
+msgstr ""
+
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid ""
@@ -92,7 +97,8 @@ msgstr "<span>Información Extra</span>"
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "<span>Original chain complement of digital certification SAT</span>"
-msgstr "<span>Cadena original del complemento del certificado digital del SAT</span>"
+msgstr ""
+"<span>Cadena original del complemento del certificado digital del SAT</span>"
 
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
@@ -129,8 +135,8 @@ msgid ""
 "<strong>A signature of this invoice is required, but it is not "
 "signed.</strong>"
 msgstr ""
-"<strong>Se requiere una firma de esta factura, pero no "
-"está firmada.</strong>"
+"<strong>Se requiere una firma de esta factura, pero no está "
+"firmada.</strong>"
 
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
@@ -143,6 +149,7 @@ msgid "<strong>Credit Note Date:</strong>"
 msgstr "<strong>Fecha de la nota de crédito:</strong>"
 
 #. module: cutom_report_invoice
+#: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_rate_report_invoice_document
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "<strong>Currency:</strong>"
 msgstr "<strong>Divisa:</strong>"
@@ -162,6 +169,12 @@ msgstr "<strong>Fecha:</strong>"
 msgid "<strong>Due Date:</strong>"
 msgstr "<strong>Fecha de vencimiento:</strong>"
 
+#. module: cutom_report_invoice
+#: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_rate_report_invoice_document
+#: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
+msgid "<strong>Exchange rate:</strong>"
+msgstr "<strong>Tipo de cambio:</strong"
+
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "<strong>Incoterm: </strong>"
@@ -200,7 +213,8 @@ msgstr "<strong>Origen:</strong>"
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "<strong>This document is a printed representation of a CFDI</strong>"
-msgstr "<strong>Este documento es una representación impresa de un CFDI</strong>"
+msgstr ""
+"<strong>Este documento es una representación impresa de un CFDI</strong>"
 
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
@@ -252,6 +266,11 @@ msgstr "Factura"
 msgid "Invoice Implementation"
 msgstr "Factura Implementación"
 
+#. module: cutom_report_invoice
+#: model:ir.model,name:cutom_report_invoice.model_account_move
+msgid "Journal Entry"
+msgstr "Asiento contable"
+
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "Paid on"
@@ -262,6 +281,13 @@ msgstr "Pagado en"
 msgid "Please use the following communication for your payment :"
 msgstr "Utilice la siguiente referencia al realizar su pago:"
 
+#. module: cutom_report_invoice
+#: model:ir.model.fields,field_description:cutom_report_invoice.field_account_bank_statement_line__rate
+#: model:ir.model.fields,field_description:cutom_report_invoice.field_account_move__rate
+#: model:ir.model.fields,field_description:cutom_report_invoice.field_account_payment__rate
+msgid "Rate"
+msgstr ""
+
 #. module: cutom_report_invoice
 #: model_terms:ir.ui.view,arch_db:cutom_report_invoice.custom_report_invoice_document
 msgid "Vendor Bill"

+ 1 - 0
cutom_report_invoice/models/__init__.py

@@ -0,0 +1 @@
+from . import account_move

+ 14 - 0
cutom_report_invoice/models/account_move.py

@@ -0,0 +1,14 @@
+
+from odoo import models, fields
+
+
+class AccountMove(models.Model):
+    _inherit = "account.move"
+
+    rate = fields.Float(compute="_get_last_exchannge_rate")
+
+    def _get_last_exchannge_rate(self):
+        rate = self.currency_id.rate_ids[0]
+        if rate:
+            self.rate= rate.inverse_company_rate
+                

+ 16 - 0
cutom_report_invoice/views/account_move_views.xml

@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='utf-8'?>
+<odoo>
+    <template id="custom_rate_report_invoice_document" inherit_id="account.report_invoice_document">
+        <xpath expr="//div[@name='reference']" position="after">
+            <div class="col-auto col-3 mw-100 mb-2" t-if="o.currency_id" name="currency">
+                <strong>Currency:</strong>
+                <p class="m-0" t-field="o.currency_id"/>
+            </div>
+            <div class="col-auto col-3 mw-100 mb-2" t-if="o.rate" name="rate">
+                <strong>Exchange rate:</strong>
+                <p class="m-0" t-field="o.rate"/>
+            </div>
+        </xpath>
+    </template>
+
+</odoo>

+ 4 - 0
cutom_report_invoice/views/report_invoice_view.xml

@@ -61,6 +61,10 @@
                                     <strong>Currency:</strong>
                                     <p class="m-0" t-field="o.currency_id"/>
                                 </div>
+                                <div class="col-auto col-3 mw-100 mb-2" t-if="o.rate" name="rate">
+                                    <strong>Exchange rate:</strong>
+                                    <p class="m-0" t-field="o.rate"/>
+                                </div>
                                 <t t-if="is_cfdi_signed">
                                     <t t-set="original_o_grid_layout" t-value="o_grid_layout"/>
                                     <t t-set="o_grid_layout" t-value="'col-auto col-3 mw-100 mb-2'"/>