@@ -386,6 +386,7 @@ def generate_invoice(self, *, proforma: bool = False) -> None:
386386 invoice = self .payment .draft_invoice .duplicate (
387387 kind = invoice_kind ,
388388 prepaid = not proforma ,
389+ tax_date = self .payment .created ,
389390 )
390391 else :
391392 category = InvoiceCategory .HOSTING
@@ -396,6 +397,7 @@ def generate_invoice(self, *, proforma: bool = False) -> None:
396397 kind = invoice_kind ,
397398 customer = self .payment .customer ,
398399 vat_rate = self .payment .customer .vat_rate ,
400+ tax_date = self .payment .created ,
399401 currency = Currency .EUR ,
400402 prepaid = not proforma ,
401403 category = category ,
@@ -536,7 +538,7 @@ def get_instructions(self) -> list[tuple[StrOrPromise, str]]:
536538 return instructions
537539
538540 @classmethod
539- def fetch_payments (cls , from_date : str | None = None ) -> None : # noqa: C901, PLR0915
541+ def fetch_payments (cls , from_date : str | None = None ) -> None : # noqa: C901, PLR0915, PLR0912
540542 from weblate_web .invoices .models import Invoice , InvoiceKind # noqa: PLC0415
541543
542544 tokens : list [str ]
@@ -623,6 +625,9 @@ def fetch_payments(cls, from_date: str | None = None) -> None: # noqa: C901, PL
623625 print (f"{ invoice .number } : received payment" )
624626 # Instantionate backend (does SELECT FOR UPDATE)
625627 backend = payment .get_payment_backend ()
628+ # Sync payment date with the actual payment
629+ if backend .payment .created .date () != entry ["date" ]:
630+ backend .payment .created = entry ["date" ]
626631 # Store transaction details
627632 backend .payment .details ["transaction" ] = entry
628633 backend .success ()
0 commit comments