odoo-addon-ebill-postfinance 16.0.1.0.0.7__py3-none-any.whl → 16.0.1.0.0.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,44 +42,54 @@ class AccountMove(models.Model):
42
42
  self.invoice_exported = True
43
43
  return "Postfinance invoice generated and in state {}".format(message.state)
44
44
 
45
+ def _get_ebill_postfinance_pdf_report(self, payment_type):
46
+ """Get the report name(s) to be used to generate the pdf send with the eBill."""
47
+ report_names = ["account.report_invoice"]
48
+ if self.move_type == "out_invoice":
49
+ # Should it not depends on the invoice being sent, instead of a
50
+ # configuration on the contract ?
51
+ if payment_type == "qr":
52
+ report_names.append("l10n_ch.qr_report_main")
53
+ return report_names
54
+
45
55
  def create_postfinance_ebill(self):
46
56
  """Generate the message record for an invoice."""
47
57
  self.ensure_one()
48
58
  contract = self.partner_id.get_active_contract(self.transmit_method_id)
49
59
  if not contract:
50
60
  return
51
- # Generate PDf to be send
52
- pdf_data = []
53
- # When test are run, pdf are not generated, so use an empty pdf
54
- pdf = b""
55
- report_names = ["account.report_invoice"]
56
61
  payment_type = ""
57
62
  if self.move_type == "out_invoice":
58
63
  payment_type = "iban"
59
- if contract.payment_type == "qr":
60
- report_names.append("l10n_ch.qr_report_main")
61
64
  elif self.move_type == "out_refund":
62
65
  payment_type = "credit"
66
+ # Generate PDf to be send
67
+ pdf_data = []
68
+ # When test are run, pdf are not generated, so use an empty pdf
69
+ pdf = b""
70
+ report_names = self._get_ebill_postfinance_pdf_report(payment_type)
63
71
  for report_name in report_names:
64
- # r = self.env["ir.actions.report"]._get_report_from_name(report_name)
65
72
  pdf_content, _ = self.env["ir.actions.report"]._render(
66
73
  report_name, [self.id]
67
74
  )
68
- # pdf_content, _ = r._render([self.id])
69
75
  pdf_data.append(pdf_content)
70
76
  if not odoo.tools.config["test_enable"]:
71
77
  if len(pdf_data) > 1:
72
78
  pdf = merge_pdf(pdf_data)
73
79
  elif len(pdf_data) == 1:
74
80
  pdf = pdf_data[0]
75
- message = self.env["ebill.postfinance.invoice.message"].create(
76
- {
77
- "service_id": contract.postfinance_service_id.id,
78
- "invoice_id": self.id,
79
- "ebill_account_number": contract.postfinance_billerid,
80
- "payment_type": payment_type,
81
- "ebill_payment_contract_id": contract.id,
82
- }
81
+ message = (
82
+ self.env["ebill.postfinance.invoice.message"]
83
+ .sudo()
84
+ .create(
85
+ {
86
+ "service_id": contract.postfinance_service_id.id,
87
+ "invoice_id": self.id,
88
+ "ebill_account_number": contract.postfinance_billerid,
89
+ "payment_type": payment_type,
90
+ "ebill_payment_contract_id": contract.id,
91
+ }
92
+ )
83
93
  )
84
94
  attachment = self.env["ir.attachment"].create(
85
95
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-ebill_postfinance
3
- Version: 16.0.1.0.0.7
3
+ Version: 16.0.1.0.0.10
4
4
  Summary: Postfinance eBill integration
5
5
  Home-page: https://github.com/OCA/l10n-switzerland
6
6
  Author: Camptocamp,Odoo Community Association (OCA)
@@ -9,7 +9,7 @@ odoo/addons/ebill_postfinance/messages/invoice-2003A.jinja,sha256=RLLvsbKIG-Yiwz
9
9
  odoo/addons/ebill_postfinance/messages/invoice-yellowbill.jinja,sha256=HtLKEyFuzfHxMY50qbPRZULO44COqtgEdQO02uoEyy0,12239
10
10
  odoo/addons/ebill_postfinance/messages/ybInvoice_V2.0.4.xsd,sha256=5fbM7Miwb59sXvUgjwJMszIJ19NuHQU3gsGaxTO27fA,48785
11
11
  odoo/addons/ebill_postfinance/models/__init__.py,sha256=2uZGfhJOczB94W5EFvXlky-tXcJeWRF9O1-rtCGvuxA,177
12
- odoo/addons/ebill_postfinance/models/account_move.py,sha256=JnMnT1Fu8HtgTKTQaMm2_eLu_hv18SF-l6GSTMXlLaM,5208
12
+ odoo/addons/ebill_postfinance/models/account_move.py,sha256=2GEbzHU44xrBnC4SG2Z18p25JkjJRe6-852iMV47BCU,5576
13
13
  odoo/addons/ebill_postfinance/models/ebill_payment_contract.py,sha256=kVunbB_XN6pw0zcf6iCfe-ceuqMpoalw3TIr1UEtST4,2913
14
14
  odoo/addons/ebill_postfinance/models/ebill_postfinance_invoice_message.py,sha256=5vjw0Oo8c7fFeO9l3llYGp_K9nSAqmwExSifxmQLLlg,14041
15
15
  odoo/addons/ebill_postfinance/models/ebill_postfinance_service.py,sha256=8yn9FqlXv_bA26mvlGRslW4cfKVmHRIKpZDziixeLzE,5404
@@ -38,7 +38,7 @@ odoo/addons/ebill_postfinance/views/ebill_payment_contract.xml,sha256=efZjo1o4-_
38
38
  odoo/addons/ebill_postfinance/views/ebill_postfinance_invoice_message.xml,sha256=Mj2TrBjOS2fxaINA_ycsNTqP5Y3KPsWtvGWv2IkxcDM,3269
39
39
  odoo/addons/ebill_postfinance/views/ebill_postfinance_service.xml,sha256=KhYEQtbxpo91QohFoGED9dIHPAP6AzLdsP_IFPZU5Vc,5989
40
40
  odoo/addons/ebill_postfinance/views/message_template.xml,sha256=gNBva1ehWFgz6W6lrNCmpxZ_maovQJxhHcBpxcohvZo,213
41
- odoo_addon_ebill_postfinance-16.0.1.0.0.7.dist-info/METADATA,sha256=5LO4_ibJBDFNTP8Ax5_EQVVGiqF43qHfrHkRr8Y-BG4,5406
42
- odoo_addon_ebill_postfinance-16.0.1.0.0.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
43
- odoo_addon_ebill_postfinance-16.0.1.0.0.7.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
44
- odoo_addon_ebill_postfinance-16.0.1.0.0.7.dist-info/RECORD,,
41
+ odoo_addon_ebill_postfinance-16.0.1.0.0.10.dist-info/METADATA,sha256=EStPPVNi499sprJkjw0DH57Mc7nhbVvU4RRK1iuOMLs,5407
42
+ odoo_addon_ebill_postfinance-16.0.1.0.0.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
43
+ odoo_addon_ebill_postfinance-16.0.1.0.0.10.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
44
+ odoo_addon_ebill_postfinance-16.0.1.0.0.10.dist-info/RECORD,,