Skip to content

Commit

Permalink
Add log message for the generation of fiscal receipts
Browse files Browse the repository at this point in the history
Annual fiscal receipts: check donation_date instead of the date of the tax receipt
  • Loading branch information
alexis-via committed Feb 9, 2017
1 parent e7328c6 commit ee74138
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions donation_tax_receipt/wizard/tax_receipt_annual_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from openerp import models, fields, api, _
from openerp.exceptions import Warning
from datetime import datetime
import logging

logger = logging.getLogger(__name__)


class TaxReceiptAnnualCreate(models.TransientModel):
Expand Down Expand Up @@ -60,6 +63,9 @@ def _prepare_annual_tax_receipt(self, partner_id, partner_dict):
@api.multi
def generate_annual_receipts(self):
self.ensure_one()
logger.info(
'START to generate annual fiscal receipts from %s to %s',
self.start_date, self.end_date)
donations = self.env['donation.donation'].search([
('donation_date', '>=', self.start_date),
('donation_date', '<=', self.end_date),
Expand Down Expand Up @@ -94,8 +100,8 @@ def generate_annual_receipts(self):
# or an each fiscal receipt
already_tax_receipts = \
self.env['donation.tax.receipt'].search([
('date', '<=', self.end_date),
('date', '>=', self.start_date),
('donation_date', '<=', self.end_date),
('donation_date', '>=', self.start_date),
('company_id', '=', vals['company_id']),
('partner_id', '=', vals['partner_id']),
])
Expand All @@ -108,6 +114,9 @@ def generate_annual_receipts(self):
already_tax_receipts[0].date))
tax_receipt = self.env['donation.tax.receipt'].create(vals)
tax_receipt_ids.append(tax_receipt.id)
logger.info('Tax receipt %s generated', tax_receipt.number)
logger.info(
'%d annual fiscal receipts generated', len(tax_receipt_ids))
action = {
'type': 'ir.actions.act_window',
'name': 'Tax Receipts',
Expand Down

0 comments on commit ee74138

Please sign in to comment.