Skip to content

Commit

Permalink
Added receipt and method in invoice for receipts for donations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Apr 2, 2015
1 parent c76f5db commit ebd10a9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions sponsorship_sync_gp/model/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
##############################################################################

from openerp.osv import orm
from openerp.osv import orm, fields
from openerp.tools.translate import _

from . import gp_connector
Expand All @@ -21,7 +21,7 @@ class account_invoice(orm.Model):

# Add a field to know if we sent the receipt for a paid invoice
_columns = {
'receipt_id': fields.many2one('mail.thread', _('Receipt'))
'receipt_id': fields.many2one('mail.message', _('Receipt'))
}

def action_cancel(self, cr, uid, ids, context=None):
Expand Down Expand Up @@ -66,3 +66,20 @@ def action_move_create(self, cr, uid, ids, context=None):
_("GP Sync Error"),
_("Please contact an IT person."))
return res

def get_funds_paid(self, cr, uid, from_date, to_date,
context=None):
""" Search invoices paid in the given period which are not
sponsorships and return the ids. """
invl_obj = self.pool.get('account.invoice.line')
invl_ids = invl_obj.search(
cr, uid, [
('state', '=', 'paid'),
('last_payment', '>=', from_date),
('last_payment', '<=', to_date),
('contract_id', '=', False),
('price_subtotal', '>' 8)],
context=context)

return list(set([invl.invoice_id.id for invl in
invl_obj.browse(cr, uid, invl_ids, context)]))

0 comments on commit ebd10a9

Please sign in to comment.