diff --git a/__manifest__.py b/__manifest__.py
index d650283..7157fe7 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -34,6 +34,7 @@
'views/partner.xml',
'views/recurring_donation.xml',
'data/recurring_donation_configuration.xml',
+ 'data/data.xml',
'views/relationship.xml',
'views/operation.xml',
'views/templates.xml',
@@ -50,11 +51,14 @@
'report/report_donationtax.xml',
'report/report_donation_recurring.xml',
'report/report.xml',
+ 'report/report_donationthanks.xml',
'views/donation_tax_receipt.xml',
+ 'views/donation_thanks_template.xml',
'views/laposte_ref.xml',
'views/partner_import.xml',
'views/portal.xml',
'data/donation_recurring_mail_template.xml'
+
#'views/website_donation.xml'
diff --git a/data/data.xml b/data/data.xml
new file mode 100644
index 0000000..c086e4d
--- /dev/null
+++ b/data/data.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ generic
+
+
+ affectation
+
+
+ high amount
+
+
+
+ generic
+
+
+ affectation
+
+
+ high amount
+
+
+
+
\ No newline at end of file
diff --git a/i18n/fr.po b/i18n/fr.po
index e769fef..ae6ae3e 100644
--- a/i18n/fr.po
+++ b/i18n/fr.po
@@ -482,7 +482,7 @@ msgstr "Domaine"
#. module: opendons
#: model:ir.model,name:opendons.model_donation_donation
msgid "Donation"
-msgstr "Don"
+msgstr "Dons"
#. module: opendons
#: model:ir.model.fields,field_description:opendons.field_sale_order__donation_amount
@@ -1638,7 +1638,7 @@ msgstr ""
#. module: opendons
#: model:ir.model.fields,field_description:opendons.field_opendons_payment_batch__donation_ids
msgid "donation"
-msgstr "don"
+msgstr "dons"
#. module: opendons
#: model:ir.model,name:opendons.model_opendons_duplicate_partner
diff --git a/models/__init__.py b/models/__init__.py
index 366d54d..54f0b22 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -19,6 +19,7 @@ from . import donation_tax_receipt
from . import laposte_ref
from . import settings
from . import donation_recurring_template_letter
+from . import donation_thanks_template
from . import partner_import
#from . import res_partner_bank
from .import donation_print_email_history
\ No newline at end of file
diff --git a/models/donation.py b/models/donation.py
index 150fe0a..46721b5 100644
--- a/models/donation.py
+++ b/models/donation.py
@@ -92,6 +92,8 @@ class DonationDonation(models.Model):
string='print or email history ',
readonly=True
)
+ html_content_print=fields.Html('html content print')
+
def _compute_year_donation_date(self):
for rec in self:
@@ -621,8 +623,26 @@ class DonationDonation(models.Model):
res.append((donation.id, name))
return res
+ def print_thanks(self):
+ self.ensure_one()
+ self.write({"thanks_printed": True})
+
+ html_content_print=self.thanks_template_id.html_content
+ html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
+ html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
+ html_content_print=html_content_print.replace('{{adresse}}',self.env['donation.tax.receipt'].update_adresse())
+ html_content_print=html_content_print.replace('{{donor_id}}',self.partner_id.donor_id)
+ self.html_content_print=html_content_print
+
+
+ return self.env.ref("opendons.report_donation_thanks").report_action(self)
+
class DonationLine(models.Model):
_inherit = 'donation.line'
donation_date=fields.Date(related='donation_id.donation_date')
- partner_id=fields.Many2one(related='donation_id.partner_id')
\ No newline at end of file
+ partner_id=fields.Many2one(related='donation_id.partner_id')
+
+
+
+
\ No newline at end of file
diff --git a/models/donation_tax_receipt.py b/models/donation_tax_receipt.py
index 28383ab..70833d4 100644
--- a/models/donation_tax_receipt.py
+++ b/models/donation_tax_receipt.py
@@ -7,6 +7,34 @@ class DonationTaxReceipt(models.Model):
template_rf_id=fields.Many2one('opendons.template_rf', 'RF template')
html_content=fields.Html('html content',compute='_html_content_rf')
html_content_print=fields.Html('html content print')
+ #donation_type=fields.Char('letter', compute='_compute_donation_type')
+
+
+
+ # #res = super(DonationTaxReceipt, self).create(vals)
+ # def _compute_donation_type(self):
+
+ # if len(self.donation_ids)>1:
+ # #1 cas d'un RF à plusieurs dons
+ # simple=True
+ # i=1
+ # for d in self.donation_ids:
+ # for l in d.donation_lines:
+ # if i==1: product_id=l.product_id
+ # else:
+ # if product_id!=l.product_id:
+ # simple=False
+ # break
+ # i=i+1
+ # if simple==True :
+ # self.donation_type='simple'
+ # self.product_id=product_id
+ # if simple==False :
+ # self.donation_type='multiple'
+ # self.product_id=False
+
+
+
def get_portal_url(self):
return "my/taxreceipt/print?id="+str(self.id)
@@ -17,6 +45,8 @@ class DonationTaxReceipt(models.Model):
html_content_print=self.html_content
html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
+ html_content_print=html_content_print.replace('{{adresse}}',self.update_adresse())
+ html_content_print=html_content_print.replace('{{donor_id}}',self.partner_id.donor_id)
self.html_content_print=html_content_print
#self.env['donation.tax_receipt'].write(vals)
@@ -27,8 +57,63 @@ class DonationTaxReceipt(models.Model):
def _html_content_rf(self):
self.html_content=self.template_rf_id.html_content
+ #affichage du RF depuis l'espace donateur
def update_print_pdf(self):
html_content_print=self.html_content
html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
- self.html_content_print=html_content_print
\ No newline at end of file
+ html_content_print=html_content_print.replace('{{donor_id}}',self.partner_id.donor_id)
+ html_content_print=html_content_print.replace('{{adresse}}',self.update_adresse())
+
+ self.html_content_print=html_content_print
+
+ def update_adresse(self):
+ p=self.env['res.partner'].search([('id','=',int(self.partner_id))])
+ result=''
+ #prise en compte de l'adresse fiscale ou non
+ if p.tax_street and p.tax_zip and p.city:
+ title=p.title.name if p.title.name else ''
+ name=p.name if p.name else ''
+ firstname=p.firstname if p.firstname else ''
+ street=p.tax_street if p.tax_street else ''
+ street2='
'+p.tax_street2 if p.tax_street2 else ''
+ locality='
'+p.tax_locality if p.tax_locality else ''
+ zip=p.tax_zip if p.tax_zip else ''
+ city=p.tax_city if p.tax_city else ''
+ country=p.tax_country_id.name if p.tax_country_id.name else ''
+
+ result='
'+title+' '+name+' '+firstname+'
'+street+street2+locality+'
'+zip+' '+city+'
'+country+'
'
+ else:
+ title=p.title.name if p.title.name else ''
+ name=p.name if p.name else ''
+ firstname=p.firstname if p.firstname else ''
+ street=p.street if p.street else ''
+ street2='
'+p.street2 if p.street2 else ''
+ locality='
'+p.locality if p.locality else ''
+ zip=p.zip if p.zip else ''
+ city=p.city if p.city else ''
+ country=p.country_id.name if p.country_id.name else ''
+
+ result=''+title+' '+name+' '+firstname+'
'+street+street2+locality+'
'+zip+' '+city+'
'+country+'
'
+
+ #result="Monsieur Dupont Marcel
7 avenue de la Marne
75016 Paris
"
+ return result
+
+class DonationTaxReceiptPrint(models.TransientModel):
+ _inherit = "donation.tax.receipt.print"
+
+
+ def print_receipts(self):
+ self.ensure_one()
+ if not self.receipt_ids:
+ raise UserError(_("There are no tax receipts to print."))
+ today = fields.Date.context_today(self)
+ #self.receipt_ids.write({"print_date": today})
+
+ #update htm to print in receipts
+ for receipt_id in self.receipt_ids:
+
+ receipt_id.update_print_pdf()
+
+
+ return self.env.ref("opendons.report_donation_tax_receipt").report_action(self.receipt_ids)
\ No newline at end of file
diff --git a/models/donation_thanks_template.py b/models/donation_thanks_template.py
new file mode 100644
index 0000000..670af0a
--- /dev/null
+++ b/models/donation_thanks_template.py
@@ -0,0 +1,16 @@
+from odoo import fields, models
+
+
+class DonationThanksTemplate(models.Model):
+ _inherit = "donation.thanks.template"
+
+ html_content=fields.Html('Html content')
+ type_id=fields.Many2one('opendons.type_donation_thanks_template', required=True)
+ product_id=fields.Many2one('product.product',domain="[('donation','=',True)]")
+
+
+class opendons_type_donation_thanks_template(models.Model):
+ _name = 'opendons.type_donation_thanks_template'
+ _description = 'manage type donation thanks emplate'
+
+ name=fields.Char('name')
diff --git a/models/settings.py b/models/settings.py
index 2e23890..ef069e9 100644
--- a/models/settings.py
+++ b/models/settings.py
@@ -7,6 +7,7 @@ class OpendonsSettings(models.TransientModel):
generation_day=fields.Integer('Generation day in the month',config_parameter='opendons.generation_day')
limit_days_before=fields.Integer('Limit days before generation day',config_parameter='opendons.limit_days_before')
pa_debug_mode=fields.Boolean('Debug mode',config_parameter='opendons.pa_debug_mode')
+ donation_big_amount=fields.Integer('Donation big amount threshold',config_parameter='opendons.donation_big_amount')
diff --git a/models/template_rf.py b/models/template_rf.py
index c0f9e58..924b7ee 100644
--- a/models/template_rf.py
+++ b/models/template_rf.py
@@ -17,10 +17,17 @@ class opendons_template_rf(models.Model):
description=fields.Text('description')
active=fields.Boolean('active')
html_content=fields.Html('Html content')
+ type_id=fields.Many2one('opendons.type_template_rf', required=True)
def action_update_receipts(self):
rf=self.env['donation.tax.receipt'].search([('template_rf_id','=',int(self.id))])
for r in rf:
- r.html_content=self.html_content
\ No newline at end of file
+ r.html_content=self.html_content
+
+class opendons_type_template_rf(models.Model):
+ _name = 'opendons.type_template_rf'
+ _description = 'manage type rf template'
+
+ name=fields.Char('name')
\ No newline at end of file
diff --git a/report/report.xml b/report/report.xml
index 21f2e65..8ce785f 100644
--- a/report/report.xml
+++ b/report/report.xml
@@ -1,6 +1,20 @@
+
+ Donation thanks report
+ donation.donation
+ qweb-pdf
+ opendons.report_donationthanks
+ opendons.report_donationthanks
+ 'Thanks-'+(object.number or '').replace('/','')+'.pdf'
+
+
+ report
+
+
Donation Tax Receipt
donation.tax.receipt
diff --git a/report/report_donationtax.xml b/report/report_donationtax.xml
index 29ab144..ece6da6 100644
--- a/report/report_donationtax.xml
+++ b/report/report_donationtax.xml
@@ -2,29 +2,23 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
diff --git a/report/report_donationthanks.xml b/report/report_donationthanks.xml
new file mode 100644
index 0000000..048d944
--- /dev/null
+++ b/report/report_donationthanks.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv
index c65e2fe..1a3d8e7 100644
--- a/security/ir.model.access.csv
+++ b/security/ir.model.access.csv
@@ -32,6 +32,8 @@ access_opendons_duplicate_partner,opendons_duplicate_partner,model_opendons_dupl
access_opendons_template_rf,opendons_template_rf,model_opendons_template_rf,donation.group_donation_manager,1,1,1,1
+access_opendons_donation_thanks_type_template,opendons_donation_thanks_type_template,model_opendons_type_donation_thanks_template,donation.group_donation_manager,1,1,1,1
+
access_opendons_laposte_ref,opendons_laposte_ref,model_opendons_laposte_ref,donation.group_donation_manager,1,1,1,1
diff --git a/views/donation_thanks_template.xml b/views/donation_thanks_template.xml
new file mode 100644
index 0000000..b7a9a34
--- /dev/null
+++ b/views/donation_thanks_template.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ opendons.donation.form
+ donation.thanks.template
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ opendons.donation.form
+ donation.thanks.template
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/views/recurring_donation.xml b/views/recurring_donation.xml
index a444470..47f72ca 100644
--- a/views/recurring_donation.xml
+++ b/views/recurring_donation.xml
@@ -31,11 +31,11 @@
-
+
-
+
@@ -84,8 +84,8 @@
-
-
+
+
diff --git a/views/settings.xml b/views/settings.xml
index 19e6919..09cc38c 100644
--- a/views/settings.xml
+++ b/views/settings.xml
@@ -7,6 +7,13 @@
+
Tax receipt
+
Recurring payment management
diff --git a/views/template_rf.xml b/views/template_rf.xml
index 8ba662f..469aa45 100644
--- a/views/template_rf.xml
+++ b/views/template_rf.xml
@@ -13,6 +13,7 @@
+
@@ -32,6 +33,7 @@
+