From 7daf54fee2dcf5df0a94a9ca315ba059af5e7b6b Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Wed, 31 Aug 2022 09:56:34 +0000 Subject: [PATCH 1/5] message now define which provider the ebill is sent invocloud xml get now bank clearing number --- ebill_paynet/messages/invoice-2013A-invocloud.xml | 2 +- ebill_paynet/models/account_invoice.py | 14 ++++++-------- ebill_paynet/models/paynet_invoice_message.py | 5 +++-- ebill_paynet/models/paynet_service.py | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ebill_paynet/messages/invoice-2013A-invocloud.xml b/ebill_paynet/messages/invoice-2013A-invocloud.xml index fecf085..4d278da 100644 --- a/ebill_paynet/messages/invoice-2013A-invocloud.xml +++ b/ebill_paynet/messages/invoice-2013A-invocloud.xml @@ -60,7 +60,7 @@ {{ bank.sanitized_acc_number }} {{ bank.acc_holder_name or bank.partner_id.name }} {# Is this the default for e-banking customers ? -#} - 209 + {{bank.bank_id.clearing}} diff --git a/ebill_paynet/models/account_invoice.py b/ebill_paynet/models/account_invoice.py index 9b4721b..8d0e19a 100644 --- a/ebill_paynet/models/account_invoice.py +++ b/ebill_paynet/models/account_invoice.py @@ -106,28 +106,26 @@ class AccountInvoice(models.Model): self.ensure_one() return [] - def log_invoice_accepted_by_system(self): + def log_invoice_accepted_by_system(self, provider = False): """ """ self.activity_feedback( ["ebill_paynet.mail_activity_dws_error"], 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 - 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 = self.activity_reschedule( [activity_type], date_deadline=fields.Date.today() ) - values = {} + if not activity: - message = self.env.ref("ebill_paynet.dws_reject_invoice")._render( - values=values - ) + message = _("The %s system rejected the eBill that was send." % (provider)) 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") # if not error_log: diff --git a/ebill_paynet/models/paynet_invoice_message.py b/ebill_paynet/models/paynet_invoice_message.py index 3aafb42..ceb248f 100644 --- a/ebill_paynet/models/paynet_invoice_message.py +++ b/ebill_paynet/models/paynet_invoice_message.py @@ -183,8 +183,9 @@ class PaynetInvoiceMessage(models.Model): def update_invoice_status(self): """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: 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"]: - message.invoice_id.log_invoice_refused_by_system() + message.invoice_id.log_invoice_refused_by_system(provider) diff --git a/ebill_paynet/models/paynet_service.py b/ebill_paynet/models/paynet_service.py index b3326a3..bfffaf7 100644 --- a/ebill_paynet/models/paynet_service.py +++ b/ebill_paynet/models/paynet_service.py @@ -53,7 +53,7 @@ class PaynetService(models.Model): readonly=True, ) active = fields.Boolean(default=True) - + #Adjustment to use InvoCloud service_provider = fields.Selection( selection=[("paynet", "Paynet"), ("invocloud", "InvoCloud")], @@ -61,7 +61,7 @@ class PaynetService(models.Model): default="paynet", help="There are some specific diference between provider", ) - + @api.depends("use_test_service") def _compute_url(self): From e7f20ff1f1f321410822bd1107625c0df165e188 Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Thu, 1 Sep 2022 16:33:39 +0000 Subject: [PATCH 2/5] =?UTF-8?q?fix=20error.=20add=20url=20f=C3=BCr=20invoc?= =?UTF-8?q?loud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebill_paynet/models/account_invoice.py | 2 +- ebill_paynet/models/paynet_service.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ebill_paynet/models/account_invoice.py b/ebill_paynet/models/account_invoice.py index 8d0e19a..616a91b 100644 --- a/ebill_paynet/models/account_invoice.py +++ b/ebill_paynet/models/account_invoice.py @@ -25,7 +25,7 @@ class AccountInvoice(models.Model): if self.transmit_method_id == paynet_method: contract = self.partner_id.get_active_contract(self.transmit_method_id) if contract: - self.invoice_partner_bank_id = ( + self.partner_bank_id = ( contract.paynet_service_id.partner_bank_id ) diff --git a/ebill_paynet/models/paynet_service.py b/ebill_paynet/models/paynet_service.py index bfffaf7..ad2e358 100644 --- a/ebill_paynet/models/paynet_service.py +++ b/ebill_paynet/models/paynet_service.py @@ -62,6 +62,12 @@ class PaynetService(models.Model): 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") def _compute_url(self): From b0eb08331ddd7077fcfd561e8f2358be2628d2f9 Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Wed, 16 Nov 2022 11:34:53 +0000 Subject: [PATCH 3/5] fix wrong variable name --- ebill_paynet/messages/invoice-2013A-invocloud.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ebill_paynet/messages/invoice-2013A-invocloud.xml b/ebill_paynet/messages/invoice-2013A-invocloud.xml index 4d278da..e5c6cd6 100644 --- a/ebill_paynet/messages/invoice-2013A-invocloud.xml +++ b/ebill_paynet/messages/invoice-2013A-invocloud.xml @@ -17,17 +17,17 @@ {{ invoice.name }} - {{ format_date() }} + {{ format_date(invoice.invoice_date) }} - {{ format_date(invoice.date_invoice) }} + {{ format_date(invoice.invoice_date) }} {{ invoice.name }} - {{ format_date(invoice.date_invoice) }} + {{ format_date(invoice.invoice_date) }} @@ -121,7 +121,7 @@ - {{ format_date(invoice.date_due or invoice.date_invoice) }} + {{ format_date(invoice.invoice_date_due or invoice.invoice_date) }} From f4428d28fabb2ee49083ce9d41132a5534d79f40 Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Wed, 16 Nov 2022 12:16:57 +0000 Subject: [PATCH 4/5] change Paynet to E-Bill --- ebill_paynet/data/ir_cron.xml | 2 +- ebill_paynet/data/mail_activity_type.xml | 2 +- ebill_paynet/data/transmit.method.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ebill_paynet/data/ir_cron.xml b/ebill_paynet/data/ir_cron.xml index 7df5131..9a01504 100644 --- a/ebill_paynet/data/ir_cron.xml +++ b/ebill_paynet/data/ir_cron.xml @@ -1,7 +1,7 @@ - Paynet - Poll for shipments + E-Bill - Poll for shipments 1 hours -1 diff --git a/ebill_paynet/data/mail_activity_type.xml b/ebill_paynet/data/mail_activity_type.xml index 9d6f9c4..46df9b1 100644 --- a/ebill_paynet/data/mail_activity_type.xml +++ b/ebill_paynet/data/mail_activity_type.xml @@ -2,7 +2,7 @@ - Paynet System Error + E-Bill System Error fa-warning 0 99 diff --git a/ebill_paynet/data/transmit.method.xml b/ebill_paynet/data/transmit.method.xml index 13a13f0..3b490b6 100644 --- a/ebill_paynet/data/transmit.method.xml +++ b/ebill_paynet/data/transmit.method.xml @@ -1,7 +1,7 @@ - Paynet + E-Bill paynet From cc8c0ce21c46e5057637238f3d319392a319c537 Mon Sep 17 00:00:00 2001 From: Kevin Kempf Date: Sun, 20 Nov 2022 18:31:13 +0000 Subject: [PATCH 5/5] add to send the is_move_sent --- ebill_paynet/models/account_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ebill_paynet/models/account_invoice.py b/ebill_paynet/models/account_invoice.py index 616a91b..e087cd4 100644 --- a/ebill_paynet/models/account_invoice.py +++ b/ebill_paynet/models/account_invoice.py @@ -39,6 +39,7 @@ class AccountInvoice(models.Model): raise UserError(_("Error generating Paynet message")) message.send_to_paynet() self.invoice_exported = True + self.is_move_sent = True return "Paynet invoice generated and in state {}".format(message.state) def create_paynet_message(self):