Merge branch 'ebill-adjustment-for-invocloud' into '2.0-fixed'

adjustment for invocloud

See merge request flectra-community/l10n-switzerland-flectra!8
This commit is contained in:
Renzo Meister 2022-08-23 08:57:20 +00:00
commit 6fa32833fb
6 changed files with 220 additions and 11 deletions

View File

@ -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"

View File

@ -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"

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XML-FSCM-INVOICE-2013A>
<INTERCHANGE>
<IC-SENDER>
<Pid>{{ client_pid }}</Pid>
</IC-SENDER>
<IC-RECEIVER>
<Pid>41110081993928338</Pid>
</IC-RECEIVER>
<IC-Ref>{{ ic_ref }}</IC-Ref>
</INTERCHANGE>
<INVOICE Type="{{ document_type }}">
<HEADER>
<FUNCTION-FLAGS>
<Confirmation-Flag />
</FUNCTION-FLAGS>
<MESSAGE-REFERENCE>
<REFERENCE-DATE>
<Reference-No>{{ invoice.name }}</Reference-No>
<Date>{{ format_date() }}</Date>
</REFERENCE-DATE>
</MESSAGE-REFERENCE>
<PRINT-DATE>
<Date>{{ format_date(invoice.date_invoice) }}</Date>
</PRINT-DATE>
<REFERENCE>
<INVOICE-REFERENCE>
<REFERENCE-DATE>
<Reference-No>{{ invoice.name }}</Reference-No>
<Date>{{ format_date(invoice.date_invoice) }}</Date>
</REFERENCE-DATE>
</INVOICE-REFERENCE>
</REFERENCE>
<BILLER>
{#- Doc says vat number or business identitfiaction number #}
{%- if invoice.company_id.vat %}
<Tax-No>{{ invoice.company_id.vat }}</Tax-No>
{%- endif %}
{%- if invoice_esr %}
<Doc-Reference Type="ESR-NEU">{{ invoice_esr }}</Doc-Reference>
{%- endif %}
<PARTY-ID>
<Pid>{{ client_pid }}</Pid>
</PARTY-ID>
<NAME-ADDRESS Format="COM">
<NAME>
<Line-35>{{ biller.name }}</Line-35>
</NAME>
<STREET>
<Line-35>{{ biller.street or ''}}</Line-35>
{%- if biller.street2 %}
<Line-35>{{ biller.street2 }}</Line-35>
{% endif %}
</STREET>
<City>{{ biller.city or ''}}</City>
<Zip>{{ biller.zip or '' }}</Zip>
<Country>{{ biller.country_id.code or 'CH' }}</Country>
</NAME-ADDRESS>
<BANK-INFO>
<Acct-No>{{ bank.sanitized_acc_number }}</Acct-No>
<Acct-Name>{{ bank.acc_holder_name }}</Acct-Name>
{# Is this the default for e-banking customers ? -#}
<BankId Type="BCNr-int" Country="CH">001996</BankId>
</BANK-INFO>
</BILLER>
<PAYER>
<PARTY-ID>
<Pid>{{ ebill_account_number }}</Pid>
</PARTY-ID>
<NAME-ADDRESS Format="PRV">
<NAME>
<Line-35>{{ customer.name }}</Line-35>
</NAME>
<STREET>
<Line-35>{{ customer.street }}</Line-35>
{%- if customer.street2 %}
<Line-35>{{ customer.street2 or '' }}</Line-35>
{%- endif %}
</STREET>
<City>{{ customer.city }}</City>
<State>{{ customer.state_id.code }}</State>
<Zip>{{ customer.zip }}</Zip>
<Country>{{ customer.country_id.code or 'CH' }}</Country>
</NAME-ADDRESS>
</PAYER>
</HEADER>
<LINE-ITEM />
<SUMMARY>
<INVOICE-AMOUNT>
<Amount Currency="CHF">{{ invoice.amount_total }}</Amount>
</INVOICE-AMOUNT>
<VAT-AMOUNT>
<Amount Currency="CHF">{{ invoice.amount_tax }}</Amount>
</VAT-AMOUNT>
<EXTENDED-AMOUNT Type="79">
<Amount Currency="CHF">{{ invoice.amount_untaxed }}</Amount>
</EXTENDED-AMOUNT>
{% if amount_by_group %}
{% for taxgroup in amount_by_group %}
<TAX>
<TAX-BASIS>
<Amount Currency="CHF">{{ taxgroup[2] }}</Amount>
</TAX-BASIS>
{%- if taxgroup[0] %}
<Rate Category="S">{{ taxgroup[0] }}</Rate>
{%- else %}
<Rate Category="E">0</Rate>
{%- endif %}
<Amount Currency="CHF">{{ taxgroup[1] }}</Amount>
</TAX>
{% endfor %}
{%- else %}
<TAX>
<TAX-BASIS>
<Amount Currency="CHF">{{ invoice.amount_untaxed }}</Amount>
</TAX-BASIS>
<Rate Category="E">0</Rate>
<Amount Currency="CHF">0</Amount>
</TAX>
{% endif -%}
<PAYMENT-TERMS>
<BASIC Payment-Type="{{ payment_type|upper }}" Terms-Type="5">
<TERMS>
<Date>{{ format_date(invoice.date_due or invoice.date_invoice) }}</Date>
</TERMS>
</BASIC>
</PAYMENT-TERMS>
<Back-Pack-Container Encode="Base64">
{{ pdf_data }}
</Back-Pack-Container>
</SUMMARY>
</INVOICE>
</XML-FSCM-INVOICE-2013A>

View File

@ -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()

View File

@ -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):

View File

@ -76,6 +76,7 @@
<field name="service_type" />
<field name="use_test_service" />
<field name="client_pid" />
<field name="service_provider"/>
</group>
<group>
<field name="username" />