|
|
@ -0,0 +1,27 @@ |
|
|
|
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() |