|
@ -244,18 +244,19 @@ class DonationDonation(models.Model): |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def create(self, vals): |
|
|
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']: |
|
|
|
|
|
raise Warning('please add a donation line') |
|
|
|
|
|
else: |
|
|
|
|
|
for line_d in vals['line_ids']: |
|
|
|
|
|
|
|
|
# #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') |
|
|
|
|
|
|
|
|
# total=total+float(line_d[2]['unit_price']) |
|
|
|
|
|
# if total==0:raise Warning('The total amount is null') |
|
|
res = super(DonationDonation, self).create(vals) |
|
|
res = super(DonationDonation, self).create(vals) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|