Käufer-E-Mail und -Telefon als Kontakt
Bernd Wurst

Bernd Wurst commited on 2024-08-01 07:43:29
Zeige 3 geänderte Dateien mit 10 Einfügungen und 3 Löschungen.

... ...
@@ -85,6 +85,11 @@ def InvoiceToXML(invoice):
85 85
     doc.trade.agreement.buyer.address.line_one = invoice.customer['address']['line1']
86 86
     doc.trade.agreement.buyer.address.line_two = invoice.customer['address']['line2']
87 87
     doc.trade.agreement.buyer.address.line_three = invoice.customer['address']['line3']
88
+    # E-Mail-Adresse des Kunden auf jeden Fall in den Kontakt
89
+    if invoice.buyer['email']:
90
+        doc.trade.agreement.buyer.contact.email.address = invoice.buyer['email']
91
+    if invoice.buyer['phone']:
92
+        doc.trade.agreement.buyer.contact.telephone.number = invoice.buyer['phone']
88 93
     if invoice.buyer_vat_id:
89 94
         tax_reg = TaxRegistration()
90 95
         tax_reg.id = ('VA', invoice.buyer_vat_id)
... ...
@@ -55,6 +55,7 @@ if __name__ == '__main__':
55 55
     invoice.seller['address']['line2'] = None
56 56
     invoice.seller['address']['line3'] = None
57 57
     invoice.seller_vat_id = "DE255720588"
58
+    invoice.buyer_vat_id = "AT123456789"
58 59
     invoice.type = RECHNUNG
59 60
     invoice.logo_image_file = os.path.join(os.path.dirname(__file__), "logo.png")
60 61
     invoice.seller_bank_data['kontoinhaber'] = "schokokeks.org GbR"
... ...
@@ -65,6 +66,7 @@ if __name__ == '__main__':
65 66
     invoice.customerno = rechnung['kunde']
66 67
     invoice.customer['name'] = adresse['company'] or adresse['name']
67 68
     invoice.customer['email'] = adresse['email']
69
+    invoice.customer['phone'] = adresse['phone']
68 70
     invoice.customer['address']['country_id'] = adresse['country']
69 71
     invoice.customer['address']['postcode'] = adresse['zip']
70 72
     invoice.customer['address']['city_name'] = adresse['city']
... ...
@@ -12,18 +12,18 @@ data = {
12 12
              'name': 'Bernd Wurst',
13 13
              'pgp_id': None,
14 14
              'pgp_key': None,
15
-             'phone': None,
15
+             'phone': '+49 9876 54321',
16 16
              'zip': '71540'},
17 17
  'data': ({'anzahl': Decimal('1.00'),
18 18
            'beschreibung': 'Testposten',
19 19
            'betrag': Decimal('1.00'),
20
-           'brutto': 1,
20
+           'brutto': 0,
21 21
            'datum': datetime.date(2023, 9, 20),
22 22
            'einheit': 'xy',
23 23
            'enddatum': None,
24 24
            'info_headline': None,
25 25
            'info_text': None,
26
-           'mwst': 19.0},),
26
+           'mwst': 0.0},),
27 27
  'daten': {'kuendigung': datetime.date(2024, 2, 16),
28 28
            'kunde': 5,
29 29
            'naechster_kuendigungstermin': datetime.date(2024, 3, 1),
30 30