Browse Source

bug pa

master
root 3 years ago
parent
commit
78eff7b461
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      models/donation.py

+ 15
- 13
models/donation.py View File

@ -244,19 +244,21 @@ class DonationDonation(models.Model):
@api.model
def create(self, vals):
# #vals['tax_receipt_option']='annual'
# if vals['tax_receipt_option']!='annual': raise Warning('The tax receipt option must be annual')
# #si montant du PA=0 => message
# total=0
# if not vals['line_ids']:
# total=0
# #raise Warning('please add a donation line')
# else:
# for line_d in vals['line_ids']:
# total=total+float(line_d[2]['unit_price'])
# if total==0:raise Warning('The total amount is null')
#vals['tax_receipt_option']='annual'
if vals['tax_receipt_option']!='annual' and vals['recurring_template']: raise Warning('The tax receipt option must be annual')
#si montant du PA=0 => message
if vals.get('line_ids',None):
total=0
if not vals['line_ids']:
total=0
#raise Warning('please add a donation line')
else:
for line_d in vals['line_ids']:
total=total+float(line_d[2]['unit_price'])
if total==0:raise Warning('The total amount is null')
res = super(DonationDonation, self).create(vals)


Loading…
Cancel
Save