mirror of
https://gitlab.com/flectra-community/l10n-switzerland-flectra.git
synced 2024-11-16 19:12:04 +00:00
Merge branch '2.0-fixed' into '2.0'
message now define which provider the ebill is sent See merge request flectra-community/l10n-switzerland-flectra!14
This commit is contained in:
commit
32d812177b
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<flectra noupdate="1">
|
<flectra noupdate="1">
|
||||||
<record model="ir.cron" id="cron_paynet_get_shipment">
|
<record model="ir.cron" id="cron_paynet_get_shipment">
|
||||||
<field name='name'>Paynet - Poll for shipments</field>
|
<field name='name'>E-Bill - Poll for shipments</field>
|
||||||
<field name='interval_number'>1</field>
|
<field name='interval_number'>1</field>
|
||||||
<field name='interval_type'>hours</field>
|
<field name='interval_type'>hours</field>
|
||||||
<field name="numbercall">-1</field>
|
<field name="numbercall">-1</field>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<flectra>
|
<flectra>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<record id="mail_activity_dws_error" model="mail.activity.type">
|
<record id="mail_activity_dws_error" model="mail.activity.type">
|
||||||
<field name="name">Paynet System Error</field>
|
<field name="name">E-Bill System Error</field>
|
||||||
<field name="icon">fa-warning</field>
|
<field name="icon">fa-warning</field>
|
||||||
<field name="delay_count">0</field>
|
<field name="delay_count">0</field>
|
||||||
<field name="sequence">99</field>
|
<field name="sequence">99</field>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<flectra>
|
<flectra>
|
||||||
<record id="paynet_transmit_method" model="transmit.method">
|
<record id="paynet_transmit_method" model="transmit.method">
|
||||||
<field name="name">Paynet</field>
|
<field name="name">E-Bill</field>
|
||||||
<field name="code">paynet</field>
|
<field name="code">paynet</field>
|
||||||
<field name="customer_ok" eval="True" />
|
<field name="customer_ok" eval="True" />
|
||||||
<field name="supplier_ok" eval="False" />
|
<field name="supplier_ok" eval="False" />
|
||||||
|
@ -17,17 +17,17 @@
|
|||||||
<MESSAGE-REFERENCE>
|
<MESSAGE-REFERENCE>
|
||||||
<REFERENCE-DATE>
|
<REFERENCE-DATE>
|
||||||
<Reference-No>{{ invoice.name }}</Reference-No>
|
<Reference-No>{{ invoice.name }}</Reference-No>
|
||||||
<Date>{{ format_date() }}</Date>
|
<Date>{{ format_date(invoice.invoice_date) }}</Date>
|
||||||
</REFERENCE-DATE>
|
</REFERENCE-DATE>
|
||||||
</MESSAGE-REFERENCE>
|
</MESSAGE-REFERENCE>
|
||||||
<PRINT-DATE>
|
<PRINT-DATE>
|
||||||
<Date>{{ format_date(invoice.date_invoice) }}</Date>
|
<Date>{{ format_date(invoice.invoice_date) }}</Date>
|
||||||
</PRINT-DATE>
|
</PRINT-DATE>
|
||||||
<REFERENCE>
|
<REFERENCE>
|
||||||
<INVOICE-REFERENCE>
|
<INVOICE-REFERENCE>
|
||||||
<REFERENCE-DATE>
|
<REFERENCE-DATE>
|
||||||
<Reference-No>{{ invoice.name }}</Reference-No>
|
<Reference-No>{{ invoice.name }}</Reference-No>
|
||||||
<Date>{{ format_date(invoice.date_invoice) }}</Date>
|
<Date>{{ format_date(invoice.invoice_date) }}</Date>
|
||||||
</REFERENCE-DATE>
|
</REFERENCE-DATE>
|
||||||
</INVOICE-REFERENCE>
|
</INVOICE-REFERENCE>
|
||||||
</REFERENCE>
|
</REFERENCE>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
<Acct-No>{{ bank.sanitized_acc_number }}</Acct-No>
|
<Acct-No>{{ bank.sanitized_acc_number }}</Acct-No>
|
||||||
<Acct-Name>{{ bank.acc_holder_name or bank.partner_id.name }}</Acct-Name>
|
<Acct-Name>{{ bank.acc_holder_name or bank.partner_id.name }}</Acct-Name>
|
||||||
{# Is this the default for e-banking customers ? -#}
|
{# Is this the default for e-banking customers ? -#}
|
||||||
<BankId Type="BCNr-int" Country="CH">209</BankId>
|
<BankId Type="BCNr-int" Country="CH">{{bank.bank_id.clearing}}</BankId>
|
||||||
</BANK-INFO>
|
</BANK-INFO>
|
||||||
</BILLER>
|
</BILLER>
|
||||||
<PAYER>
|
<PAYER>
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<PAYMENT-TERMS>
|
<PAYMENT-TERMS>
|
||||||
<BASIC Payment-Type="{{ payment_type|upper }}" Terms-Type="5">
|
<BASIC Payment-Type="{{ payment_type|upper }}" Terms-Type="5">
|
||||||
<TERMS>
|
<TERMS>
|
||||||
<Date>{{ format_date(invoice.date_due or invoice.date_invoice) }}</Date>
|
<Date>{{ format_date(invoice.invoice_date_due or invoice.invoice_date) }}</Date>
|
||||||
</TERMS>
|
</TERMS>
|
||||||
</BASIC>
|
</BASIC>
|
||||||
</PAYMENT-TERMS>
|
</PAYMENT-TERMS>
|
||||||
|
@ -25,7 +25,7 @@ class AccountInvoice(models.Model):
|
|||||||
if self.transmit_method_id == paynet_method:
|
if self.transmit_method_id == paynet_method:
|
||||||
contract = self.partner_id.get_active_contract(self.transmit_method_id)
|
contract = self.partner_id.get_active_contract(self.transmit_method_id)
|
||||||
if contract:
|
if contract:
|
||||||
self.invoice_partner_bank_id = (
|
self.partner_bank_id = (
|
||||||
contract.paynet_service_id.partner_bank_id
|
contract.paynet_service_id.partner_bank_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ class AccountInvoice(models.Model):
|
|||||||
raise UserError(_("Error generating Paynet message"))
|
raise UserError(_("Error generating Paynet message"))
|
||||||
message.send_to_paynet()
|
message.send_to_paynet()
|
||||||
self.invoice_exported = True
|
self.invoice_exported = True
|
||||||
|
self.is_move_sent = True
|
||||||
return "Paynet invoice generated and in state {}".format(message.state)
|
return "Paynet invoice generated and in state {}".format(message.state)
|
||||||
|
|
||||||
def create_paynet_message(self):
|
def create_paynet_message(self):
|
||||||
@ -106,28 +107,26 @@ class AccountInvoice(models.Model):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def log_invoice_accepted_by_system(self):
|
def log_invoice_accepted_by_system(self, provider = False):
|
||||||
""" """
|
""" """
|
||||||
self.activity_feedback(
|
self.activity_feedback(
|
||||||
["ebill_paynet.mail_activity_dws_error"],
|
["ebill_paynet.mail_activity_dws_error"],
|
||||||
feedback="It worked on a later try",
|
feedback="It worked on a later try",
|
||||||
)
|
)
|
||||||
self.message_post(body=_("Invoice accepted by the Paynet system"))
|
self.message_post(body=_("Invoice accepted by the %s system" % (provider)))
|
||||||
self.invoice_export_confirmed = True
|
self.invoice_export_confirmed = True
|
||||||
|
|
||||||
def log_invoice_refused_by_system(self):
|
def log_invoice_refused_by_system(self, provider = False):
|
||||||
""" """
|
""" """
|
||||||
activity_type = "ebill_paynet.mail_activity_dws_error"
|
activity_type = "ebill_paynet.mail_activity_dws_error"
|
||||||
activity = self.activity_reschedule(
|
activity = self.activity_reschedule(
|
||||||
[activity_type], date_deadline=fields.Date.today()
|
[activity_type], date_deadline=fields.Date.today()
|
||||||
)
|
)
|
||||||
values = {}
|
|
||||||
if not activity:
|
if not activity:
|
||||||
message = self.env.ref("ebill_paynet.dws_reject_invoice")._render(
|
message = _("The %s system rejected the eBill that was send." % (provider))
|
||||||
values=values
|
|
||||||
)
|
|
||||||
activity = self.activity_schedule(
|
activity = self.activity_schedule(
|
||||||
activity_type, summary="Invoice rejected by Paynet", note=message
|
activity_type, summary="Invoice rejected by %s" % (provider), note=message
|
||||||
)
|
)
|
||||||
# error_log = values.get("error_detail")
|
# error_log = values.get("error_detail")
|
||||||
# if not error_log:
|
# if not error_log:
|
||||||
|
@ -183,8 +183,9 @@ class PaynetInvoiceMessage(models.Model):
|
|||||||
|
|
||||||
def update_invoice_status(self):
|
def update_invoice_status(self):
|
||||||
"""Update the export status in the chatter."""
|
"""Update the export status in the chatter."""
|
||||||
|
provider = self.service_id.service_provider if self.service_id.service_provider else 'No provider chosen'
|
||||||
for message in self:
|
for message in self:
|
||||||
if message.state == "done":
|
if message.state == "done":
|
||||||
message.invoice_id.log_invoice_accepted_by_system()
|
message.invoice_id.log_invoice_accepted_by_system(provider)
|
||||||
elif message.state in ["reject", "error"]:
|
elif message.state in ["reject", "error"]:
|
||||||
message.invoice_id.log_invoice_refused_by_system()
|
message.invoice_id.log_invoice_refused_by_system(provider)
|
||||||
|
@ -53,7 +53,7 @@ class PaynetService(models.Model):
|
|||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
active = fields.Boolean(default=True)
|
active = fields.Boolean(default=True)
|
||||||
|
|
||||||
#Adjustment to use InvoCloud
|
#Adjustment to use InvoCloud
|
||||||
service_provider = fields.Selection(
|
service_provider = fields.Selection(
|
||||||
selection=[("paynet", "Paynet"), ("invocloud", "InvoCloud")],
|
selection=[("paynet", "Paynet"), ("invocloud", "InvoCloud")],
|
||||||
@ -61,7 +61,13 @@ class PaynetService(models.Model):
|
|||||||
default="paynet",
|
default="paynet",
|
||||||
help="There are some specific diference between provider",
|
help="There are some specific diference between provider",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.onchange('service_provider')
|
||||||
|
def _onchange_fill_provider_url(self):
|
||||||
|
if self.service_provider == 'invocloud':
|
||||||
|
self.url = 'https://api.invohub.ch/dws'
|
||||||
|
else:
|
||||||
|
self.url = 'https://dws.paynet.ch/DWS/DWS'
|
||||||
|
|
||||||
@api.depends("use_test_service")
|
@api.depends("use_test_service")
|
||||||
def _compute_url(self):
|
def _compute_url(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user