root 1 year ago
parent
commit
2a71145b46
2 changed files with 8 additions and 4 deletions
  1. +2
    -2
      models/donation_tax_receipt.py
  2. +6
    -2
      models/partner.py

+ 2
- 2
models/donation_tax_receipt.py View File

@ -32,8 +32,8 @@ class DonationTaxReceipt(models.Model):
html_content_print=html_content_print.replace('{{date}}',today.strftime("%d %B %Y"))
html_content_print=html_content_print.replace('{{donor_id}}',str(self.partner_id.donor_id))
html_content_print=html_content_print.replace('{{fiscalyear}}',str(int(today.strftime("%Y"))-1))
html_content_print=html_content_print.replace('{{amount}}',str(res.amount))
html_content_print=html_content_print.replace('{{amountstr}}',num2words(float(res.amount),lang="fr",to="currency"))
html_content_print=html_content_print.replace('{{amount}}',str(round(res.amount,0)))
html_content_print=html_content_print.replace('{{amountstr}}',num2words(round(float(res.amount),0),lang="fr",to="currency"))
res.html_content_print=html_content_print
res.template_rf_id=template_rf.id


+ 6
- 2
models/partner.py View File

@ -260,6 +260,10 @@ class partner(models.Model):
@api.onchange('zip')
def _onchange_zip(self):
if self.zip:
if len(self.zip)!=5: raise ValidationError('invalid zip code')
if not self.zip.isnumeric(): raise ValidationError('invalid zip code')
if self.country_id.name=='France':
if len(self.zip)!=5: raise ValidationError('invalid zip code')
if not self.zip.isnumeric(): raise ValidationError('invalid zip code')
else:
if len(self.zip)>10: raise ValidationError('invalid zip code')
return

Loading…
Cancel
Save