You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
1003 B

from odoo import fields, models, _
from datetime import datetime,timedelta,date
class DonationCancelWizard(models.TransientModel):
_name = 'opendons.donation_cancel.wizard'
_description = 'donation cancel wizard'
cancel_reason=fields.Selection(string='cancel reason',selection=[
('debit error','Debit error'),
('donor error','Donor error'),
('amount error','Amount error'),
('invalid check','invalid check'),
('affectation error','Affectation error'),
('date error','Date error'),
('other','Other')
])
donation_id=fields.Integer('donation id')
def cancelDonation(self):
donation=self.env['donation.donation'].search([('id','=',self.donation_id)])
donation.cancel_reason=self.cancel_reason
donation.state="cancel"
donation.partner_id._update_donor_rank()
if donation.payment_state=='deposited_in_accounting':
donation.reverse_accounting_entries()