diff --git a/donation/README.rst b/donation/README.rst
index 9a1386f2c..8866ad66b 100644
--- a/donation/README.rst
+++ b/donation/README.rst
@@ -1,3 +1,8 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+========
Donation
========
@@ -19,6 +24,10 @@ To use this module, go to the menu Donations > Donations and start to register n
To have some statistics about the donations, go to the menu Reporting > Donations > Donations Analysis.
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/180/9.0
+
Credits
=======
@@ -32,12 +41,14 @@ Contributors
Maintainer
----------
-.. image:: http://odoo-community.org/logo.png
+.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
- :target: http://odoo-community.org
+ :target: https://odoo-community.org
This module is maintained by the OCA.
-OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
-To contribute to this module, please visit http://odoo-community.org.
+To contribute to this module, please visit https://odoo-community.org.
diff --git a/donation/__init__.py b/donation/__init__.py
index d9262ed94..ece6f758e 100644
--- a/donation/__init__.py
+++ b/donation/__init__.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
-from . import donation_campaign
-from . import donation
-from . import product
+from . import models
from . import report
from . import wizard
+from .post_install import update_account_journal
diff --git a/donation/__openerp__.py b/donation/__openerp__.py
index d9c3a8b5e..5ac07e047 100644
--- a/donation/__openerp__.py
+++ b/donation/__openerp__.py
@@ -1,48 +1,29 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Donation',
- 'version': '9.0.0.1.0',
+ 'version': '9.0.1.0.0',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Manage donations',
'author': 'Barroux Abbey, Akretion, Odoo Community Association (OCA)',
'website': 'http://www.barroux.org',
- 'depends': ['account_accountant'],
+ 'depends': ['donation_base'],
'data': [
'security/donation_security.xml',
- 'donation_view.xml',
- 'account_view.xml',
- 'product_view.xml',
- 'donation_campaign_view.xml',
- 'users_view.xml',
+ 'views/donation.xml',
+ 'views/account.xml',
+ 'views/donation_campaign.xml',
+ 'views/users.xml',
+ 'views/partner.xml',
'security/ir.model.access.csv',
- 'partner_view.xml',
'report/donation_report_view.xml',
'wizard/donation_validate_view.xml',
],
- 'demo': ['donation_demo.xml'],
- 'test': ['test/validate.yml'],
+ 'post_init_hook': 'update_account_journal',
+ 'demo': ['demo/donation_demo.xml'],
'installable': True,
}
diff --git a/donation/demo/donation_demo.xml b/donation/demo/donation_demo.xml
new file mode 100644
index 000000000..e254a8a44
--- /dev/null
+++ b/donation/demo/donation_demo.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+ Quest
+
+
+
+ Prospecting
+
+
+
+ Catalog
+
+
+
+
+ 100
+
+
+
+ CHQ BNP 239023
+
+ each
+
+
+
+
+
+ 1
+ 100
+
+
+
+
+ 120
+
+
+
+
+
+ annual
+
+
+
+
+
+ 1
+ 120
+
+
+
+
+ 150
+
+
+
+
+
+ none
+
+
+
+
+
+ 1
+ 150
+
+
+
+
+
+ 1000
+
+
+
+
+
+ each
+
+
+
+
+
+ 1
+ 1000
+
+
+
+
+
+
+ 1200
+
+
+
+
+
+ each
+
+
+
+
+
+ 1
+ 800
+
+
+
+
+
+
+ 1
+ 400
+
+
+
+
+
+
+
+
diff --git a/donation/donation_campaign.py b/donation/donation_campaign.py
deleted file mode 100644
index 1c80d4ae3..000000000
--- a/donation/donation_campaign.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields, api
-
-
-class DonationCampaign(models.Model):
- _name = 'donation.campaign'
- _description = 'Code attributed for a Donation Campaign'
- _order = 'code'
- _rec_name = 'display_name'
-
- @api.one
- @api.depends('code', 'name')
- def _compute_display_name(self):
- name = self.name
- if self.code:
- name = u'[%s] %s' % (self.code, name)
- self.display_name = name
-
- code = fields.Char(string='Code', size=10)
- name = fields.Char(string='Name', required=True)
- display_name = fields.Char(
- string='Display Name', compute='_compute_display_name',
- readonly=True, store=True)
- start_date = fields.Date(
- string='Start Date', default=fields.Date.context_today)
- nota = fields.Text(string='Notes')
diff --git a/donation/donation_demo.xml b/donation/donation_demo.xml
deleted file mode 100644
index a40e127e7..000000000
--- a/donation/donation_demo.xml
+++ /dev/null
@@ -1,193 +0,0 @@
-
-
-
-
-
-
-
- Donation
- DON
-
-
- 1
- 0
- service
-
-
- This is a donation product.
-
-
-
- In-Kind Donation
- KIND-DON
-
-
- 1
- 1
- 0
- service
-
-
-
-
-
-
-
- Quest
-
-
-
- Prospecting
-
-
-
- Catalog
-
-
-
- Rémi Duplat
-
- 12 rue de l'espérance
- 69100
- Villeurbanne
-
- vincent.duplat@yahoo.example.com
-
-
-
- Lucie Dubois
-
- 34 rue Pierre Dupont
- 69001
- Lyon
-
- lucie.dubois@yahoo.example.com
-
-
-
- Joe Smith
-
- Craig Pond Trail
- 04431
- East Orland
-
-
- joe.smith@gmail.example.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/donation/models/__init__.py b/donation/models/__init__.py
new file mode 100644
index 000000000..e635b5817
--- /dev/null
+++ b/donation/models/__init__.py
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+
+from . import donation
+from . import donation_campaign
+from . import account
+from . import partner
+from . import users
diff --git a/donation/models/account.py b/donation/models/account.py
new file mode 100644
index 000000000..4b30d850b
--- /dev/null
+++ b/donation/models/account.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api, _
+from openerp.exceptions import ValidationError
+
+
+class AccountJournal(models.Model):
+ _inherit = 'account.journal'
+
+ allow_donation = fields.Boolean(string='Donation Payment Method')
+
+ @api.multi
+ @api.constrains('type', 'allow_donation')
+ def _check_donation(self):
+ for journal in self:
+ if journal.allow_donation and journal.type not in ('bank', 'cash'):
+ raise ValidationError(_(
+ "The journal '%s' has the option "
+ "'Donation Payment Method', so it's type should "
+ "be 'Cash' or 'Bank and Checks'.") % journal.name)
diff --git a/donation/donation.py b/donation/models/donation.py
similarity index 60%
rename from donation/donation.py
rename to donation/models/donation.py
index ee95d355d..cee74c51a 100644
--- a/donation/donation.py
+++ b/donation/models/donation.py
@@ -1,44 +1,13 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import UserError, ValidationError
import openerp.addons.decimal_precision as dp
-class ResUsers(models.Model):
- _inherit = 'res.users'
-
- # begin with context_ to allow user to change it by himself
- context_donation_campaign_id = fields.Many2one(
- 'donation.campaign', string='Current Donation Campaign')
- context_donation_journal_id = fields.Many2one(
- 'account.journal', string='Current Donation Payment Method',
- domain=[
- ('type', 'in', ('bank', 'cash')),
- ('allow_donation', '=', True)],
- company_dependent=True)
-
-
class DonationDonation(models.Model):
_name = 'donation.donation'
_description = 'Donation'
@@ -46,30 +15,32 @@ class DonationDonation(models.Model):
_rec_name = 'display_name'
_inherit = ['mail.thread']
- @api.one
+ @api.multi
@api.depends(
'line_ids', 'line_ids.unit_price', 'line_ids.quantity',
'donation_date', 'currency_id', 'company_id')
def _compute_total(self):
- total = 0.0
- for line in self.line_ids:
- total += line.quantity * line.unit_price
- self.amount_total = total
- donation_currency =\
- self.currency_id.with_context(date=self.donation_date)
- total_company_currency = donation_currency.compute(
- total, self.company_id.currency_id)
- self.amount_total_company_currency = total_company_currency
+ for donation in self:
+ total = 0.0
+ for line in donation.line_ids:
+ total += line.quantity * line.unit_price
+ donation.amount_total = total
+ donation_currency =\
+ donation.currency_id.with_context(date=donation.donation_date)
+ total_company_currency = donation_currency.compute(
+ total, donation.company_id.currency_id)
+ donation.amount_total_company_currency = total_company_currency
# We don't want a depends on partner_id.country_id, because if the partner
# moves to another country, we want to keep the old country for
- # past donations
- @api.one
+ # past donations to have good statistics
+ @api.multi
@api.depends('partner_id')
def _compute_country_id(self):
# Use sudo() to by-pass record rules, because the same partner
# can have donations in several companies
- self.sudo().country_id = self.partner_id.country_id or False
+ for donation in self:
+ donation.sudo().country_id = donation.partner_id.country_id
@api.model
def _default_currency(self):
@@ -86,6 +57,9 @@ def _default_currency(self):
'res.partner', string='Donor', required=True,
states={'done': [('readonly', True)]},
track_visibility='onchange', ondelete='restrict')
+ commercial_partner_id = fields.Many2one(
+ related='partner_id.commercial_partner_id',
+ string='Parent Donor', readonly=True, store=True)
# country_id is here to have stats per country
# WARNING : I can't put a related field, because when someone
# writes on the country_id of a partner, it will trigger a write
@@ -150,16 +124,59 @@ def _default_currency(self):
display_name = fields.Char(
string='Display Name', compute='_compute_display_name',
readonly=True)
+ tax_receipt_id = fields.Many2one(
+ 'donation.tax.receipt', string='Tax Receipt', readonly=True,
+ copy=False)
+ tax_receipt_option = fields.Selection([
+ ('none', 'None'),
+ ('each', 'For Each Donation'),
+ ('annual', 'Annual Tax Receipt'),
+ ], string='Tax Receipt Option', states={'done': [('readonly', True)]})
+ tax_receipt_total = fields.Monetary(
+ compute='_tax_receipt_total', string='Eligible Tax Receipt Sub-total',
+ store=True, currency_field='currency_id')
- @api.one
+ @api.multi
@api.constrains('donation_date')
def _check_donation_date(self):
- if self.donation_date > fields.Date.context_today(self):
- # No error pop-up to user : Odoo 9 BUG ?
- raise ValidationError(
- _('The date of the donation of %s should be today '
+ for donation in self:
+ if donation.donation_date > fields.Date.context_today(self):
+ # TODO No error pop-up to user : Odoo 9 BUG ?
+ raise ValidationError(_(
+ 'The date of the donation of %s should be today '
'or in the past, not in the future!')
- % self.partner_id.name)
+ % donation.partner_id.name)
+
+ @api.multi
+ @api.depends(
+ 'line_ids', 'line_ids.quantity', 'line_ids.unit_price',
+ 'line_ids.product_id')
+ def _tax_receipt_total(self):
+ for donation in self:
+ total = 0.0
+ # Do not consider other currencies for tax receipts
+ # because, for the moment, only very very few countries
+ # accept tax receipts from other countries, and never in another
+ # currency. If you know such cases, please tell us and we will
+ # update the code of this module
+ if donation.currency_id == donation.company_currency_id:
+ for line in donation.line_ids:
+ # Filter the lines eligible for a tax receipt.
+ if line.tax_receipt_ok:
+ total += line.quantity * line.unit_price
+ donation.tax_receipt_total = total
+
+ @api.model
+ def _prepare_tax_receipt(self):
+ vals = {
+ 'company_id': self.company_id.id,
+ 'currency_id': self.currency_id.id,
+ 'donation_date': self.donation_date,
+ 'amount': self.tax_receipt_total,
+ 'type': 'each',
+ 'partner_id': self.commercial_partner_id.id,
+ }
+ return vals
@api.model
def _prepare_move_line_name(self):
@@ -269,70 +286,88 @@ def _prepare_donation_move(self):
}
return vals
- @api.one
+ @api.multi
def validate(self):
- if not self.line_ids:
- raise UserError(
- _("Cannot validate the donation of %s because it doesn't "
- "have any lines!") % self.partner_id.name)
-
- if self.state != 'draft':
- raise UserError(
- _("Cannot validate the donation of %s because it is not "
- "in draft state.") % self.partner_id.name)
-
- if (
- self.env['res.users'].has_group(
- 'account.group_supplier_inv_check_total') and
- self.check_total != self.amount_total):
- raise UserError(
- _("The amount of the donation of %s (%s) is different from "
- "the sum of the donation lines (%s).") % (
- self.partner_id.name, self.check_total,
- self.amount_total))
-
- donation_write_vals = {'state': 'done'}
-
- if self.amount_total:
- move_vals = self._prepare_donation_move()
- # when we have a full in-kind donation: no account move
- if move_vals:
- move = self.env['account.move'].create(move_vals)
- move.post()
- donation_write_vals['move_id'] = move.id
- else:
- self.message_post(
- _('Full in-kind donation: no account move generated'))
-
- self.write(donation_write_vals)
+ check_total = self.env['res.users'].has_group(
+ 'donation.group_donation_check_total')
+ for donation in self:
+ if not donation.line_ids:
+ raise UserError(_(
+ "Cannot validate the donation of %s because it doesn't "
+ "have any lines!") % donation.partner_id.name)
+
+ if donation.state != 'draft':
+ raise UserError(_(
+ "Cannot validate the donation of %s because it is not "
+ "in draft state.") % donation.partner_id.name)
+
+ if check_total and donation.check_total != donation.amount_total:
+ raise UserError(_(
+ "The amount of the donation of %s (%s) is different "
+ "from the sum of the donation lines (%s).") % (
+ donation.partner_id.name, donation.check_total,
+ donation.amount_total))
+
+ vals = {'state': 'done'}
+
+ if donation.amount_total:
+ move_vals = donation._prepare_donation_move()
+ # when we have a full in-kind donation: no account move
+ if move_vals:
+ move = self.env['account.move'].create(move_vals)
+ move.post()
+ vals['move_id'] = move.id
+ else:
+ donation.message_post(_(
+ 'Full in-kind donation: no account move generated'))
+ if (
+ donation.tax_receipt_option == 'each' and
+ donation.tax_receipt_total and
+ not donation.tax_receipt_id):
+ receipt_vals = donation._prepare_tax_receipt()
+ receipt = self.env['donation.tax.receipt'].create(receipt_vals)
+ vals['tax_receipt_id'] = receipt.id
+
+ donation.write(vals)
return
- @api.one
+ @api.multi
def save_default_values(self):
+ self.ensure_one()
self.env.user.write({
'context_donation_journal_id': self.journal_id.id,
'context_donation_campaign_id': self.campaign_id.id,
})
- return
- @api.one
+ @api.multi
def done2cancel(self):
'''from Done state to Cancel state'''
- if self.move_id:
- self.move_id.button_cancel()
- self.move_id.unlink()
- self.state = 'cancel'
- return
+ for donation in self:
+ if donation.tax_receipt_id:
+ raise UserError(_(
+ "You cannot cancel this donation because "
+ "it is linked to the tax receipt %s. You should first "
+ "delete this tax receipt (but it may not be legally "
+ "allowed).")
+ % donation.tax_receipt_id.number)
+ if donation.move_id:
+ donation.move_id.button_cancel()
+ donation.move_id.unlink()
+ donation.state = 'cancel'
- @api.one
+ @api.multi
def cancel2draft(self):
'''from Cancel state to Draft state'''
- if self.move_id:
- raise UserError(
- _("A cancelled donation should not be linked to an "
- "account move"))
- self.state = 'draft'
- return
+ for donation in self:
+ if donation.move_id:
+ raise UserError(_(
+ "A cancelled donation should not be linked to "
+ "an account move"))
+ if donation.tax_receipt_id:
+ raise UserError(_(
+ "A cancelled donation should not be linked to "
+ "a tax receipt"))
+ donation.state = 'draft'
@api.multi
def unlink(self):
@@ -348,30 +383,40 @@ def unlink(self):
"so you cannot delete it."))
return super(DonationDonation, self).unlink()
- @api.one
+ @api.multi
@api.depends('state', 'partner_id', 'move_id')
def _compute_display_name(self):
- if self.state == 'draft':
- name = _('Draft Donation of %s') % self.partner_id.name
- elif self.state == 'cancel':
- name = _('Cancelled Donation of %s') % self.partner_id.name
- else:
- name = self.number
- self.display_name = name
+ for donation in self:
+ if donation.state == 'draft':
+ name = _('Draft Donation of %s') % donation.partner_id.name
+ elif donation.state == 'cancel':
+ name = _('Cancelled Donation of %s') % donation.partner_id.name
+ else:
+ name = donation.number
+ donation.display_name = name
- # used by module donation_tax_receipt (and donation_stay)
@api.onchange('partner_id')
def partner_id_change(self):
- return
+ if self.partner_id:
+ self.tax_receipt_option = self.partner_id.tax_receipt_option
- @api.multi
- def _track_subtype(self, init_values):
- self.ensure_one()
- if 'state' in init_values and self.state == 'done':
- return 'donation.donation_done'
- elif 'state' in init_values and self.state == 'cancel':
- return 'donation.donation_cancel'
- return super(DonationDonation, self)._track_subtype(init_values)
+ @api.onchange('tax_receipt_option')
+ def tax_receipt_option_change(self):
+ res = {}
+ if (
+ self.partner_id and
+ self.partner_id.tax_receipt_option == 'annual' and
+ self.tax_receipt_option != 'annual'):
+ res = {
+ 'warning': {
+ 'title': _('Error:'),
+ 'message':
+ _('You cannot change the Tax Receipt '
+ 'Option when it is Annual.'),
+ },
+ }
+ self.tax_receipt_option = 'annual'
+ return res
class DonationLine(models.Model):
@@ -379,22 +424,18 @@ class DonationLine(models.Model):
_description = 'Donation Lines'
_rec_name = 'product_id'
- @api.one
- @api.depends('unit_price', 'quantity')
- def _compute_amount(self):
- amount = self.quantity * self.unit_price
- self.amount = amount
-
- @api.one
+ @api.multi
@api.depends(
'unit_price', 'quantity', 'donation_id.currency_id',
'donation_id.donation_date', 'donation_id.company_id')
def _compute_amount_company_currency(self):
- amount = self.quantity * self.unit_price
- donation_currency = self.donation_id.currency_id.with_context(
- date=self.donation_id.donation_date)
- self.amount_company_currency = donation_currency.compute(
- amount, self.donation_id.company_id.currency_id)
+ for line in self:
+ amount = line.quantity * line.unit_price
+ line.amount = amount
+ donation_currency = line.donation_id.currency_id.with_context(
+ date=line.donation_id.donation_date)
+ line.amount_company_currency = donation_currency.compute(
+ amount, line.donation_id.company_id.currency_id)
donation_id = fields.Many2one(
'donation.donation', string='Donation', ondelete='cascade')
@@ -422,49 +463,30 @@ def _compute_amount_company_currency(self):
analytic_account_id = fields.Many2one(
'account.analytic.account', string='Analytic Account',
domain=[('type', 'not in', ('view', 'template'))], ondelete='restrict')
- in_kind = fields.Boolean(string='In Kind')
sequence = fields.Integer('Sequence')
+ # for the fields tax_receipt_ok and in_kind, we made an important change
+ # between v8 and v9: in v8, it was a reglar field set by an onchange
+ # in v9, it is a related stored field
+ tax_receipt_ok = fields.Boolean(
+ related='product_id.tax_receipt_ok', readonly=True, store=True)
+ in_kind = fields.Boolean(
+ related='product_id.in_kind_donation', readonly=True, store=True,
+ string='In Kind')
@api.onchange('product_id')
def product_id_change(self):
if self.product_id:
+ # We should change that one day...
if self.product_id.list_price:
self.unit_price = self.product_id.list_price
- self.in_kind = self.product_id.in_kind_donation
@api.model
def get_analytic_account_id(self):
return self.analytic_account_id.id or False
-class ResPartner(models.Model):
- _inherit = 'res.partner'
-
- @api.one
- @api.depends('donation_ids.partner_id')
- def _donation_count(self):
- # The current user may not have access rights for donations
- try:
- self.donation_count = len(self.donation_ids)
- except:
- self.donation_count = 0
+class DonationTaxReceipt(models.Model):
+ _inherit = 'donation.tax.receipt'
donation_ids = fields.One2many(
- 'donation.donation', 'partner_id', string='Donations')
- donation_count = fields.Integer(
- compute='_donation_count', string="# of Donations", readonly=True)
-
-
-class AccountJournal(models.Model):
- _inherit = 'account.journal'
-
- allow_donation = fields.Boolean(string='Donation Payment Method')
-
- @api.one
- @api.constrains('type', 'allow_donation')
- def _check_donation(self):
- if self.allow_donation and self.type not in ('bank', 'cash'):
- raise UserError(
- _("The journal '%s' has the option 'Donation Payment Method', "
- "so it's type should be 'Cash' or 'Bank and Checks'.")
- % self.name)
+ 'donation.donation', 'tax_receipt_id', string='Related Donations')
diff --git a/donation/models/donation_campaign.py b/donation/models/donation_campaign.py
new file mode 100644
index 000000000..82832055b
--- /dev/null
+++ b/donation/models/donation_campaign.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api
+
+
+class DonationCampaign(models.Model):
+ _name = 'donation.campaign'
+ _description = 'Code attributed for a Donation Campaign'
+ _order = 'code'
+ _rec_name = 'display_name'
+
+ @api.multi
+ @api.depends('code', 'name')
+ def _compute_display_name(self):
+ for camp in self:
+ name = camp.name
+ if camp.code:
+ name = u'[%s] %s' % (camp.code, name)
+ camp.display_name = name
+
+ code = fields.Char(string='Code', size=10)
+ name = fields.Char(string='Name', required=True)
+ display_name = fields.Char(
+ string='Display Name', compute='_compute_display_name',
+ readonly=True, store=True)
+ start_date = fields.Date(
+ string='Start Date', default=fields.Date.context_today)
+ nota = fields.Text(string='Notes')
diff --git a/donation/models/partner.py b/donation/models/partner.py
new file mode 100644
index 000000000..69244ad9e
--- /dev/null
+++ b/donation/models/partner.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api
+
+
+class ResPartner(models.Model):
+ _inherit = 'res.partner'
+
+ @api.multi
+ @api.depends('donation_ids.partner_id')
+ def _donation_count(self):
+ # The current user may not have access rights for donations
+ for partner in self:
+ try:
+ partner.donation_count = len(partner.donation_ids)
+ except:
+ partner.donation_count = 0
+
+ donation_ids = fields.One2many(
+ 'donation.donation', 'partner_id', string='Donations',
+ readonly=True)
+ donation_count = fields.Integer(
+ compute='_donation_count', string="# of Donations", readonly=True)
diff --git a/donation/models/users.py b/donation/models/users.py
new file mode 100644
index 000000000..79458e980
--- /dev/null
+++ b/donation/models/users.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields
+
+
+class ResUsers(models.Model):
+ _inherit = 'res.users'
+
+ # begin with context_ to allow user to change it by himself
+ context_donation_campaign_id = fields.Many2one(
+ 'donation.campaign', string='Current Donation Campaign')
+ context_donation_journal_id = fields.Many2one(
+ 'account.journal', string='Current Donation Payment Method',
+ domain=[
+ ('type', 'in', ('bank', 'cash')),
+ ('allow_donation', '=', True)],
+ company_dependent=True)
diff --git a/donation/post_install.py b/donation/post_install.py
new file mode 100644
index 000000000..6b60bebcf
--- /dev/null
+++ b/donation/post_install.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+# © 2016 Akretion (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import SUPERUSER_ID
+
+
+def update_account_journal(cr, pool):
+ ajo = pool['account.journal']
+ journal_ids = ajo.search(
+ cr, SUPERUSER_ID, [('type', 'in', ('bank', 'cash'))])
+ if journal_ids:
+ ajo.write(cr, SUPERUSER_ID, journal_ids, {'allow_donation': True})
+ return
diff --git a/donation/product.py b/donation/product.py
deleted file mode 100644
index 390136681..000000000
--- a/donation/product.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields, api
-
-
-class ProductTemplate(models.Model):
- _inherit = 'product.template'
-
- donation = fields.Boolean(
- string='Is a Donation',
- help="Specify if the product can be selected "
- "in a donation line.")
- in_kind_donation = fields.Boolean(
- string="In-Kind Donation")
-
- @api.onchange('donation')
- def _donation_change(self):
- if self.donation:
- self.type = 'service'
- self.sale_ok = False
-
- @api.onchange('in_kind_donation')
- def _in_kind_donation_change(self):
- if self.in_kind_donation:
- self.donation = True
-
-
-class ProductProduct(models.Model):
- _inherit = 'product.product'
-
- @api.onchange('donation')
- def _donation_change(self):
- if self.donation:
- self.type = 'service'
- self.sale_ok = False
-
- @api.onchange('in_kind_donation')
- def _in_kind_donation_change(self):
- if self.in_kind_donation:
- self.donation = True
diff --git a/donation/report/donation_report.py b/donation/report/donation_report.py
index 12b236835..39c9fbfd2 100644
--- a/donation/report/donation_report.py
+++ b/donation/report/donation_report.py
@@ -1,25 +1,7 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import tools
from openerp import models, fields
@@ -45,6 +27,7 @@ class DonationReport(models.Model):
campaign_id = fields.Many2one(
'donation.campaign', string='Donation Campaign', readonly=True)
in_kind = fields.Boolean(string='In Kind')
+ tax_receipt_ok = fields.Boolean(string='Eligible for a Tax Receipt')
amount_company_currency = fields.Float(
'Amount Company Currency', readonly=True)
@@ -54,6 +37,7 @@ def _select(self):
d.donation_date AS donation_date,
l.product_id AS product_id,
l.in_kind AS in_kind,
+ l.tax_receipt_ok AS tax_receipt_ok,
pt.categ_id AS product_categ_id,
d.company_id AS company_id,
d.partner_id AS partner_id,
@@ -82,6 +66,7 @@ def _group_by(self):
group_by = """
GROUP BY l.product_id,
l.in_kind,
+ l.tax_receipt_ok,
pt.categ_id,
d.donation_date,
d.partner_id,
diff --git a/donation/report/donation_report_view.xml b/donation/report/donation_report_view.xml
index 837a725d1..0475b9ba0 100644
--- a/donation/report/donation_report_view.xml
+++ b/donation/report/donation_report_view.xml
@@ -1,12 +1,11 @@
-
+
@@ -15,14 +14,24 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -66,4 +75,4 @@
parent="donation_report_title_menu" sequence="10"/>
-
+
diff --git a/donation/security/donation_security.xml b/donation/security/donation_security.xml
index 560017a58..eb37b4114 100644
--- a/donation/security/donation_security.xml
+++ b/donation/security/donation_security.xml
@@ -34,6 +34,11 @@
+
+ Donation Check Total
+
+
+
diff --git a/donation/security/ir.model.access.csv b/donation/security/ir.model.access.csv
index d13a15ecc..71eee0db1 100644
--- a/donation/security/ir.model.access.csv
+++ b/donation/security/ir.model.access.csv
@@ -12,3 +12,6 @@ access_account_move_donation,Full access on account.move,account.model_account_m
access_account_move_line_donation,Full access on account.move.line,account.model_account_move_line,group_donation_user,1,1,1,1
access_account_analytic_line_donation,Full access on account.analytic.line to donation user,analytic.model_account_analytic_line,group_donation_user,1,1,1,1
access_donation_report,Full access on donation.report to Donation Viewer,model_donation_report,group_donation_viewer,1,1,1,1
+access_donation_tax_receipt_viewer,Read access on donation.tax.receipt to Donation Viewer grp,model_donation_tax_receipt,donation.group_donation_viewer,1,0,0,0
+access_donation_tax_receipt,Create/Write access on donation.tax.receipt to Donation User,model_donation_tax_receipt,donation.group_donation_user,1,0,1,0
+access_donation_tax_receipt_full,Full access on donation.tax.receipt to Donation Manager,model_donation_tax_receipt,donation.group_donation_manager,1,1,1,1
diff --git a/donation/test/validate.yml b/donation/test/validate.yml
deleted file mode 100644
index 10db82b97..000000000
--- a/donation/test/validate.yml
+++ /dev/null
@@ -1,63 +0,0 @@
--
- Validate donation1
--
- !function {model: donation.donation, name: validate}:
- - eval: "[obj(ref('donation1')).id]"
--
- Donation1 Check that an account move has been generated
--
- !assert {model: donation.donation, id: donation1, string: Donation1 was not correctly validated}:
- - state == 'done'
- - move_id.date == time.strftime('%Y-%m-01')
- - move_id.journal_id.id == ref('account.check_journal')
- - move_id.state == 'posted'
- - move_id.ref == 'CHQ BNP 239023'
--
- Validate donation2
--
- !function {model: donation.donation, name: validate}:
- - eval: "[obj(ref('donation2')).id]"
--
- Donation2 Check that an account move has been generated
--
- !assert {model: donation.donation, id: donation2, string: Donation2 was not correctly validated}:
- - state == 'done'
- - move_id.date == time.strftime('%Y-%m-01')
- - move_id.journal_id.id == ref('account.bank_journal')
- - move_id.state == 'posted'
--
- Validate donation3
--
- !function {model: donation.donation, name: validate}:
- - eval: "[obj(ref('donation3')).id]"
--
- Donation3 Check that an account move has been generated
--
- !assert {model: donation.donation, id: donation3, string: Donation3 was not correctly validated}:
- - state == 'done'
- - move_id.date == time.strftime('%Y-%m-01')
- - move_id.journal_id.id == ref('account.cash_journal')
- - move_id.state == 'posted'
--
- Validate donation4
--
- !function {model: donation.donation, name: validate}:
- - eval: "[obj(ref('donation4')).id]"
--
- Donation4 Check that no account move has been generated (full in-kind donation)
--
- !python {id: donation4, model: donation.donation}: |
- assert self.state == 'done', 'Donation has not been set to done (donation4)'
- assert not self.move_id, 'Donation should not have an account move (donation4)'
--
- Validate donation5
--
- !function {model: donation.donation, name: validate}:
- - eval: "[obj(ref('donation5')).id]"
--
- Donation5 Check that an account move has been generated (partial in-kind donation)
--
- !python {id: donation5, model: donation.donation}: |
- assert self.state == 'done', 'Donation has not been set to done (donation5)'
- assert self.move_id, 'No account move generated (donation5)'
- assert self.move_id.amount == 400, 'Wrong amount on account move'
diff --git a/donation/tests/__init__.py b/donation/tests/__init__.py
new file mode 100644
index 000000000..7679605f5
--- /dev/null
+++ b/donation/tests/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import test_donation
diff --git a/donation/tests/test_donation.py b/donation/tests/test_donation.py
new file mode 100644
index 000000000..142ee8ea5
--- /dev/null
+++ b/donation/tests/test_donation.py
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+# © 2015-2016 Akretion (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from openerp.tests.common import TransactionCase
+import time
+
+
+class TestDonation(TransactionCase):
+
+ def test_donation(self):
+ for i in range(1, 6):
+ donation = self.env.ref('donation.donation%d' % i)
+ self.assertEquals(donation.state, 'draft')
+ donation.validate()
+ self.assertEquals(donation.state, 'done')
+ if i == 4: # full in-kind donation
+ self.assertFalse(donation.move_id)
+ else:
+ self.assertEquals(donation.move_id.state, 'posted')
+ self.assertEquals(donation.payment_ref, donation.move_id.ref)
+ self.assertEquals(
+ donation.journal_id, donation.move_id.journal_id)
+ self.assertEquals(
+ donation.donation_date, donation.move_id.date)
+ if (
+ donation.tax_receipt_option == 'each' and
+ donation.tax_receipt_total):
+ self.assertTrue(donation.tax_receipt_id)
+ tax_receipt = donation.tax_receipt_id
+ self.assertEquals(tax_receipt.type, 'each')
+ self.assertEquals(
+ donation.commercial_partner_id, tax_receipt.partner_id)
+ self.assertEquals(
+ donation.donation_date, tax_receipt.donation_date)
+ self.assertEquals(
+ donation.tax_receipt_total, tax_receipt.amount)
+
+ def test_annual_tax_receipt(self):
+ partner_familly = self.env['res.partner'].create({
+ 'name': u'Famille Joly',
+ 'tax_receipt_option': 'annual',
+ })
+ partner_husband = self.env['res.partner'].create({
+ 'parent_id': partner_familly.id,
+ 'name': u'Xavier Joly'})
+ partner_wife = self.env['res.partner'].create({
+ 'parent_id': partner_familly.id,
+ 'name': u'Stéphanie Joly'})
+
+ dons = self.create_donation_annual_receipt(
+ partner_husband, 40, 10, 'CHQ FB 93283290')
+ dons += self.create_donation_annual_receipt(
+ partner_husband, 140, 60, 'CHQ FB OPIE02')
+ dons += self.create_donation_annual_receipt(
+ partner_wife, 20, 5, 'CHQ FB AZERTY1242')
+ dons.validate()
+ last_day_year = time.strftime('%Y-12-31')
+ wizard = self.env['tax.receipt.annual.create'].create({
+ 'start_date': time.strftime('%Y-01-01'),
+ 'end_date': last_day_year})
+ action = wizard.generate_annual_receipts()
+ tax_receipt_ids = action['domain'][0][2]
+ self.assertTrue(tax_receipt_ids)
+ dtro = self.env['donation.tax.receipt']
+ tax_receipts = dtro.search([
+ ('partner_id', '=', partner_familly.id),
+ ('type', '=', 'annual'),
+ ('id', 'in', tax_receipt_ids)])
+ self.assertEquals(len(tax_receipts), 1)
+ tax_receipt = tax_receipts[0]
+ self.assertEquals(tax_receipt.amount, 200)
+ self.assertTrue(tax_receipt.number)
+
+ self.assertEquals(tax_receipt.date, last_day_year)
+ self.assertEquals(tax_receipt.donation_date, last_day_year)
+ self.assertEquals(
+ tax_receipt.currency_id, dons[0].company_id.currency_id)
+
+ def create_donation_annual_receipt(
+ self, partner, amount_tax_receipt, amount_no_tax_receipt,
+ payment_ref):
+ journal = self.env['account.journal'].search([(
+ 'type', '=', 'bank')], limit=1)
+ donation = self.env['donation.donation'].create({
+ 'journal_id': journal.id,
+ 'partner_id': partner.id,
+ 'currency_id': self.env.ref('base.main_company').currency_id.id,
+ 'tax_receipt_option': 'annual',
+ 'donation_date': time.strftime('%Y-01-01'),
+ 'payment_ref': payment_ref,
+ 'line_ids': [
+ (0, 0, {
+ 'product_id':
+ self.env.ref('donation_base.product_product_donation').id,
+ 'quantity': 1,
+ 'unit_price': amount_tax_receipt,
+ }),
+ (0, 0, {
+ 'product_id': self.env.ref(
+ 'donation_base.product_product_donation_notaxreceipt'
+ ).id,
+ 'quantity': 1,
+ 'unit_price': amount_no_tax_receipt,
+ }),
+ ]
+ })
+ return donation
diff --git a/donation/account_view.xml b/donation/views/account.xml
similarity index 71%
rename from donation/account_view.xml
rename to donation/views/account.xml
index 25fa0600a..c756aca1f 100644
--- a/donation/account_view.xml
+++ b/donation/views/account.xml
@@ -1,6 +1,11 @@
+
-
+
@@ -16,4 +21,4 @@
-
+
diff --git a/donation/donation_view.xml b/donation/views/donation.xml
similarity index 77%
rename from donation/donation_view.xml
rename to donation/views/donation.xml
index fe46dcaba..f4aab7750 100644
--- a/donation/donation_view.xml
+++ b/donation/views/donation.xml
@@ -1,12 +1,11 @@
-
+
@@ -39,13 +38,16 @@
+ groups="donation.group_donation_check_total"/>
+
+
+
@@ -107,10 +109,12 @@
+
+
@@ -150,6 +154,7 @@
+
@@ -168,6 +173,7 @@
+
@@ -204,20 +210,47 @@
-
-
- Validated
- donation.donation
-
- Donation validated
+
+ Products
+ product.template
+ kanban,tree,form
+ {'search_default_filter_donation': 1, 'default_donation': 1}
-
- Cancelled
- donation.donation
-
- Donation cancelled
+
+
+
+ donation.donation.tax.receipt.form
+ donation.tax.receipt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/donation/donation_campaign_view.xml b/donation/views/donation_campaign.xml
similarity index 83%
rename from donation/donation_campaign_view.xml
rename to donation/views/donation_campaign.xml
index 3584c4f06..fbda61fc3 100644
--- a/donation/donation_campaign_view.xml
+++ b/donation/views/donation_campaign.xml
@@ -1,12 +1,11 @@
-
+
@@ -46,4 +45,4 @@
parent="donation_config_menu" sequence="30"/>
-
+
diff --git a/donation/partner_view.xml b/donation/views/partner.xml
similarity index 80%
rename from donation/partner_view.xml
rename to donation/views/partner.xml
index f775c3d7b..5dd96c986 100644
--- a/donation/partner_view.xml
+++ b/donation/views/partner.xml
@@ -1,13 +1,11 @@
-
-
+
@@ -34,4 +32,4 @@
-
+
diff --git a/donation/users_view.xml b/donation/views/users.xml
similarity index 81%
rename from donation/users_view.xml
rename to donation/views/users.xml
index 8b51e91b1..42176fbff 100644
--- a/donation/users_view.xml
+++ b/donation/views/users.xml
@@ -1,12 +1,11 @@
-
+
@@ -36,4 +35,4 @@
-
+
diff --git a/donation/wizard/donation_validate.py b/donation/wizard/donation_validate.py
index 9bb857e95..66ca4bb64 100644
--- a/donation/wizard/donation_validate.py
+++ b/donation/wizard/donation_validate.py
@@ -1,25 +1,7 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api
diff --git a/donation_base/README.rst b/donation_base/README.rst
new file mode 100644
index 000000000..5ad67e89c
--- /dev/null
+++ b/donation_base/README.rst
@@ -0,0 +1,51 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+=============
+Donation Base
+=============
+
+This is the base module for donations. This module doesn't do anything in itself ; it just adds some properties on products and partners and adds the *donation.tax.receipt* object.
+
+To get some real features, you should install the *donation* or the *donation_sale* module. To understand the difference between these 2 modules, read `this post `_.
+
+Configuration
+=============
+
+To configure this module, you need to:
+
+ * create donation products
+ * set the *Tax Receipt Option* on partners
+
+Usage
+=====
+
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/180/9.0
+
+Credits
+=======
+
+Contributors
+------------
+
+* Brother Bernard
+* Brother Irénée (Barroux Abbey)
+* Alexis de Lattre
+
+Maintainer
+----------
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+This module is maintained by the OCA.
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
+To contribute to this module, please visit https://odoo-community.org.
diff --git a/donation_base/__init__.py b/donation_base/__init__.py
new file mode 100644
index 000000000..35e7c9600
--- /dev/null
+++ b/donation_base/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+
+from . import models
+from . import wizard
diff --git a/donation_base/__openerp__.py b/donation_base/__openerp__.py
new file mode 100644
index 000000000..968b2ba34
--- /dev/null
+++ b/donation_base/__openerp__.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ 'name': 'Donation Base',
+ 'version': '9.0.1.0.0',
+ 'category': 'Accounting & Finance',
+ 'license': 'AGPL-3',
+ 'summary': 'Base module for donations',
+ 'author': 'Barroux Abbey, Akretion, Odoo Community Association (OCA)',
+ 'website': 'http://www.barroux.org',
+ 'depends': ['account'],
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'security/tax_receipt_security.xml',
+ 'data/donation_tax_seq.xml',
+ 'views/product.xml',
+ 'views/partner.xml',
+ 'views/donation_tax_receipt.xml',
+ 'report/report.xml',
+ 'report/report_donationtax.xml',
+ 'wizard/tax_receipt_annual_create_view.xml',
+ 'wizard/tax_receipt_print_view.xml',
+ ],
+ 'demo': ['demo/donation_demo.xml'],
+ 'installable': True,
+}
diff --git a/donation_tax_receipt/donation_tax_data.xml b/donation_base/data/donation_tax_seq.xml
similarity index 65%
rename from donation_tax_receipt/donation_tax_data.xml
rename to donation_base/data/donation_tax_seq.xml
index 760d3e56e..3b19ba449 100644
--- a/donation_tax_receipt/donation_tax_data.xml
+++ b/donation_base/data/donation_tax_seq.xml
@@ -1,9 +1,8 @@
diff --git a/donation_base/demo/donation_demo.xml b/donation_base/demo/donation_demo.xml
new file mode 100644
index 000000000..07c540887
--- /dev/null
+++ b/donation_base/demo/donation_demo.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+ Donation
+ DON
+
+
+
+
+ 0
+ service
+
+
+ This donation item is eligible for a tax receipt.
+
+
+
+
+ Donation - no tax receipt
+ DON-NOTAXR
+
+
+
+
+ 0
+ service
+
+
+ This donation item is not eligible for a tax receipt.
+
+
+
+ In-Kind Donation
+ KIND-DON
+
+
+
+
+
+ 0
+ service
+
+
+ This donation item is eligible for a tax receipt.
+
+
+
+ In-Kind Donation - no tax receipt
+ KIND-DON-NOTAXR
+
+
+
+
+
+ 0
+ service
+
+
+ This donation item is not eligible for a tax receipt.
+
+
+
+
+
+ Rémi Duplat
+
+ 12 rue de l'espérance
+ 69100
+ Villeurbanne
+
+ vincent.duplat@yahoo.example.com
+ each
+
+
+
+ Lucie Dubois
+
+ 34 rue Pierre Dupont
+ 69001
+ Lyon
+
+ lucie.dubois@yahoo.example.com
+ annual
+
+
+
+ Joe Smith
+
+ Craig Pond Trail
+ 04431
+ East Orland
+
+
+ joe.smith@gmail.example.com
+ none
+
+
+
+
diff --git a/donation_tax_receipt/__init__.py b/donation_base/models/__init__.py
similarity index 50%
rename from donation_tax_receipt/__init__.py
rename to donation_base/models/__init__.py
index 84013a94a..53867e6ef 100644
--- a/donation_tax_receipt/__init__.py
+++ b/donation_base/models/__init__.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-from . import donation_tax
-from . import partner
from . import product
-from . import wizard
-from . import report
+from . import partner
+from . import donation_tax_receipt
diff --git a/donation_base/models/donation_tax_receipt.py b/donation_base/models/donation_tax_receipt.py
new file mode 100644
index 000000000..e06ed1026
--- /dev/null
+++ b/donation_base/models/donation_tax_receipt.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api
+import openerp.addons.decimal_precision as dp
+
+
+class DonationTaxReceipt(models.Model):
+ _name = 'donation.tax.receipt'
+ _description = "Tax Receipt for Donations"
+ _order = 'id desc'
+ _rec_name = 'number'
+
+ number = fields.Char(string='Receipt Number')
+ date = fields.Date(
+ string='Date', required=True, default=fields.Date.context_today)
+ donation_date = fields.Date(string='Donation Date')
+ amount = fields.Monetary(
+ string='Amount', digits=dp.get_precision('Account'),
+ currency_field='currency_id')
+ currency_id = fields.Many2one(
+ 'res.currency', string='Currency', required=True, ondelete='restrict')
+ partner_id = fields.Many2one(
+ 'res.partner', string='Donor', required=True, ondelete='restrict',
+ domain=[('parent_id', '=', False)])
+ company_id = fields.Many2one(
+ 'res.company', string='Company', required=True,
+ default=lambda self: self.env['res.company']._company_default_get(
+ 'donation.tax.receipt'))
+ print_date = fields.Date(string='Print Date')
+ type = fields.Selection([
+ ('each', 'One-Time Tax Receipt'),
+ ('annual', 'Annual Tax Receipt'),
+ ], string='Type', required=True)
+
+ # Maybe we can drop that code with the new seq management on v9
+ @api.model
+ def create(self, vals=None):
+ if vals is None:
+ vals = {}
+ date = vals.get('donation_date')
+ vals['number'] = self.env['ir.sequence'].with_context(
+ date=date).next_by_code('donation.tax.receipt')
+ return super(DonationTaxReceipt, self).create(vals)
diff --git a/donation_base/models/partner.py b/donation_base/models/partner.py
new file mode 100644
index 000000000..0be33cee0
--- /dev/null
+++ b/donation_base/models/partner.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api
+
+
+class ResPartner(models.Model):
+ _inherit = 'res.partner'
+
+ tax_receipt_option = fields.Selection([
+ ('none', 'None'),
+ ('each', 'For Each Donation'),
+ ('annual', 'Annual Tax Receipt'),
+ ], string='Tax Receipt Option', track_visibility='onchange')
+
+ @api.model
+ def _commercial_fields(self):
+ res = super(ResPartner, self)._commercial_fields()
+ res.append('tax_receipt_option')
+ return res
diff --git a/donation_base/models/product.py b/donation_base/models/product.py
new file mode 100644
index 000000000..5b228fb95
--- /dev/null
+++ b/donation_base/models/product.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api, _
+from openerp.exceptions import ValidationError
+
+
+class ProductTemplate(models.Model):
+ _inherit = 'product.template'
+
+ donation = fields.Boolean(
+ string='Is a Donation', track_visibility='onchange',
+ help="Specify if the product can be selected in a donation line.")
+ in_kind_donation = fields.Boolean(
+ string="In-Kind Donation", track_visibility='onchange')
+ tax_receipt_ok = fields.Boolean(
+ string='Is Eligible for a Tax Receipt', track_visibility='onchange',
+ help="Specify if the product is eligible for a tax receipt")
+
+ @api.onchange('donation')
+ def _donation_change(self):
+ if self.donation:
+ self.type = 'service'
+
+ @api.onchange('in_kind_donation')
+ def _in_kind_donation_change(self):
+ if self.in_kind_donation:
+ self.donation = True
+
+ @api.multi
+ @api.constrains('donation', 'type')
+ def donation_check(self):
+ for product in self:
+ if product.donation and product.type != 'service':
+ raise ValidationError(_(
+ "The product '%s' is a donation, so you must "
+ "configure it as a Service") % product.name)
+ if product.in_kind_donation and not product.donation:
+ raise ValidationError(_(
+ "The option 'In-Kind Donation' is active on "
+ "the product '%s', so you must also activate the "
+ "option 'Is a Donation'.") % product.name)
+ if product.tax_receipt_ok and not product.donation:
+ raise ValidationError(_(
+ "The option 'Is Eligible for a Tax Receipt' is "
+ "active on the product '%s', so you must also activate "
+ "the option 'Is a Donation'.") % product.name)
+
+
+class ProductProduct(models.Model):
+ _inherit = 'product.product'
+
+ @api.onchange('donation')
+ def _donation_change(self):
+ if self.donation:
+ self.type = 'service'
+
+ @api.onchange('in_kind_donation')
+ def _in_kind_donation_change(self):
+ if self.in_kind_donation:
+ self.donation = True
diff --git a/donation_tax_receipt/report.xml b/donation_base/report/report.xml
similarity index 100%
rename from donation_tax_receipt/report.xml
rename to donation_base/report/report.xml
diff --git a/donation_tax_receipt/report/report_donationtax.xml b/donation_base/report/report_donationtax.xml
similarity index 72%
rename from donation_tax_receipt/report/report_donationtax.xml
rename to donation_base/report/report_donationtax.xml
index 9d9276504..1026a60bf 100644
--- a/donation_tax_receipt/report/report_donationtax.xml
+++ b/donation_base/report/report_donationtax.xml
@@ -1,13 +1,11 @@
-
-
+
-
+
diff --git a/donation_base/security/ir.model.access.csv b/donation_base/security/ir.model.access.csv
new file mode 100644
index 000000000..b453effab
--- /dev/null
+++ b/donation_base/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_donation_tax_receipt_full,Full access on donation.tax.receipt to Config grp,model_donation_tax_receipt,base.group_system,1,1,1,1
diff --git a/donation_tax_receipt/security/tax_receipt_security.xml b/donation_base/security/tax_receipt_security.xml
similarity index 58%
rename from donation_tax_receipt/security/tax_receipt_security.xml
rename to donation_base/security/tax_receipt_security.xml
index a7e4b3b83..f96a11075 100644
--- a/donation_tax_receipt/security/tax_receipt_security.xml
+++ b/donation_base/security/tax_receipt_security.xml
@@ -1,16 +1,13 @@
-
-
+
-
Donation Tax Receipt Multi-company
@@ -18,4 +15,4 @@
-
+
diff --git a/donation_tax_receipt/donation_tax_view.xml b/donation_base/views/donation_tax_receipt.xml
similarity index 65%
rename from donation_tax_receipt/donation_tax_view.xml
rename to donation_base/views/donation_tax_receipt.xml
index 1d74a4583..b944be75e 100644
--- a/donation_tax_receipt/donation_tax_view.xml
+++ b/donation_base/views/donation_tax_receipt.xml
@@ -1,48 +1,13 @@
-
+
-
- donation.donation
-
-
-
-
-
-
-
-
-
-
-
- donation.line
-
-
-
-
-
-
-
-
-
- donation.line
-
-
-
-
-
-
-
-
-
donation.tax.receipt.form
@@ -60,9 +25,6 @@
-
-
-
@@ -131,20 +93,12 @@
-
Donation Tax Receipt
donation.tax.receipt
tree,form,graph,pivot
-
-
-
-
+
diff --git a/donation_tax_receipt/partner_view.xml b/donation_base/views/partner.xml
similarity index 100%
rename from donation_tax_receipt/partner_view.xml
rename to donation_base/views/partner.xml
diff --git a/donation/product_view.xml b/donation_base/views/product.xml
similarity index 50%
rename from donation/product_view.xml
rename to donation_base/views/product.xml
index ed83ee83d..88f6d625e 100644
--- a/donation/product_view.xml
+++ b/donation_base/views/product.xml
@@ -1,12 +1,11 @@
-
+
@@ -15,7 +14,10 @@
-
+
+
@@ -30,23 +32,21 @@
+
+
+
+
-
-
+
+
-
- Products
- product.template
- kanban,tree,form
- {'search_default_filter_donation': 1, 'default_donation': 1}
-
-
-
-
-
-
+
diff --git a/donation_tax_receipt/wizard/__init__.py b/donation_base/wizard/__init__.py
similarity index 100%
rename from donation_tax_receipt/wizard/__init__.py
rename to donation_base/wizard/__init__.py
diff --git a/donation_tax_receipt/wizard/tax_receipt_annual_create.py b/donation_base/wizard/tax_receipt_annual_create.py
similarity index 77%
rename from donation_tax_receipt/wizard/tax_receipt_annual_create.py
rename to donation_base/wizard/tax_receipt_annual_create.py
index 57b6bc734..d7ca0f743 100644
--- a/donation_tax_receipt/wizard/tax_receipt_annual_create.py
+++ b/donation_base/wizard/tax_receipt_annual_create.py
@@ -1,25 +1,7 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import UserError
@@ -43,6 +25,7 @@ def _default_start_date(self):
end_date = fields.Date(
'End Date', required=True, default=_default_end_date)
+ # TODO: adapt code to make it independant of the donation module
@api.model
def _prepare_annual_tax_receipt(self, partner_id, partner_dict):
vals = {
@@ -74,7 +57,7 @@ def generate_annual_receipts(self):
# 'amount': amount,
# 'donation_ids': [donation1_id, donation2_id]}}
for donation in donations:
- partner_id = donation.partner_id.id
+ partner_id = donation.commercial_partner_id.id
tax_receipt_amount = donation.tax_receipt_total
if partner_id not in tax_receipt_annual:
tax_receipt_annual[partner_id] = {
diff --git a/donation_tax_receipt/wizard/tax_receipt_annual_create_view.xml b/donation_base/wizard/tax_receipt_annual_create_view.xml
similarity index 67%
rename from donation_tax_receipt/wizard/tax_receipt_annual_create_view.xml
rename to donation_base/wizard/tax_receipt_annual_create_view.xml
index ad6343fa5..ce3806977 100644
--- a/donation_tax_receipt/wizard/tax_receipt_annual_create_view.xml
+++ b/donation_base/wizard/tax_receipt_annual_create_view.xml
@@ -1,16 +1,14 @@
-
-
+
+
tax_receipt_annual_create.form
tax.receipt.annual.create
@@ -36,10 +34,6 @@
new
-
-
-
+
diff --git a/donation_tax_receipt/wizard/tax_receipt_print.py b/donation_base/wizard/tax_receipt_print.py
similarity index 53%
rename from donation_tax_receipt/wizard/tax_receipt_print.py
rename to donation_base/wizard/tax_receipt_print.py
index efad94a87..317989d7b 100644
--- a/donation_tax_receipt/wizard/tax_receipt_print.py
+++ b/donation_base/wizard/tax_receipt_print.py
@@ -1,25 +1,7 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import UserError
diff --git a/donation_tax_receipt/wizard/tax_receipt_print_view.xml b/donation_base/wizard/tax_receipt_print_view.xml
similarity index 66%
rename from donation_tax_receipt/wizard/tax_receipt_print_view.xml
rename to donation_base/wizard/tax_receipt_print_view.xml
index 6f58f77e1..314d6cfa0 100644
--- a/donation_tax_receipt/wizard/tax_receipt_print_view.xml
+++ b/donation_base/wizard/tax_receipt_print_view.xml
@@ -1,16 +1,14 @@
-
-
+
+
donation_tax_receipt_print.form
donation.tax.receipt.print
@@ -35,9 +33,6 @@
new
-
-
+
diff --git a/donation_recurring/README.rst b/donation_recurring/README.rst
index 5f041299b..3e5840f35 100644
--- a/donation_recurring/README.rst
+++ b/donation_recurring/README.rst
@@ -1,3 +1,8 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+==================
Donation Recurring
==================
@@ -22,6 +27,10 @@ duplicate each recurring donation template to create a regular donation.
Then select all these new draft donations generated by the wizard and
validate them.
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/180/9.0
+
Credits
=======
@@ -35,12 +44,14 @@ Contributors
Maintainer
----------
-.. image:: http://odoo-community.org/logo.png
+.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
- :target: http://odoo-community.org
+ :target: https://odoo-community.org
This module is maintained by the OCA.
-OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
-To contribute to this module, please visit http://odoo-community.org.
+To contribute to this module, please visit https://odoo-community.org.
diff --git a/donation_recurring/__init__.py b/donation_recurring/__init__.py
index 6267aac8c..35e7c9600 100644
--- a/donation_recurring/__init__.py
+++ b/donation_recurring/__init__.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
-from . import donation
+from . import models
from . import wizard
diff --git a/donation_recurring/__openerp__.py b/donation_recurring/__openerp__.py
index 33c93fb79..ff3d3caf7 100644
--- a/donation_recurring/__openerp__.py
+++ b/donation_recurring/__openerp__.py
@@ -1,30 +1,11 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Recurring module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Donation Recurring',
- 'version': '9.0.0.1.0',
+ 'version': '9.0.1.0.0',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Manage recurring donations',
@@ -32,10 +13,9 @@
'website': 'http://www.barroux.org',
'depends': ['donation'],
'data': [
- 'donation_view.xml',
+ 'views/donation.xml',
'wizard/donation_recurring_generate_view.xml',
],
- 'demo': ['donation_recurring_demo.xml'],
- 'test': ['test/generate_recurring_donations.yml'],
+ 'demo': ['demo/donation_recurring_demo.xml'],
'installable': True,
}
diff --git a/donation_recurring/donation_recurring_demo.xml b/donation_recurring/demo/donation_recurring_demo.xml
similarity index 70%
rename from donation_recurring/donation_recurring_demo.xml
rename to donation_recurring/demo/donation_recurring_demo.xml
index 869c8f696..ebbc521e6 100644
--- a/donation_recurring/donation_recurring_demo.xml
+++ b/donation_recurring/demo/donation_recurring_demo.xml
@@ -1,6 +1,11 @@
+
-
+
@@ -11,6 +16,7 @@
Seythenex
emilie.legrand@laposte.example.com
+ annual
@@ -21,6 +27,7 @@
Paris
marie.durand@free.example.com
+ annual
@@ -31,22 +38,24 @@
Courbevoie
olivier.dumesnil@free.example.com
+ annual
-
+
-
+
diff --git a/donation_recurring/donation.py b/donation_recurring/donation.py
deleted file mode 100644
index 296edd514..000000000
--- a/donation_recurring/donation.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Recurring module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields, api, _
-from openerp.exceptions import UserError
-
-
-class DonationDonation(models.Model):
- _inherit = 'donation.donation'
-
- recurring_template = fields.Selection([
- ('active', 'Active'),
- ('suspended', 'Suspended'),
- ], string='Recurring Template', copy=False)
- source_recurring_id = fields.Many2one(
- 'donation.donation', string='Source Recurring Template',
- states={'done': [('readonly', True)]})
- recurring_donation_ids = fields.One2many(
- 'donation.donation', 'source_recurring_id',
- string='Past Recurring Donations', readonly=True, copy=False)
-
- @api.one
- @api.constrains('recurring_template', 'source_recurring_id', 'state')
- def _check_recurring_donation(self):
- if self.recurring_template and self.state != 'draft':
- raise UserError(
- _("The recurring donation template of '%s' must stay in "
- "draft state.") % self.partner_id.name)
- if self.source_recurring_id and self.recurring_template:
- raise UserError(
- _("The recurring donation template of '%s' cannot have "
- "a Source Recurring Template")
- % self.partner_id.name)
-
- @api.one
- @api.depends('state', 'partner_id', 'move_id', 'recurring_template')
- def _compute_display_name(self):
- if self.state == 'draft':
- if self.recurring_template == 'active':
- name = _('Recurring Donation of %s') % (
- self.partner_id.name)
- elif self.recurring_template == 'suspended':
- name = _('Suspended Recurring Donation of %s') % (
- self.partner_id.name)
- else:
- name = _('Draft Donation of %s') % self.partner_id.name
- elif self.state == 'cancel':
- name = _('Cancelled Donation of %s') % self.partner_id.name
- else:
- name = self.number
- self.display_name = name
diff --git a/donation_recurring_tax_receipt/__init__.py b/donation_recurring/models/__init__.py
similarity index 100%
rename from donation_recurring_tax_receipt/__init__.py
rename to donation_recurring/models/__init__.py
diff --git a/donation_recurring/models/donation.py b/donation_recurring/models/donation.py
new file mode 100644
index 000000000..3b5f71fb3
--- /dev/null
+++ b/donation_recurring/models/donation.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api, _
+from openerp.exceptions import ValidationError
+
+
+class DonationDonation(models.Model):
+ _inherit = 'donation.donation'
+
+ recurring_template = fields.Selection([
+ ('active', 'Active'),
+ ('suspended', 'Suspended'),
+ ], string='Recurring Template', copy=False)
+ source_recurring_id = fields.Many2one(
+ 'donation.donation', string='Source Recurring Template',
+ states={'done': [('readonly', True)]})
+ recurring_donation_ids = fields.One2many(
+ 'donation.donation', 'source_recurring_id',
+ string='Past Recurring Donations', readonly=True, copy=False)
+
+ @api.multi
+ @api.constrains(
+ 'recurring_template', 'source_recurring_id', 'state',
+ 'tax_receipt_option')
+ def _check_recurring_donation(self):
+ for donation in self:
+ if donation.recurring_template and donation.state != 'draft':
+ raise ValidationError(_(
+ "The recurring donation template of '%s' must stay in "
+ "draft state.") % donation.partner_id.name)
+ if donation.source_recurring_id and donation.recurring_template:
+ raise ValidationError(_(
+ "The recurring donation template of '%s' cannot have "
+ "a Source Recurring Template")
+ % donation.partner_id.name)
+ if (
+ donation.recurring_template and
+ donation.tax_receipt_option == 'each'):
+ raise ValidationError(_(
+ "The recurring donation of %s cannot have a tax "
+ "receipt option 'Each'.")
+ % donation.partner_id.name)
+
+ @api.multi
+ @api.depends('state', 'partner_id', 'move_id', 'recurring_template')
+ def _compute_display_name(self):
+ for donation in self:
+ if donation.state == 'draft':
+ if donation.recurring_template == 'active':
+ name = _('Recurring Donation of %s') % (
+ donation.partner_id.name)
+ elif donation.recurring_template == 'suspended':
+ name = _('Suspended Recurring Donation of %s') % (
+ donation.partner_id.name)
+ else:
+ name = _('Draft Donation of %s') % donation.partner_id.name
+ elif donation.state == 'cancel':
+ name = _('Cancelled Donation of %s') % donation.partner_id.name
+ else:
+ name = donation.number
+ donation.display_name = name
+
+ @api.onchange('recurring_template')
+ def recurring_template_change(self):
+ res = {'warning': {}}
+ if self.recurring_template and self.tax_receipt_option == 'each':
+ self.tax_receipt_option = 'annual'
+ res['warning']['title'] = _('Update of Tax Receipt Option')
+ res['warning']['message'] = _(
+ "As it is a recurring donation, "
+ "the Tax Receipt Option has been changed from Each to "
+ "Annual. You may want to change it also on the Donor "
+ "form.")
+ if not self.recurring_template and self.partner_id:
+ if self.partner_id.tax_receipt_option != self.tax_receipt_option:
+ self.tax_receipt_option = self.partner_id.tax_receipt_option
+ return res
diff --git a/donation_recurring/test/generate_recurring_donations.yml b/donation_recurring/test/generate_recurring_donations.yml
deleted file mode 100644
index ae2c4d8d7..000000000
--- a/donation_recurring/test/generate_recurring_donations.yml
+++ /dev/null
@@ -1,29 +0,0 @@
--
- Run the generate donation recurring wizard, validate donations and check results
--
- !python {model: donation.donation, id: donation_rec1}: |
- from openerp import fields
- today = fields.Date.context_today(self)
- wizard = self.env['donation.recurring.generate'].create({'payment_ref': 'Don Abbaye Sainte Madeleine'})
- wizard.generate()
- self += self.env.ref('donation_recurring.donation_rec2')
- for donation_rec in self:
-
- assert len(donation_rec.recurring_donation_ids) == 1, 'no recurring donations generated'
- assert donation_rec.recurring_donation_ids[0].state == 'draft', 'status of generated recurring donations should be draft'
- assert donation_rec.recurring_donation_ids[0].donation_date == today, 'wrong date on generated recurring donations'
- assert donation_rec.recurring_donation_ids[0].amount_total == donation_rec.amount_total, 'wrong amount on generated recurring donations'
- assert donation_rec.recurring_donation_ids[0].payment_ref == 'Don Abbaye Sainte Madeleine', 'wrong payment ref on generated recurring donations'
- assert donation_rec.recurring_donation_ids[0].campaign_id.id == donation_rec.campaign_id.id, 'wrong campaign_id on generated recurring donations'
- donation_rec3 = self.env.ref('donation_recurring.donation_rec3')
- assert not donation_rec3.recurring_donation_ids, 'Suspended recurring donation should not generate donations'
- ctx = context.copy()
- active_ids = [donation_rec.recurring_donation_ids[0].id for donation_rec in self]
- wizard_val = self.with_context(active_ids=active_ids, active_model='donation.donation').env['donation.validate'].create({})
- wizard_val.run()
- for donation_rec in self:
- assert donation_rec.recurring_donation_ids[0].state == 'done', 'state should now be done'
- assert donation_rec.recurring_donation_ids[0].move_id.journal_id.id == donation_rec.journal_id.id, 'wrong journal on move'
- assert donation_rec.recurring_donation_ids[0].move_id.state == 'posted', 'move not posted'
- assert donation_rec.recurring_donation_ids[0].move_id.ref == 'Don Abbaye Sainte Madeleine', 'wrong ref on move'
- assert donation_rec.recurring_donation_ids[0].move_id.date == today, 'wrong date on move'
diff --git a/donation_recurring/tests/__init__.py b/donation_recurring/tests/__init__.py
new file mode 100644
index 000000000..a587bb13c
--- /dev/null
+++ b/donation_recurring/tests/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import test_recurring_donations
diff --git a/donation_recurring/tests/test_recurring_donations.py b/donation_recurring/tests/test_recurring_donations.py
new file mode 100644
index 000000000..6e3f982ec
--- /dev/null
+++ b/donation_recurring/tests/test_recurring_donations.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# © 2016 Akretion (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from openerp.tests.common import TransactionCase
+
+
+class TestDonationRecurring(TransactionCase):
+
+ def test_donation_recurring(self):
+ wizard = self.env['donation.recurring.generate'].create(
+ {'payment_ref': 'Don Abbaye Sainte Madeleine'})
+ action = wizard.generate()
+ active_don_recs = [
+ self.env.ref('donation_recurring.donation_rec1'),
+ self.env.ref('donation_recurring.donation_rec2')]
+ for don_rec in active_don_recs:
+ self.assertTrue(don_rec.recurring_donation_ids)
+ don = don_rec.recurring_donation_ids[0]
+ self.assertEquals(don.state, 'draft')
+ self.assertEquals(don.amount_total, don_rec.amount_total)
+ self.assertEquals(
+ don.payment_ref,
+ 'Don Abbaye Sainte Madeleine')
+ self.assertEquals(don.campaign_id, don_rec.campaign_id)
+ don_rec3 = self.env.ref('donation_recurring.donation_rec3')
+ self.assertFalse(don_rec3.recurring_donation_ids)
+ active_ids = action['domain'][0][2]
+ wizard_val = self.env['donation.validate'].with_context(
+ active_ids=active_ids, active_model='donation.donation').\
+ create({})
+ wizard_val.run()
+ for don_rec in active_don_recs:
+ don = don_rec.recurring_donation_ids[0]
+ self.assertEquals(don.state, 'done')
+ self.assertEquals(don.move_id.journal_id, don_rec.journal_id)
+ self.assertEquals(don.move_id.state, 'posted')
+ self.assertEquals(don.move_id.ref, 'Don Abbaye Sainte Madeleine')
diff --git a/donation_recurring/donation_view.xml b/donation_recurring/views/donation.xml
similarity index 93%
rename from donation_recurring/donation_view.xml
rename to donation_recurring/views/donation.xml
index e63581a19..0f536f951 100644
--- a/donation_recurring/donation_view.xml
+++ b/donation_recurring/views/donation.xml
@@ -1,8 +1,14 @@
+
-
+
+
donation.recurring.form
donation.donation
@@ -73,5 +79,6 @@
+
-
+
diff --git a/donation_recurring/wizard/donation_recurring_generate.py b/donation_recurring/wizard/donation_recurring_generate.py
index 015a6c1b2..35cf5660c 100644
--- a/donation_recurring/wizard/donation_recurring_generate.py
+++ b/donation_recurring/wizard/donation_recurring_generate.py
@@ -1,26 +1,7 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Recurring module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-# @author: Brother Bernard
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# © 2014-2016 Barroux Abbey (http://www.barroux.org)
+# © 2014-2016 Akretion France (Alexis de Lattre )
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import UserError
diff --git a/donation_recurring/wizard/donation_recurring_generate_view.xml b/donation_recurring/wizard/donation_recurring_generate_view.xml
index d8f26c5e0..258b2b4a8 100644
--- a/donation_recurring/wizard/donation_recurring_generate_view.xml
+++ b/donation_recurring/wizard/donation_recurring_generate_view.xml
@@ -1,14 +1,11 @@
-
-
+
@@ -42,4 +39,4 @@
-
+
diff --git a/donation_recurring_tax_receipt/README.rst b/donation_recurring_tax_receipt/README.rst
deleted file mode 100644
index bd69201fb..000000000
--- a/donation_recurring_tax_receipt/README.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-Donation Recurring Tax Receipt
-==============================
-
-This module adds a constraints (and an on_change) to oblige to have annual fiscal receipts for recurring donations.
-
-Credits
-=======
-
-Contributors
-------------
-
-* Brother Bernard
-* Brother Irénée (Barroux Abbey)
-* Alexis de Lattre
-
-Maintainer
-----------
-
-.. image:: http://odoo-community.org/logo.png
- :alt: Odoo Community Association
- :target: http://odoo-community.org
-
-This module is maintained by the OCA.
-
-OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
-
-To contribute to this module, please visit http://odoo-community.org.
diff --git a/donation_recurring_tax_receipt/__openerp__.py b/donation_recurring_tax_receipt/__openerp__.py
deleted file mode 100644
index ccc255073..000000000
--- a/donation_recurring_tax_receipt/__openerp__.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Recurring Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-
-{
- 'name': 'Donation Recurring Tax Receipt',
- 'version': '9.0.0.1.0',
- 'category': 'Accounting & Finance',
- 'license': 'AGPL-3',
- 'summary': 'Manage recurring donations with tax receipts',
- 'author': 'Barroux Abbey, Akretion, Odoo Community Association (OCA)',
- 'website': 'http://www.barroux.org',
- 'depends': ['donation_recurring', 'donation_tax_receipt'],
- 'demo': ['donation_demo.xml'],
- 'auto_install': True,
- 'installable': True,
-}
diff --git a/donation_recurring_tax_receipt/donation.py b/donation_recurring_tax_receipt/donation.py
deleted file mode 100644
index 555a8499e..000000000
--- a/donation_recurring_tax_receipt/donation.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Recurring Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, api, _
-from openerp.exceptions import UserError
-
-
-class DonationDonation(models.Model):
- _inherit = 'donation.donation'
-
- @api.one
- @api.constrains('recurring_template', 'tax_receipt_option')
- def _check_recurring_tax_receipt(self):
- if self.recurring_template and self.tax_receipt_option == 'each':
- raise UserError(
- _("The recurring donation of %s cannot have a tax "
- "receipt option 'Each'.")
- % self.partner_id.name)
-
- @api.onchange('recurring_template')
- def recurring_template_change(self):
- res = {'warning': {}}
- if self.recurring_template and self.tax_receipt_option == 'each':
- self.tax_receipt_option = 'annual'
- res['warning']['title'] = _('Update of Tax Receipt Option')
- res['warning']['message'] = _(
- "As it is a recurring donation, "
- "the Tax Receipt Option has been changed from Each to "
- "Annual. You may want to change it also on the Donor "
- "form.")
- if not self.recurring_template and self.partner_id:
- if self.partner_id.tax_receipt_option != self.tax_receipt_option:
- self.tax_receipt_option = self.partner_id.tax_receipt_option
- return res
diff --git a/donation_recurring_tax_receipt/donation_demo.xml b/donation_recurring_tax_receipt/donation_demo.xml
deleted file mode 100644
index 2462d80e2..000000000
--- a/donation_recurring_tax_receipt/donation_demo.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
- annual
-
-
-
- annual
-
-
-
- annual
-
-
-
- annual
-
-
-
- annual
-
-
-
- annual
-
-
-
- 1
-
-
-
- 1
-
-
-
- 1
-
-
-
-
-
diff --git a/donation_recurring_tax_receipt/i18n/donation_recurring_tax_receipt.pot b/donation_recurring_tax_receipt/i18n/donation_recurring_tax_receipt.pot
deleted file mode 100644
index 9edf6a533..000000000
--- a/donation_recurring_tax_receipt/i18n/donation_recurring_tax_receipt.pot
+++ /dev/null
@@ -1,40 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-# * donation_recurring_tax_receipt
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-02-17 22:38+0000\n"
-"PO-Revision-Date: 2015-02-17 22:38+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:45
-#, python-format
-msgid "As it is a recurring donation, the Tax Receipt Option has been changed from Each to Annual. You may want to change it also on the Donor form."
-msgstr ""
-
-#. module: donation_recurring_tax_receipt
-#: model:ir.model,name:donation_recurring_tax_receipt.model_donation_donation
-msgid "Donations"
-msgstr ""
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:35
-#, python-format
-msgid "The recurring donation of %s cannot have a tax receipt option 'Each'."
-msgstr ""
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:44
-#, python-format
-msgid "Update of Tax Receipt Option"
-msgstr ""
-
diff --git a/donation_recurring_tax_receipt/i18n/fr.po b/donation_recurring_tax_receipt/i18n/fr.po
deleted file mode 100644
index 53688b819..000000000
--- a/donation_recurring_tax_receipt/i18n/fr.po
+++ /dev/null
@@ -1,40 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-# * donation_recurring_tax_receipt
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-02-17 22:44+0000\n"
-"PO-Revision-Date: 2015-02-17 22:44+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:45
-#, python-format
-msgid "As it is a recurring donation, the Tax Receipt Option has been changed from Each to Annual. You may want to change it also on the Donor form."
-msgstr "As it is a recurring donation, the Tax Receipt Option has been changed from Each to Annual. You may want to change it also on the Donor form."
-
-#. module: donation_recurring_tax_receipt
-#: model:ir.model,name:donation_recurring_tax_receipt.model_donation_donation
-msgid "Donations"
-msgstr "Dons"
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:35
-#, python-format
-msgid "The recurring donation of %s cannot have a tax receipt option 'Each'."
-msgstr "The recurring donation of %s cannot have a tax receipt option 'Each'."
-
-#. module: donation_recurring_tax_receipt
-#: code:addons/donation_recurring_tax_receipt/donation.py:44
-#, python-format
-msgid "Update of Tax Receipt Option"
-msgstr "Update of Tax Receipt Option"
-
diff --git a/donation_tax_receipt/README.rst b/donation_tax_receipt/README.rst
deleted file mode 100644
index 8a7fb2ba3..000000000
--- a/donation_tax_receipt/README.rst
+++ /dev/null
@@ -1,49 +0,0 @@
-Donation
-========
-
-This module handles tax receipt for donations. It is used in France by the Barroux Abbey, but it doesn't have any France-specific behavior.
-
-Installation
-============
-
-This module depend on the module *account_auto_fy_sequence* which can be found in the OCA project *account-financial-tools* https://github.com/OCA/account-financial-tools/.
-
-Configuration
-=============
-
-To configure this module, you need to:
-
- * on the donation products, you may activate the option *Is Eligible for a Tax Receipt*
- * on each donor (i.e. partner), select the *Tax Receipt Option* : *None*, *For Each Donation* or *Annual*.
-
-Usage
-=====
-
-When you create a new donation, the *Tax Receipt Option* of the donor is copied on the donation.
-
-When you validate a donation with a *Tax Receipt Option* set to *For Each Donation* that has one or several donation lines eligible for a tax receipt, it will create a new Tax Receipt linked to this donation.
-
-At the beginning of each new year, start the wizard *Create Annual Receipts* : it will create all the annual tax receipts. An annual tax receipt is linked to one or several donations.
-
-Credits
-=======
-
-Contributors
-------------
-
-* Brother Bernard
-* Brother Irénée (Barroux Abbey)
-* Alexis de Lattre
-
-Maintainer
-----------
-
-.. image:: http://odoo-community.org/logo.png
- :alt: Odoo Community Association
- :target: http://odoo-community.org
-
-This module is maintained by the OCA.
-
-OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
-
-To contribute to this module, please visit http://odoo-community.org.
diff --git a/donation_tax_receipt/__openerp__.py b/donation_tax_receipt/__openerp__.py
deleted file mode 100644
index 95d7b2b8a..000000000
--- a/donation_tax_receipt/__openerp__.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-
-{
- 'name': 'Donation Tax Receipt',
- 'version': '9.0.0.2.0',
- 'category': 'Accounting & Finance',
- 'license': 'AGPL-3',
- 'summary': 'Manage tax receipts for donations',
- 'author': 'Barroux Abbey, Akretion, Odoo Community Association (OCA)',
- 'website': 'http://www.barroux.org',
- 'depends': ['donation'], # 'account_auto_fy_sequence'],
- 'data': [
- 'donation_tax_view.xml',
- 'donation_tax_data.xml',
- 'partner_view.xml',
- 'product_view.xml',
- 'security/ir.model.access.csv',
- 'wizard/tax_receipt_print_view.xml',
- 'wizard/tax_receipt_annual_create_view.xml',
- 'report.xml',
- 'report/report_donationtax.xml',
- 'report/donation_report_view.xml',
- 'security/tax_receipt_security.xml',
- ],
- 'demo': ['donation_tax_demo.xml'],
- 'test': [
- 'test/each_tax_receipt.yml',
- 'test/annual_tax_receipt.yml',
- ],
- 'installable': True,
-}
diff --git a/donation_tax_receipt/donation_tax.py b/donation_tax_receipt/donation_tax.py
deleted file mode 100644
index a222d619a..000000000
--- a/donation_tax_receipt/donation_tax.py
+++ /dev/null
@@ -1,175 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields, api, _
-from openerp.exceptions import UserError
-import openerp.addons.decimal_precision as dp
-
-
-class DonationDonation(models.Model):
- _inherit = "donation.donation"
-
- @api.one
- @api.depends(
- 'line_ids', 'line_ids.quantity', 'line_ids.unit_price',
- 'line_ids.product_id')
- def _tax_receipt_total(self):
- total = 0.0
- # Do not consider other currencies for tax receipts
- # because, for the moment, only very very few countries
- # accept tax receipts from other countries, and never in another
- # currency. If you know such cases, please tell us and we will
- # update the code of this module
- if self.currency_id == self.company_id.currency_id:
- for line in self.line_ids:
- # Filter the lines eligible for a tax receipt.
- if line.tax_receipt_ok:
- total += line.quantity * line.unit_price
- self.tax_receipt_total = total
-
- tax_receipt_id = fields.Many2one(
- 'donation.tax.receipt', string='Tax Receipt', readonly=True,
- copy=False)
- tax_receipt_option = fields.Selection([
- ('none', 'None'),
- ('each', 'For Each Donation'),
- ('annual', 'Annual Tax Receipt'),
- ], string='Tax Receipt Option', states={'done': [('readonly', True)]})
- tax_receipt_total = fields.Monetary(
- compute='_tax_receipt_total', string='Eligible Tax Receipt Sub-total',
- store=True, currency_field='currency_id')
-
- @api.model
- def _prepare_tax_receipt(self):
- vals = {
- 'company_id': self.company_id.id,
- 'currency_id': self.currency_id.id,
- 'donation_date': self.donation_date,
- 'amount': self.tax_receipt_total,
- 'type': 'each',
- 'partner_id': self.partner_id.id,
- }
- return vals
-
- @api.one
- def validate(self):
- res = super(DonationDonation, self).validate()
- if (
- self.tax_receipt_option == 'each' and
- self.tax_receipt_total and
- not self.tax_receipt_id):
- receipt_vals = self._prepare_tax_receipt()
- receipt = self.env['donation.tax.receipt'].create(receipt_vals)
- self.tax_receipt_id = receipt.id
- return res
-
- @api.one
- def done2cancel(self):
- if self.tax_receipt_id:
- raise UserError(
- _("You cannot cancel this donation because "
- "it is linked to the tax receipt %s. You should first "
- "delete this tax receipt (but it may not be legally "
- "allowed).")
- % self.tax_receipt_id.number)
- return super(DonationDonation, self).done2cancel()
-
- @api.onchange('partner_id')
- def partner_id_change(self):
- super(DonationDonation, self).partner_id_change()
- self.tax_receipt_option =\
- self.partner_id and self.partner_id.tax_receipt_option or False
-
- @api.onchange('tax_receipt_option')
- def tax_receipt_option_change(self):
- res = {}
- if (
- self.partner_id and
- self.partner_id.tax_receipt_option == 'annual' and
- self.tax_receipt_option != 'annual'):
- res = {
- 'warning': {
- 'title': _('Error:'),
- 'message':
- _('You cannot change the Tax Receipt '
- 'Option when it is Annual.'),
- },
- }
- self.tax_receipt_option = 'annual'
- return res
-
-
-class DonationLine(models.Model):
- _inherit = 'donation.line'
-
- tax_receipt_ok = fields.Boolean(string='Eligible for a Tax Receipt')
-
- @api.onchange('product_id')
- def product_id_change(self):
- super(DonationLine, self).product_id_change()
- self.tax_receipt_ok =\
- self.product_id and self.product_id.tax_receipt_ok or False
-
-
-class DonationTaxReceipt(models.Model):
- _name = 'donation.tax.receipt'
- _description = "Tax Receipt for Donations"
- _order = 'id desc'
- _rec_name = 'number'
-
- number = fields.Char(string='Receipt Number')
- date = fields.Date(
- string='Date', required=True, default=fields.Date.context_today)
- donation_date = fields.Date(string='Donation Date', required=True)
- amount = fields.Monetary(
- string='Amount', digits=dp.get_precision('Account'),
- currency_field='currency_id')
- currency_id = fields.Many2one(
- 'res.currency', string='Currency', required=True, ondelete='restrict')
- partner_id = fields.Many2one(
- 'res.partner', string='Donor', required=True, ondelete='restrict')
- company_id = fields.Many2one(
- 'res.company', string='Company', required=True,
- default=lambda self: self.env['res.company']._company_default_get(
- 'donation.tax.receipt'))
- print_date = fields.Date(string='Print Date')
- donation_ids = fields.One2many(
- 'donation.donation', 'tax_receipt_id', string='Related Donations')
- type = fields.Selection([
- ('each', 'One-Time Tax Receipt'),
- ('annual', 'Annual Tax Receipt'),
- ], string='Type', required=True)
-
- @api.model
- @api.returns('self', lambda value: value.id)
- def create(self, vals=None):
- if vals is None:
- vals = {}
- date = vals.get('donation_date')
- # fiscalyear_id = self.env['account.fiscalyear'].find(
- # dt=date, exception=True)
- # If date is False, it uses today, which is our default value
- # I use account_auto_fy_sequence here:
- vals['number'] = self.env['ir.sequence'].with_context(
- date=date).next_by_code('donation.tax.receipt')
- # fiscalyear_id=fiscalyear_id).next_by_code('donation.tax.receipt')
- return super(DonationTaxReceipt, self).create(vals)
diff --git a/donation_tax_receipt/donation_tax_demo.xml b/donation_tax_receipt/donation_tax_demo.xml
deleted file mode 100644
index a9021ad1c..000000000
--- a/donation_tax_receipt/donation_tax_demo.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
- 1
-
-
-
- Donation - no tax receipt
- DON-NOTAXR
-
-
- 1
- 0
- service
-
-
- This donation item is not eligible for a tax receipt.
-
-
-
- each
-
-
-
- annual
-
-
-
-
-
-
diff --git a/donation_tax_receipt/i18n/donation_tax_receipt.pot b/donation_tax_receipt/i18n/donation_tax_receipt.pot
deleted file mode 100644
index 39f363648..000000000
--- a/donation_tax_receipt/i18n/donation_tax_receipt.pot
+++ /dev/null
@@ -1,349 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-# * donation_tax_receipt
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-05-29 23:25+0000\n"
-"PO-Revision-Date: 2015-05-29 23:25+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,amount:0
-msgid "Amount"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Amount Total:"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:donation.tax.receipt,type:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "Annual Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Annual Tax Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Cancel"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,company_id:0
-msgid "Company"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.actions.act_window,name:donation_tax_receipt.tax_receipt_annual_create_action
-#: model:ir.ui.menu,name:donation_tax_receipt.tax_receipt_annual_create_menu
-msgid "Create Annual Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,create_uid:0
-#: field:donation.tax.receipt.print,create_uid:0
-#: field:tax.receipt.annual.create,create_uid:0
-msgid "Created by"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,create_date:0
-#: field:donation.tax.receipt.print,create_date:0
-#: field:tax.receipt.annual.create,create_date:0
-msgid "Created on"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,currency_id:0
-msgid "Currency"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,date:0
-msgid "Date"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Date:"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_donation
-msgid "Donation"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:product.template,name:donation_tax_receipt.product_product_donation_notaxreceipt_product_template
-msgid "Donation - no tax receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: field:donation.tax.receipt,donation_date:0
-msgid "Donation Date"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_line
-msgid "Donation Lines"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_form
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_tree
-#: model:ir.actions.act_window,name:donation_tax_receipt.donation_tax_receipt_action
-#: model:ir.actions.report.xml,name:donation_tax_receipt.report_donation_tax_receipt
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_receipt_menu
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Donation Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_graph
-msgid "Donation Taxes Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_report
-msgid "Donations Analysis"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,partner_id:0
-msgid "Donor"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Donor:"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_total:0
-msgid "Eligible Tax Receipt Sub-total"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.line,tax_receipt_ok:0
-#: view:donation.report:donation_tax_receipt.donation_report_search
-#: field:donation.report,tax_receipt_ok:0
-#: view:product.template:donation_tax_receipt.product_template_search_view
-msgid "Eligible for a Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:tax.receipt.annual.create,end_date:0
-msgid "End Date"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:111
-#, python-format
-msgid "Error:"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "For Each Donation"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Generate"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_tax_receipt_annual_create
-msgid "Generate Annual Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Generate Annual Tax Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Group By"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,id:0
-#: field:donation.tax.receipt.print,id:0
-#: field:tax.receipt.annual.create,id:0
-msgid "ID"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:product.template,tax_receipt_ok:0
-msgid "Is Eligible for a Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,write_uid:0
-#: field:donation.tax.receipt.print,write_uid:0
-#: field:tax.receipt.annual.create,write_uid:0
-msgid "Last Updated by"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,write_date:0
-#: field:donation.tax.receipt.print,write_date:0
-#: field:tax.receipt.annual.create,write_date:0
-msgid "Last Updated on"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "None"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: selection:donation.tax.receipt,type:0
-msgid "One-Time Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "One-Time Tax Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: model:ir.model,name:donation_tax_receipt.model_res_partner
-msgid "Partner"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,print_date:0
-msgid "Print Date"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_tax_receipt_print
-msgid "Print Donation Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-#: model:ir.actions.act_window,name:donation_tax_receipt.donation_tax_receipt_print_action
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_receipt_print_menu
-msgid "Print Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-msgid "Print Tax Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_product_template
-msgid "Product Template"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,number:0
-msgid "Receipt Number"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt.print,receipt_ids:0
-msgid "Receipts To Print"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_form
-#: field:donation.tax.receipt,donation_ids:0
-msgid "Related Donations"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Search Donation Taxes Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: help:product.template,tax_receipt_ok:0
-msgid "Specify if the product is eligible for a tax receipt in a donation line."
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:tax.receipt.annual.create,start_date:0
-msgid "Start Date"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_id:0
-#: view:donation.line:donation_tax_receipt.donation_line_tree
-msgid "Tax Receipt"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_option:0
-#: field:res.partner,tax_receipt_option:0
-msgid "Tax Receipt Option"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_tax_receipt
-msgid "Tax Receipt for Donations"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_title_menu
-msgid "Tax Receipts"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/wizard/tax_receipt_annual_create.py:105
-#, python-format
-msgid "The Donor '%s' already has a tax receipt in this timeframe: %s dated %s."
-msgstr ""
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/wizard/tax_receipt_print.py:47
-#, python-format
-msgid "There are no tax receipts to print."
-msgstr ""
-
-#. module: donation_tax_receipt
-#: model:product.template,description:donation_tax_receipt.product_product_donation_notaxreceipt_product_template
-msgid "This donation item is not eligible for a tax receipt."
-msgstr ""
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: field:donation.tax.receipt,type:0
-msgid "Type"
-msgstr ""
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:89
-#, python-format
-msgid "You cannot cancel this donation because it is linked to the tax receipt %s. You should first delete this tax receipt (but it may not be legally allowed)."
-msgstr ""
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:113
-#, python-format
-msgid "You cannot change the Tax Receipt Option when it is Annual."
-msgstr ""
-
diff --git a/donation_tax_receipt/i18n/fr.po b/donation_tax_receipt/i18n/fr.po
deleted file mode 100644
index 7a6b3a117..000000000
--- a/donation_tax_receipt/i18n/fr.po
+++ /dev/null
@@ -1,342 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-# * donation_tax_receipt
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-02-17 22:45+0000\n"
-"PO-Revision-Date: 2015-02-17 22:45+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,amount:0
-msgid "Amount"
-msgstr "Montant"
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Amount Total:"
-msgstr "Montant total :"
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:donation.tax.receipt,type:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "Annual Tax Receipt"
-msgstr "Reçu fiscal annuel"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Annual Tax Receipts"
-msgstr "Annual Tax Receipts"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Cancel"
-msgstr "Quitter"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,company_id:0
-msgid "Company"
-msgstr "Société"
-
-#. module: donation_tax_receipt
-#: model:ir.actions.act_window,name:donation_tax_receipt.tax_receipt_annual_create_action
-#: model:ir.ui.menu,name:donation_tax_receipt.tax_receipt_annual_create_menu
-msgid "Create Annual Receipts"
-msgstr "Créer des reçus annuels"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,create_uid:0
-#: field:donation.tax.receipt.print,create_uid:0
-#: field:tax.receipt.annual.create,create_uid:0
-msgid "Created by"
-msgstr "Created by"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,create_date:0
-#: field:donation.tax.receipt.print,create_date:0
-#: field:tax.receipt.annual.create,create_date:0
-msgid "Created on"
-msgstr "Created on"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,currency_id:0
-msgid "Currency"
-msgstr "Devise"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,date:0
-msgid "Date"
-msgstr "Date"
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Date:"
-msgstr "Date :"
-
-#. module: donation_tax_receipt
-#: model:product.template,name:donation_tax_receipt.product_product_donation_notaxreceipt_product_template
-msgid "Donation - no tax receipt"
-msgstr "Donation - no tax receipt"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: field:donation.tax.receipt,donation_date:0
-msgid "Donation Date"
-msgstr "Date du don"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_line
-msgid "Donation Lines"
-msgstr "Lignes de don"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_form
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_tree
-#: model:ir.actions.act_window,name:donation_tax_receipt.donation_tax_receipt_action
-#: model:ir.actions.report.xml,name:donation_tax_receipt.report_donation_tax_receipt
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_receipt_menu
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Donation Tax Receipt"
-msgstr "Reçu fiscal pour don"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_graph
-msgid "Donation Taxes Receipts"
-msgstr "Reçus fiscaux pour dons"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_donation
-msgid "Donations"
-msgstr "Dons"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,partner_id:0
-msgid "Donor"
-msgstr "Donateur"
-
-#. module: donation_tax_receipt
-#: view:website:donation_tax_receipt.report_donationtaxreceipt
-msgid "Donor:"
-msgstr "Donor:"
-
-#. module: donation_tax_receipt
-#: field:donation.line,tax_receipt_ok:0
-#: view:product.template:donation_tax_receipt.product_template_search_view
-msgid "Eligible for a Tax Receipt"
-msgstr "Eligible au reçu fiscal"
-
-#. module: donation_tax_receipt
-#: field:tax.receipt.annual.create,end_date:0
-msgid "End Date"
-msgstr "Date de fin"
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:109
-#, python-format
-msgid "Error:"
-msgstr "Error:"
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "For Each Donation"
-msgstr "Pour chaque don"
-
-#. module: donation_tax_receipt
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Generate"
-msgstr "Générer"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_tax_receipt_annual_create
-msgid "Generate Annual Tax Receipt"
-msgstr "Générer reçu fiscal annuel"
-
-#. module: donation_tax_receipt
-#: view:tax.receipt.annual.create:donation_tax_receipt.tax_receipt_annual_create_form
-msgid "Generate Annual Tax Receipts"
-msgstr "Générer reçus fiscaux annuel"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Group By"
-msgstr "Grouper par"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,id:0
-#: field:donation.tax.receipt.print,id:0
-#: field:tax.receipt.annual.create,id:0
-msgid "ID"
-msgstr "ID"
-
-#. module: donation_tax_receipt
-#: field:product.template,tax_receipt_ok:0
-msgid "Is Eligible for a Tax Receipt"
-msgstr "Eligible au reçu fiscal"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,write_uid:0
-#: field:donation.tax.receipt.print,write_uid:0
-#: field:tax.receipt.annual.create,write_uid:0
-msgid "Last Updated by"
-msgstr "Last Updated by"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,write_date:0
-#: field:donation.tax.receipt.print,write_date:0
-#: field:tax.receipt.annual.create,write_date:0
-msgid "Last Updated on"
-msgstr "Last Updated on"
-
-#. module: donation_tax_receipt
-#: selection:donation.donation,tax_receipt_option:0
-#: selection:res.partner,tax_receipt_option:0
-msgid "None"
-msgstr "Aucun"
-
-#. module: donation_tax_receipt
-#: selection:donation.tax.receipt,type:0
-msgid "One-Time Tax Receipt"
-msgstr "One-Time Tax Receipt"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "One-Time Tax Receipts"
-msgstr "One-Time Tax Receipts"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: model:ir.model,name:donation_tax_receipt.model_res_partner
-msgid "Partner"
-msgstr "Partenaire"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,print_date:0
-msgid "Print Date"
-msgstr "Date d'impression"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_tax_receipt_print
-msgid "Print Donation Tax Receipt"
-msgstr "Imprimer reçu fiscal du don"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-#: model:ir.actions.act_window,name:donation_tax_receipt.donation_tax_receipt_print_action
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_receipt_print_menu
-msgid "Print Receipts"
-msgstr "Imprimer reçus"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt.print:donation_tax_receipt.donation_tax_receipt_print_form
-msgid "Print Tax Receipts"
-msgstr "Imprimer reçus fiscaux"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_product_template
-msgid "Product Template"
-msgstr "Product Template"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt,number:0
-msgid "Receipt Number"
-msgstr "Numéro de reçu"
-
-#. module: donation_tax_receipt
-#: field:donation.tax.receipt.print,receipt_ids:0
-msgid "Receipts To Print"
-msgstr "Reçus à imprimer"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_form
-#: field:donation.tax.receipt,donation_ids:0
-msgid "Related Donations"
-msgstr "Dons liés"
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-msgid "Search Donation Taxes Receipts"
-msgstr "Recherche des reçus fiscaux"
-
-#. module: donation_tax_receipt
-#: help:product.template,tax_receipt_ok:0
-msgid "Specify if the product is eligible for a tax receipt in a donation line."
-msgstr "Specify if the product is eligible for a tax receipt in a donation line."
-
-#. module: donation_tax_receipt
-#: field:tax.receipt.annual.create,start_date:0
-msgid "Start Date"
-msgstr "Date de départ"
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_id:0
-#: view:donation.line:donation_tax_receipt.donation_line_tree
-msgid "Tax Receipt"
-msgstr "Reçu fiscal"
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_option:0
-#: field:res.partner,tax_receipt_option:0
-msgid "Tax Receipt Option"
-msgstr "Option reçu fiscal"
-
-#. module: donation_tax_receipt
-#: field:donation.donation,tax_receipt_total:0
-msgid "Eligible Tax Receipt Sub-total"
-msgstr "Sous-total éligible au reçu fiscal"
-
-#. module: donation_tax_receipt
-#: model:ir.model,name:donation_tax_receipt.model_donation_tax_receipt
-msgid "Tax Receipt for Donations"
-msgstr "Reçu fiscal pour les dons"
-
-#. module: donation_tax_receipt
-#: model:ir.ui.menu,name:donation_tax_receipt.donation_tax_title_menu
-msgid "Tax Receipts"
-msgstr "Tax Receipts"
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/wizard/tax_receipt_annual_create.py:105
-#, python-format
-msgid "The Donor '%s' already has a tax receipt in this timeframe: %s dated %s."
-msgstr "The Donor '%s' already has a tax receipt in this timeframe: %s dated %s."
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/wizard/tax_receipt_print.py:47
-#, python-format
-msgid "There are no tax receipts to print."
-msgstr "There are no tax receipts to print."
-
-#. module: donation_tax_receipt
-#: model:product.template,description:donation_tax_receipt.product_product_donation_notaxreceipt_product_template
-msgid "This donation item is not eligible for a tax receipt."
-msgstr "This donation item is not eligible for a tax receipt."
-
-#. module: donation_tax_receipt
-#: view:donation.tax.receipt:donation_tax_receipt.donation_tax_receipt_search
-#: field:donation.tax.receipt,type:0
-msgid "Type"
-msgstr "Type"
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:111
-#, python-format
-msgid "You cannot change the Tax Receipt Option when it is Annual."
-msgstr "You cannot change the Tax Receipt Option when it is Annual."
-
-#. module: donation_tax_receipt
-#: code:addons/donation_tax_receipt/donation_tax.py:88
-#, python-format
-msgid "You cannot set this donation back to draft because it is linked to the tax receipt %s. You should first delete this tax receipt."
-msgstr "You cannot set this donation back to draft because it is linked to the tax receipt %s. You should first delete this tax receipt."
-
diff --git a/donation_tax_receipt/partner.py b/donation_tax_receipt/partner.py
deleted file mode 100644
index bea5d346b..000000000
--- a/donation_tax_receipt/partner.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-# @author: Brother Bernard
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields, api
-
-
-class ResPartner(models.Model):
- _inherit = 'res.partner'
-
- tax_receipt_option = fields.Selection([
- ('none', 'None'),
- ('each', 'For Each Donation'),
- ('annual', 'Annual Tax Receipt'),
- ], string='Tax Receipt Option')
-
- @api.model
- def _commercial_fields(self):
- res = super(ResPartner, self)._commercial_fields()
- res.append('tax_receipt_option')
- return res
diff --git a/donation_tax_receipt/product.py b/donation_tax_receipt/product.py
deleted file mode 100644
index 175efab09..000000000
--- a/donation_tax_receipt/product.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields
-
-
-class ProductTemplate(models.Model):
- _inherit = 'product.template'
-
- tax_receipt_ok = fields.Boolean(
- string='Is Eligible for a Tax Receipt',
- help="Specify if the product is eligible for a tax receipt "
- "in a donation line.")
diff --git a/donation_tax_receipt/product_view.xml b/donation_tax_receipt/product_view.xml
deleted file mode 100644
index 3d3715c66..000000000
--- a/donation_tax_receipt/product_view.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
- donation.tax.receipt.product.template.form
- product.template
-
-
-
-
-
-
-
- donation.tax.receipt.product.template.search
- product.template
-
-
-
-
-
-
-
-
-
-
diff --git a/donation_tax_receipt/report/__init__.py b/donation_tax_receipt/report/__init__.py
deleted file mode 100644
index 1676a640f..000000000
--- a/donation_tax_receipt/report/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from . import donation_report
diff --git a/donation_tax_receipt/report/donation_report.py b/donation_tax_receipt/report/donation_report.py
deleted file mode 100644
index df9e16374..000000000
--- a/donation_tax_receipt/report/donation_report.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Donation Tax Receipt module for Odoo
-# Copyright (C) 2014-2015 Barroux Abbey (www.barroux.org)
-# Copyright (C) 2014-2015 Akretion France (www.akretion.com)
-# @author: Alexis de Lattre
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp import models, fields
-
-
-class DonationReport(models.Model):
- _inherit = "donation.report"
-
- tax_receipt_ok = fields.Boolean(string='Eligible for a Tax Receipt')
-
- def _select(self):
- select = super(DonationReport, self)._select()
- select += ", l.tax_receipt_ok AS tax_receipt_ok"
- return select
-
- def _group_by(self):
- group_by = super(DonationReport, self)._group_by()
- group_by += ", l.tax_receipt_ok"
- return group_by
diff --git a/donation_tax_receipt/report/donation_report_view.xml b/donation_tax_receipt/report/donation_report_view.xml
deleted file mode 100644
index 88923be05..000000000
--- a/donation_tax_receipt/report/donation_report_view.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
- tax.receipt.donation.report.search
- donation.report
-
-
-
-
-
-
-
-
-
-
diff --git a/donation_tax_receipt/security/ir.model.access.csv b/donation_tax_receipt/security/ir.model.access.csv
deleted file mode 100644
index f3037e3bb..000000000
--- a/donation_tax_receipt/security/ir.model.access.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_donation_tax_receipt_viewer,Read access on donation.tax.receipt to Donation Viewer grp,model_donation_tax_receipt,donation.group_donation_viewer,1,0,0,0
-access_donation_tax_receipt,Create/Write access on donation.tax.receipt to Donation User,model_donation_tax_receipt,donation.group_donation_user,1,1,1,0
-access_donation_tax_receipt_full,Full access on donation.tax.receipt to Donation Manager,model_donation_tax_receipt,donation.group_donation_manager,1,1,1,1
diff --git a/donation_tax_receipt/static/description/icon.png b/donation_tax_receipt/static/description/icon.png
deleted file mode 100644
index f76fa38d3..000000000
Binary files a/donation_tax_receipt/static/description/icon.png and /dev/null differ
diff --git a/donation_tax_receipt/test/annual_tax_receipt.yml b/donation_tax_receipt/test/annual_tax_receipt.yml
deleted file mode 100644
index 858fcc078..000000000
--- a/donation_tax_receipt/test/annual_tax_receipt.yml
+++ /dev/null
@@ -1,64 +0,0 @@
--
- Create a first donation
--
- !record {model: donation.donation, id: annual_donation1}:
- journal_id: account.check_journal
- currency_id: base.EUR
- partner_id: donation.donor2
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_option: annual
- donation_date: !eval time.strftime('%Y-%m-%d')
- payment_ref: CHQ SG 123412
- check_total: 50
- line_ids:
- - product_id: donation.product_product_donation
- quantity: 1
- unit_price: 40
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: True
- - product_id: product_product_donation_notaxreceipt
- quantity: 1
- unit_price: 10
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: False
--
- Create a second donation
--
- !record {model: donation.donation, id: annual_donation2}:
- journal_id: account.check_journal
- currency_id: base.EUR
- partner_id: donation.donor2
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_option: annual
- donation_date: !eval time.strftime('%Y-%m-%d')
- payment_ref: CHQ SG 123413
- check_total: 150
- line_ids:
- - product_id: donation.product_product_donation
- quantity: 1
- unit_price: 140
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: True
- - product_id: product_product_donation_notaxreceipt
- quantity: 1
- unit_price: 10
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: False
--
- Run wizard to generate annual tax receipts and check tax receipt
--
- !python {model: donation.donation, id: annual_donation1}: |
- import time
- self += self.env.ref('donation_tax_receipt.annual_donation2')
- self.validate()
- wizard = self.env['tax.receipt.annual.create'].create({'start_date': time.strftime('%Y-01-01'), 'end_date': time.strftime('%Y-12-31')})
- action = wizard.generate_annual_receipts()
- tax_receipt_ids = action['domain'][0][2]
- assert len(tax_receipt_ids) == 1, 'No annual tax receipt generated'
- tax_receipt = self.env['donation.tax.receipt'].browse(tax_receipt_ids[0])
- assert tax_receipt.number, 'Missing number on annual tax receipt'
- assert tax_receipt.date == time.strftime('%Y-12-31'), 'Wrong date on annual tax receipt'
- assert tax_receipt.donation_date == time.strftime('%Y-12-31'), 'Wrong donation_date on annual tax receipt'
- assert tax_receipt.amount == 180, 'Wrong amount on annual tax receipt'
- assert tax_receipt.currency_id.id == ref('base.EUR'), 'Wrong currency on annual tax receipt'
- assert tax_receipt.type == 'annual', 'Wrong type on annual tax receipt'
diff --git a/donation_tax_receipt/test/each_tax_receipt.yml b/donation_tax_receipt/test/each_tax_receipt.yml
deleted file mode 100644
index 29657667b..000000000
--- a/donation_tax_receipt/test/each_tax_receipt.yml
+++ /dev/null
@@ -1,42 +0,0 @@
--
- Create a Donation
--
- !record {model: donation.donation, id: each_donation1}:
- journal_id: account.check_journal
- currency_id: base.EUR
- partner_id: donation.donor1
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_option: each
- donation_date: !eval time.strftime('%Y-%m-%d')
- payment_ref: CHQ LCL 69100
- check_total: 220
- line_ids:
- - product_id: donation.product_product_donation
- quantity: 1
- unit_price: 190
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: True
- - product_id: product_product_donation_notaxreceipt
- quantity: 1
- unit_price: 30
- # remove line below when https://github.com/odoo/odoo/issues/4902 is fixed
- tax_receipt_ok: False
--
- Validate donation and check tax receipt
--
- !python {model: donation.donation, id: each_donation1}: |
- import time
- self.validate()
- assert self.state == 'done', 'Wrong status on donation'
- assert self.tax_receipt_id.number, 'Missing number on tax receipt'
- # Additionnal logging to try to understand what the test
- # on date sometimes fails on github/travis and not on my laptop
- import logging
- logger = logging.getLogger('Test donation_tax_receipt')
- logger.info("tax_receipt_id.date=%s", self.tax_receipt_id.date)
- logger.info("date today=%s", time.strftime('%Y-%m-%d'))
- assert self.tax_receipt_id.date == time.strftime('%Y-%m-%d'), 'Wrong date on tax receipt'
- assert self.tax_receipt_id.donation_date == time.strftime('%Y-%m-%d'), 'Wrong dontion_date on tax receipt'
- assert self.tax_receipt_id.amount == 190, 'Wrong amount on tax receipt'
- assert self.tax_receipt_id.currency_id.id == ref('base.EUR'), 'Wrong currency on tax receipt'
- assert self.tax_receipt_id.type == 'each', 'Wrong type on tax receipt'