diff --git a/models/donation_lines.py b/models/donation_lines.py new file mode 100644 index 0000000..e69de29 diff --git a/views/product.xml b/views/product.xml new file mode 100644 index 0000000..23e46f1 --- /dev/null +++ b/views/product.xml @@ -0,0 +1,14 @@ + + + opendons.product.template.form + product.template + + + + + + + + + + \ No newline at end of file diff --git a/wizard/donation_cancel_wizard.py b/wizard/donation_cancel_wizard.py new file mode 100644 index 0000000..e1feb86 --- /dev/null +++ b/wizard/donation_cancel_wizard.py @@ -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() diff --git a/wizard/donation_cancel_wizard.xml b/wizard/donation_cancel_wizard.xml new file mode 100644 index 0000000..470b4d5 --- /dev/null +++ b/wizard/donation_cancel_wizard.xml @@ -0,0 +1,18 @@ + + + + donation.cancel.wizard + opendons.donation_cancel.wizard + +
+

Please select a cancel raison :

+ + + +
+
+ +
\ No newline at end of file diff --git a/wizard/tax_receipt_annual_create.py b/wizard/tax_receipt_annual_create.py new file mode 100644 index 0000000..4840eda --- /dev/null +++ b/wizard/tax_receipt_annual_create.py @@ -0,0 +1,28 @@ +import datetime +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError +from odoo.tools.misc import format_date + +logger = logging.getLogger(__name__) + + +class TaxReceiptAnnualCreate(models.TransientModel): + _inherit = "tax.receipt.annual.create" + + @api.model + def _prepare_annual_tax_receipt(self, partner, partner_dict): + vals = { + "company_id": self.company_id.id, + "currency_id": self.company_id.currency_id.id, + "amount": partner_dict["amount"], + "type": "annual", + "partner_id": partner.id, + "date": self.end_date, + "donation_date": self.end_date, + } + # designed to add add O2M fields donation_ids and invoice_ids + vals.update(partner_dict["extra_vals"]) + return vals +