Browse Source

divers

master
root 3 years ago
parent
commit
d9825452c9
5 changed files with 87 additions and 0 deletions
  1. +0
    -0
      models/donation_lines.py
  2. +14
    -0
      views/product.xml
  3. +27
    -0
      wizard/donation_cancel_wizard.py
  4. +18
    -0
      wizard/donation_cancel_wizard.xml
  5. +28
    -0
      wizard/tax_receipt_annual_create.py

+ 0
- 0
models/donation_lines.py View File


+ 14
- 0
views/product.xml View File

@ -0,0 +1,14 @@
<odoo>
<record id="opendons_product_template_form_view" model="ir.ui.view">
<field name="name">opendons.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<xpath expr="//group[@name='payables']" position="after">
<group>
<field name="analytic_account_id"/>
</group>
</xpath>
</field>
</record>
</odoo>

+ 27
- 0
wizard/donation_cancel_wizard.py View File

@ -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()

+ 18
- 0
wizard/donation_cancel_wizard.xml View File

@ -0,0 +1,18 @@
<odoo>
<record id="donation_cancel_view" model="ir.ui.view">
<field name="name">donation.cancel.wizard</field>
<field name="model">opendons.donation_cancel.wizard</field>
<field name="arch" type="xml">
<form>
<p>Please select a cancel raison :</p>
<field name="cancel_reason"/>
<footer>
<button name="cancelDonation" string="cancel the donation" type="object"/>
<button string="Cancel" class="btn btn-secondary" special="cancel" />
</footer>
</form>
</field>
</record>
</odoo>

+ 28
- 0
wizard/tax_receipt_annual_create.py View File

@ -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

Loading…
Cancel
Save