Bernd Wurst commited on 2025-08-08 06:19:52
Zeige 2 geänderte Dateien mit 10 Einfügungen und 4 Löschungen.
| ... | ... |
@@ -245,13 +245,16 @@ class PDF(object): |
| 245 | 245 |
x = self.x + 0.5 * cm |
| 246 | 246 |
self.y -= 0.5 * cm |
| 247 | 247 |
self.canvas.setFont(self.font, font_size) |
| 248 |
+ country = self.invoice.customer['address']['country_id'] or '' |
|
| 249 |
+ country = country + '-' if country and country != 'DE' else '' |
|
| 248 | 250 |
addresslines = filter(None, [ |
| 249 | 251 |
self.invoice.customer['name'].strip(), |
| 250 | 252 |
self.invoice.customer['address']['line1'] or '', |
| 251 | 253 |
self.invoice.customer['address']['line2'] or '', |
| 252 | 254 |
self.invoice.customer['address']['line3'] or '', |
| 253 |
- ((self.invoice.customer['address']['postcode'] or '') + ' ' + ( |
|
| 254 |
- self.invoice.customer['address']['city_name'] or '')).strip(), |
|
| 255 |
+ (country + |
|
| 256 |
+ (self.invoice.customer['address']['postcode'] or '') + ' ' + |
|
| 257 |
+ (self.invoice.customer['address']['city_name'] or '')).strip(), |
|
| 255 | 258 |
]) |
| 256 | 259 |
for line in addresslines: |
| 257 | 260 |
self.canvas.drawString(x, self.y, line) |
| ... | ... |
@@ -24,13 +24,16 @@ def _breakLine(text, width=72): |
| 24 | 24 |
def InvoiceToText(invoice: Invoice): |
| 25 | 25 |
ret = [u'Rechnungsempfänger:', |
| 26 | 26 |
] |
| 27 |
+ country = invoice.customer['address']['country_id'] or '' |
|
| 28 |
+ country = country + '-' if country and country != 'DE' else '' |
|
| 27 | 29 |
addresslines = filter(None, [ |
| 28 | 30 |
invoice.customer['name'].strip(), |
| 29 | 31 |
invoice.customer['address']['line1'] or '', |
| 30 | 32 |
invoice.customer['address']['line2'] or '', |
| 31 | 33 |
invoice.customer['address']['line3'] or '', |
| 32 |
- ((invoice.customer['address']['postcode'] or '') + ' ' + ( |
|
| 33 |
- invoice.customer['address']['city_name'] or '')).strip(), |
|
| 34 |
+ (country + |
|
| 35 |
+ (invoice.customer['address']['postcode'] or '') + ' ' + |
|
| 36 |
+ (invoice.customer['address']['city_name'] or '')).strip(), |
|
| 34 | 37 |
]) |
| 35 | 38 |
for line in addresslines: |
| 36 | 39 |
ret.append(f' {line}')
|
| 37 | 40 |