From 1b36468c8f24cebfbefdd07209a0d093bac26409 Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Tue, 23 Aug 2022 10:17:24 +0200 Subject: [PATCH] add invocloud + invocloud message xml --- ebill_paynet/i18n/de.po | 36 ++++- ebill_paynet/i18n/ebill_paynet.pot | 31 +++- .../messages/invoice-2013A-invocloud.xml | 133 ++++++++++++++++++ ebill_paynet/models/paynet_invoice_message.py | 19 ++- ebill_paynet/models/paynet_service.py | 11 +- ebill_paynet/views/paynet_service.xml | 1 + 6 files changed, 220 insertions(+), 11 deletions(-) create mode 100644 ebill_paynet/messages/invoice-2013A-invocloud.xml diff --git a/ebill_paynet/i18n/de.po b/ebill_paynet/i18n/de.po index 75898a8..996199c 100644 --- a/ebill_paynet/i18n/de.po +++ b/ebill_paynet/i18n/de.po @@ -71,8 +71,11 @@ msgid "Created on" msgstr "" #. module: ebill_paynet +#: model:ir.model.fields,field_description:ebill_paynet.field_account_move__display_name +#: model:ir.model.fields,field_description:ebill_paynet.field_ebill_payment_contract__display_name #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_invoice_message__display_name #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__display_name +#: model:ir.model.fields,field_description:ebill_paynet.field_sale_order__display_name msgid "Display Name" msgstr "" @@ -113,8 +116,11 @@ msgid "IC Ref" msgstr "" #. module: ebill_paynet +#: model:ir.model.fields,field_description:ebill_paynet.field_account_move__id +#: model:ir.model.fields,field_description:ebill_paynet.field_ebill_payment_contract__id #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_invoice_message__id #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__id +#: model:ir.model.fields,field_description:ebill_paynet.field_sale_order__id msgid "ID" msgstr "" @@ -129,6 +135,11 @@ msgstr "ESR" msgid "In Error" msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields.selection,name:ebill_paynet.selection__paynet_service__service_provider__invocloud +msgid "InvoCloud" +msgstr "" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_invoice_message__invoice_id msgid "Invoice" @@ -152,12 +163,15 @@ msgstr "" #. module: ebill_paynet #: model:ir.model,name:ebill_paynet.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "Buchungssätze" #. module: ebill_paynet +#: model:ir.model.fields,field_description:ebill_paynet.field_account_move____last_update +#: model:ir.model.fields,field_description:ebill_paynet.field_ebill_payment_contract____last_update #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_invoice_message____last_update #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service____last_update +#: model:ir.model.fields,field_description:ebill_paynet.field_sale_order____last_update msgid "Last Modified on" msgstr "" @@ -220,6 +234,11 @@ msgid "" "attached accordingly." msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields.selection,name:ebill_paynet.selection__paynet_service__service_provider__paynet +msgid "Paynet" +msgstr "" + #. module: ebill_paynet #: model:ir.actions.server,name:ebill_paynet.cron_paynet_get_shipment_ir_actions_server #: model:ir.cron,cron_name:ebill_paynet.cron_paynet_get_shipment @@ -312,6 +331,11 @@ msgstr "" msgid "Sent" msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__service_provider +msgid "Service Provider" +msgstr "Service Anbieter" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__service_type msgid "Service type" @@ -329,7 +353,10 @@ msgstr "" #. module: ebill_paynet #: model:ir.model.fields,help:ebill_paynet.field_paynet_service__service_type -msgid "Specify the type of XML exchange with the service." +msgid "" +"Specify the type of XML exchange with the service. b2b(2003A) is invoice " +"from your bussiness send to other business. b2c(2013A) is from your business" +" to bank(customer)" msgstr "" #. module: ebill_paynet @@ -363,6 +390,11 @@ msgstr "" msgid "The Paynet system rejected the eBill that was send." msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields,help:ebill_paynet.field_paynet_service__service_provider +msgid "There are some specific diference between provider" +msgstr "" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__url msgid "Url" diff --git a/ebill_paynet/i18n/ebill_paynet.pot b/ebill_paynet/i18n/ebill_paynet.pot index 5c3af29..8fe697a 100644 --- a/ebill_paynet/i18n/ebill_paynet.pot +++ b/ebill_paynet/i18n/ebill_paynet.pot @@ -1,11 +1,13 @@ -# Translation of Odoo Server. +# Translation of Flectra Server. # This file contains the translation of the following modules: # * ebill_paynet # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Flectra Server 2.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-23 08:09+0000\n" +"PO-Revision-Date: 2022-08-23 08:09+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -132,6 +134,11 @@ msgstr "" msgid "In Error" msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields.selection,name:ebill_paynet.selection__paynet_service__service_provider__invocloud +msgid "InvoCloud" +msgstr "" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_invoice_message__invoice_id msgid "Invoice" @@ -226,6 +233,11 @@ msgid "" "attached accordingly." msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields.selection,name:ebill_paynet.selection__paynet_service__service_provider__paynet +msgid "Paynet" +msgstr "" + #. module: ebill_paynet #: model:ir.actions.server,name:ebill_paynet.cron_paynet_get_shipment_ir_actions_server #: model:ir.cron,cron_name:ebill_paynet.cron_paynet_get_shipment @@ -318,6 +330,11 @@ msgstr "" msgid "Sent" msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__service_provider +msgid "Service Provider" +msgstr "" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__service_type msgid "Service type" @@ -335,7 +352,10 @@ msgstr "" #. module: ebill_paynet #: model:ir.model.fields,help:ebill_paynet.field_paynet_service__service_type -msgid "Specify the type of XML exchange with the service." +msgid "" +"Specify the type of XML exchange with the service. b2b(2003A) is invoice " +"from your bussiness send to other business. b2c(2013A) is from your business" +" to bank(customer)" msgstr "" #. module: ebill_paynet @@ -369,6 +389,11 @@ msgstr "" msgid "The Paynet system rejected the eBill that was send." msgstr "" +#. module: ebill_paynet +#: model:ir.model.fields,help:ebill_paynet.field_paynet_service__service_provider +msgid "There are some specific diference between provider" +msgstr "" + #. module: ebill_paynet #: model:ir.model.fields,field_description:ebill_paynet.field_paynet_service__url msgid "Url" diff --git a/ebill_paynet/messages/invoice-2013A-invocloud.xml b/ebill_paynet/messages/invoice-2013A-invocloud.xml new file mode 100644 index 0000000..2fd2836 --- /dev/null +++ b/ebill_paynet/messages/invoice-2013A-invocloud.xml @@ -0,0 +1,133 @@ + + + + + {{ client_pid }} + + + 41110081993928338 + + {{ ic_ref }} + + +
+ + + + + + {{ invoice.name }} + {{ format_date() }} + + + + {{ format_date(invoice.date_invoice) }} + + + + + {{ invoice.name }} + {{ format_date(invoice.date_invoice) }} + + + + + {#- Doc says vat number or business identitfiaction number #} + {%- if invoice.company_id.vat %} + {{ invoice.company_id.vat }} + {%- endif %} + {%- if invoice_esr %} + {{ invoice_esr }} + {%- endif %} + + {{ client_pid }} + + + + {{ biller.name }} + + + {{ biller.street or ''}} + {%- if biller.street2 %} + {{ biller.street2 }} + {% endif %} + + {{ biller.city or ''}} + {{ biller.zip or '' }} + {{ biller.country_id.code or 'CH' }} + + + {{ bank.sanitized_acc_number }} + {{ bank.acc_holder_name }} + {# Is this the default for e-banking customers ? -#} + 001996 + + + + + {{ ebill_account_number }} + + + + {{ customer.name }} + + + {{ customer.street }} + {%- if customer.street2 %} + {{ customer.street2 or '' }} + {%- endif %} + + {{ customer.city }} + {{ customer.state_id.code }} + {{ customer.zip }} + {{ customer.country_id.code or 'CH' }} + + +
+ + + + {{ invoice.amount_total }} + + + {{ invoice.amount_tax }} + + + {{ invoice.amount_untaxed }} + + {% if amount_by_group %} + {% for taxgroup in amount_by_group %} + + + {{ taxgroup[2] }} + + {%- if taxgroup[0] %} + {{ taxgroup[0] }} + {%- else %} + 0 + {%- endif %} + {{ taxgroup[1] }} + + {% endfor %} + {%- else %} + + + {{ invoice.amount_untaxed }} + + 0 + 0 + + {% endif -%} + + + + {{ format_date(invoice.date_due or invoice.date_invoice) }} + + + + + {{ pdf_data }} + + +
+
diff --git a/ebill_paynet/models/paynet_invoice_message.py b/ebill_paynet/models/paynet_invoice_message.py index 67bac39..3aafb42 100644 --- a/ebill_paynet/models/paynet_invoice_message.py +++ b/ebill_paynet/models/paynet_invoice_message.py @@ -19,6 +19,7 @@ import zeep # isort:skip MODULE_PATH = get_module_root(os.path.dirname(__file__)) INVOICE_TEMPLATE_2013 = "invoice-2013A.xml" +INVOICE_TEMPLATE_2013_Invocloud = "invoice-2013A-invocloud.xml" INVOICE_TEMPLATE_2003 = "invoice-2003A.xml" TEMPLATE_DIR = [MODULE_PATH + "/messages"] @@ -87,10 +88,15 @@ class PaynetInvoiceMessage(models.Model): self.ic_ref = self._get_ic_ref() bank_account = "" if self.payment_type == "qr": - bank_account = sanitize_account_number( - self.invoice_id.partner_bank_id.l10n_ch_qr_iban - or self.invoice_id.partner_bank_id.acc_number - ) + if self.service_id.service_provider == "invocloud": + bank_account = sanitize_account_number( + self.invoice_id.partner_bank_id.acc_number + ) + else: + bank_account = sanitize_account_number( + self.invoice_id.partner_bank_id.l10n_ch_qr_iban + or self.invoice_id.partner_bank_id.acc_number + ) else: bank_account = self.invoice_id.partner_bank_id.l10n_ch_isr_subscription_chf if bank_account: @@ -162,7 +168,10 @@ class PaynetInvoiceMessage(models.Model): if self.service_id.service_type == "b2b": return jinja_env.get_template(INVOICE_TEMPLATE_2003) else: - return jinja_env.get_template(INVOICE_TEMPLATE_2013) + if self.service_id.service_provider == "invocloud": + return jinja_env.get_template(INVOICE_TEMPLATE_2013_Invocloud) + else: + return jinja_env.get_template(INVOICE_TEMPLATE_2013) def _generate_payload(self): self.ensure_one() diff --git a/ebill_paynet/models/paynet_service.py b/ebill_paynet/models/paynet_service.py index 8439602..b3326a3 100644 --- a/ebill_paynet/models/paynet_service.py +++ b/ebill_paynet/models/paynet_service.py @@ -35,7 +35,7 @@ class PaynetService(models.Model): selection=[("b2b", "B2B"), ("b2c", "B2C")], string="Service type", default="b2b", - help="Specify the type of XML exchange with the service.", + help="Specify the type of XML exchange with the service. b2b(2003A) is invoice from your bussiness send to other business. b2c(2013A) is from your business to bank(customer)", ) partner_bank_id = fields.Many2one( comodel_name="res.partner.bank", string="Bank account", ondelete="restrict" @@ -53,6 +53,15 @@ class PaynetService(models.Model): readonly=True, ) active = fields.Boolean(default=True) + + #Adjustment to use InvoCloud + service_provider = fields.Selection( + selection=[("paynet", "Paynet"), ("invocloud", "InvoCloud")], + string="Service Provider", + default="paynet", + help="There are some specific diference between provider", + ) + @api.depends("use_test_service") def _compute_url(self): diff --git a/ebill_paynet/views/paynet_service.xml b/ebill_paynet/views/paynet_service.xml index 1133974..1ed9d96 100644 --- a/ebill_paynet/views/paynet_service.xml +++ b/ebill_paynet/views/paynet_service.xml @@ -76,6 +76,7 @@ +