diff --git a/__manifest__.py b/__manifest__.py
index ef0630c..4cd8f46 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -26,12 +26,13 @@
'data': [
'security/ir.model.access.csv',
'security/security.xml',
+ 'views/settings.xml',
'views/qualifier.xml',
'views/address.xml',
'views/email.xml',
'views/phone.xml',
'views/partner.xml',
- 'views/donation.xml',
+ 'views/recurring_donation.xml',
'data/recurring_donation_configuration.xml',
'views/relationship.xml',
'views/operation.xml',
@@ -43,11 +44,16 @@
'views/aggregate.xml',
'views/duplicate.xml',
'views/template_rf.xml',
+ 'views/template_pa.xml',
'wizard/operation_duplicate_wizard.xml',
+ 'wizard/recurring_donation_wizard.xml',
'report/report_donationtax.xml',
+ 'report/report_donation_recurring.xml',
'report/report.xml',
'views/donation_tax_receipt.xml',
- 'views/laposte_ref.xml'
+ 'views/laposte_ref.xml',
+ 'views/partner_import.xml',
+ 'data/donation_recurring_mail_template.xml'
#'views/website_donation.xml'
diff --git a/data/donation_recurring_mail_template.xml b/data/donation_recurring_mail_template.xml
new file mode 100644
index 0000000..87cd3b1
--- /dev/null
+++ b/data/donation_recurring_mail_template.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ Send by Email
+ ${(user.email and '%s <%s>' % (user.name, user.email) or '')|safe}
+ ${object.company_id.name} - Recurring donation information
+ ${object.partner_id.id}
+
+
+ ${object.partner_id.lang}
+
+
+
diff --git a/data/recurring_donation_configuration.xml b/data/recurring_donation_configuration.xml
index 17659b9..056847f 100644
--- a/data/recurring_donation_configuration.xml
+++ b/data/recurring_donation_configuration.xml
@@ -1,12 +1,3 @@
-
-
- 5
- 15
-
-
-
-
-
\ No newline at end of file
diff --git a/i18n/fr.po b/i18n/fr.po
index cd51150..f6f4b8e 100644
--- a/i18n/fr.po
+++ b/i18n/fr.po
@@ -526,7 +526,7 @@ msgid "Duplicate operation"
msgstr "Dupliquer l'opération"
#. module: opendons
-#: model:ir.model,name:opendons.model_opendons_operation_duplicate
+#: model:ir.model,name:opendpendons.model_opendons_operation_duplicate
msgid "Duplicate the operation"
msgstr "Dupliquer l'opération"
@@ -1162,7 +1162,7 @@ msgstr "Code postal"
#. module: opendons
#: model_terms:ir.ui.view,arch_db:opendons.view_opendons_donation_tax_receipt_form
msgid "Print"
-msgstr "Imprimmer"
+msgstr "Imprimer"
#. module: opendons
#: model:ir.model.fields.selection,name:opendons.selection__res_partner__type__private
@@ -2133,3 +2133,98 @@ msgstr ""
#: model:ir.model.fields,field_description:opendons.field_opendons_qualifier_partnerqualifier__value_text
msgid "value"
msgstr "valeur"
+
+#. module: opendons
+#: model_terms:ir.ui.view,arch_db:opendons.view_opendons_donation_form
+msgid "Stop"
+msgstr "Arrêter les prélèvements"
+
+#. module: opendons
+#: model:ir.model.fields,field_description:opendons.field_donation_donation__stopped_reason
+#: model:ir.model.fields,field_description:opendons.field_opendons_recurringdonation_wizard__stopped_reason
+msgid "Stop reason"
+msgstr "Raison"
+
+#. module: opendons
+#: code:addons/opendons/models/donation.py:0
+#: model:ir.actions.act_window,name:opendons.action_recurring_donation_wizard
+#, python-format
+msgid "Stop recurring donation"
+msgstr "Arrêter les prélèvements"
+
+#. module: opendons
+#: model:ir.model.fields.selection,name:opendons.selection__donation_donation__recurring_template__stopped
+#: model_terms:ir.ui.view,arch_db:opendons.view_opendons_donation_form
+msgid "Stopped"
+msgstr "Stoppé"
+
+#. module: opendons
+#: model:ir.model.fields,field_description:opendons.field_donation_donation__stopped_date
+msgid "Stopped Date"
+msgstr "Date d'arrêt"
+
+#. module: opendons
+#: code:addons/opendons/models/donation.py:0
+#, python-format
+msgid "Stopped Recurring Donation %s"
+msgstr "Prélèvement automatique stoppé %s"
+
+#. module: opendons
+#: model_terms:ir.ui.view,arch_db:opendons.view_opendons_donation_form
+msgid "Suspend"
+msgstr "Suspendre le prélèvement"
+
+#. module: opendons
+#: model_terms:ir.ui.view,arch_db:opendons.view_opendons_donation_form
+msgid "This action is defintive, are you sure ?"
+msgstr "Cette action est définitive, êtes-vous sûr ?"
+
+#. module: opendons
+#: model_terms:ir.ui.view,arch_db:opendons.recurring_donation_view
+msgid "stop the recurring donation"
+msgstr "Arrêter le prélèvement automatique"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraft_title_menu
+msgid "Partners import"
+msgstr "Import de contacts"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraft_menu
+msgid "Partners imported"
+msgstr "Contact importés pour transfert"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraftfile_menu
+msgid "Partners files"
+msgstr "Fichiers d'import"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraft_file_mapping_menu
+msgid "mapping fields"
+msgstr "mapping des champs"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraftfileimport_menu
+msgid "Import files"
+msgstr "Importer les fichiers"
+
+#. module: opendons
+#: model:ir.actions.server,name:opendons.ir_action_partnerdraft_transfert
+msgid "transfert draft partners"
+msgstr "Transfert vers la base des contacts"
+
+#. module: opendons
+#: model:ir.ui.menu,name:opendons.opendons_partnerdraftfiletransfert_menu
+msgid "Draft Partners transfert"
+msgstr "Transfert vers la base des contacts"
+
+#. module: opendons
+#: model:ir.model.fields,field_description:opendons.field_opendons_partnerdraftfile_mapping__external_field
+msgid "external field"
+msgstr "Champ du fichier"
+
+#. module: opendons
+#: model:ir.model.fields,field_description:opendons.field_opendons_partnerdraftfile_mapping__odoo_field
+msgid "odoo field"
+msgstr "Champ interne"
\ No newline at end of file
diff --git a/models/__init__.py b/models/__init__.py
index 4e88124..8f73648 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -17,4 +17,7 @@ from . import duplicate
from . import template_rf
from . import donation_tax_receipt
from . import laposte_ref
+from . import settings
+from . import donation_recurring_template_letter
+from . import partner_import
#from . import res_partner_bank
\ No newline at end of file
diff --git a/models/donation.py b/models/donation.py
index 9bd65da..67083b4 100644
--- a/models/donation.py
+++ b/models/donation.py
@@ -1,17 +1,17 @@
from odoo import models, fields, api,_
from odoo.exceptions import UserError, ValidationError,Warning
from psycopg2 import sql, DatabaseError
-from datetime import datetime
+from datetime import datetime,timedelta,date
+from dateutil.relativedelta import relativedelta
from werkzeug import utils
import base64
class opendons_recurring_donation(models.Model):
- _name = 'opendons.recurring_donation_configuration'
+ _name = 'opendons.recurring_donation'
_description = 'recurring donation management'
- generation_day=fields.Integer('Generation day in the month')
- limite_days_before=fields.Integer('Limite_days before generation day')
+ last_execution_date=fields.Date('Last execution date')
class DonationDonation(models.Model):
_inherit = 'donation.donation'
@@ -37,13 +37,32 @@ class DonationDonation(models.Model):
ondelete='restrict'
)
-
+ recurring_template = fields.Selection(
+ [("active", "Active"), ("suspended", "Suspended"),("stopped", "Stopped")],
+ string="Recurring Template",
+ copy=False,
+ index=True,
+ tracking=True,
+ )
+ start_date= fields.Date(
+ string='Start Date',
+ index=True,
+ required=True,
+ track_visibility='onchange'
+ )
end_date = fields.Date(
string='End Date',
index=True,
+ track_visibility='onchange'
+ )
+ stopped_date = fields.Date(
+ string='Stopped Date',
+ index=True,
readonly=True,
track_visibility='onchange'
)
+ stopped_reason=fields.Selection(string='Stop reason',selection=[('motif1', 'Motif 1'), ('motif2', 'Motif 2')],default='motif1',track_visibility='onchange')
+
suspended_date = fields.Date(
string='Suspended Date',
index=True,
@@ -66,39 +85,20 @@ class DonationDonation(models.Model):
string='Payment Batch',
ondelete='set null'
)
-
- @api.model
- def create(self, vals):
- vals['tax_receipt_option']='annual'
- res = super(DonationDonation, self).create(vals)
- #res.tax_receipt_option='annual'
-
- # sepa_payment_method=self.env['account.payment.method'].search([('code','=','sepa_direct_debit')])
- # if sepa_payment_method:
- # sepa_payment_mode=self.env['account.payment.mode'].search([('payment_method_id','=',int( sepa_payment_method))])
- # if sepa_payment_mode:
- # res.payment_mode_id=sepa_payment_mode.id
- # else:
- # raise Warning('Please configure mode sepa payment')
-
- # else:
- # raise Warning('Please configure method sepa payment')
-
-
- return res
-
+
def _default_payment_mode_id(self):
- #if self.recurring_template=='active':
+ #raise Warning(self.recurring_template)
+ if self.recurring_template=='active':
- sepa_payment_method=self.env['account.payment.method'].search([('code','=','sepa_direct_debit')])
-
- if sepa_payment_method:
+ sepa_payment_method=self.env['account.payment.method'].search([('code','=','sepa_direct_debit')])
- id=int(sepa_payment_method.id)
- return 4
- else:
- raise Warning('veuillez configurer la méthode de paiment SEPA')
+ if sepa_payment_method:
+
+ id=int(sepa_payment_method.id)
+ return 4
+ else:
+ raise Warning('veuillez configurer la méthode de paiment SEPA')
payment_mode_id = fields.Many2one(
"account.payment.mode",
@@ -107,10 +107,60 @@ class DonationDonation(models.Model):
copy=False,
tracking=True,
check_company=True,
+ default=_default_payment_mode_id,
states={"done": [("readonly", True)]}
)
+ @api.model
+ def create(self, vals):
+ vals['tax_receipt_option']='annual'
+
+ res = super(DonationDonation, self).create(vals)
+
+
+
+ return res
+
+
+
+ @api.onchange("partner_id")
+ def donation_partner_direct_debit_change(self):
+
+ if not self.payment_mode_id and self.recurring_template=='active':
+ self.mandate_id=False
+ sepa_payment_method=self.env['account.payment.method'].search([('code','=','sepa_direct_debit')],limit=1)
+ if sepa_payment_method:
+ sepa_payment_mode=self.env['account.payment.mode'].search([('payment_method_id','=',int(sepa_payment_method.id))],limit=1)
+ if sepa_payment_mode:
+ self.payment_mode_id=sepa_payment_mode.id
+ else:
+ raise Warning(_('Please configure a SEPA payment mode'))
+
+ else:
+ raise Warning(_('Please configure a SEPA payment method'))
+
+ if (
+
+ self.partner_id
+ and self.payment_mode_id
+ and self.payment_mode_id.payment_method_id.mandate_required
+
+ ):
+
+ mandate = self.env["account.banking.mandate"].search(
+ [
+ ("state", "=", "valid"),
+ ("partner_id", "=", int(self.partner_id)),
+ ],
+ limit=1,
+ )
+ if mandate:
+ self.mandate_id = mandate
+ else:
+ self.mandate_id=False
+
+
@api.onchange('operation_id')
@@ -122,9 +172,48 @@ class DonationDonation(models.Model):
def generate_recurring_payment(self):
#self.ensure_one()
+
+
+ generation_day = self.env['ir.config_parameter'].get_param('opendons.generation_day', '')
+ limit_days_before = int(self.env['ir.config_parameter'].get_param('opendons.limit_days_before'))
+ debug_mode = self.env['ir.config_parameter'].get_param('opendons.pa_debug_mode')
+ r=self.env['opendons.recurring_donation'].search([])
+
+ if r.last_execution_date and not debug_mode:
+ month_last_exe=r.last_execution_date.month
+ month_today=datetime.now().date().month
+
+ #si le mois en cours a déjà été executé, l'execution est donc pour le mois suivant :
+ if month_last_exe==month_today:
+ date_generation=r.last_execution_date+relativedelta(months=1)
+ date_before=date_generation-timedelta(days=limit_days_before)
+ date_today=datetime.now().date()
+ #si la date du jour est antérieur à la date limite alors message
+ if date_todaydate_after:raise Warning('today you can\'t generate recurring payment')
+
+
doo = self.env["donation.donation"]
#chercher les templates de dons récurrents actifs
donations = doo.search(
@@ -140,10 +229,11 @@ class DonationDonation(models.Model):
#création d'un don si les dates sont bonnes
for donation in donations:
+ if not donation.start_date: continue
generate=True
existing_recur_donations = doo.search([("source_recurring_id", "=",int(donation.id))])
- if donation.donation_date>fields.Date.context_today(self):
+ if donation.start_date>fields.Date.context_today(self):
generate=False
delta=0
@@ -164,7 +254,7 @@ class DonationDonation(models.Model):
if generate==True:
default = {
"recurring_template":'',
- "donation_date": fields.Date.context_today(self),
+ "donation_date": date_generation,
"source_recurring_id": donation.id,
"payment_ref": '',
"payment_mode_id":donation.payment_mode_id.id,
@@ -177,7 +267,7 @@ class DonationDonation(models.Model):
#ajout du don à la collection des dons générés pour affichage
new_donation_ids.append(new_donation.id)
#mise à jour de la date de dernière génération
- donation.lastexecution_date=datetime.now().date()
+ donation.lastexecution_date=date_generation
payment_mode_id=donation.payment_mode_id.id
if not new_donation_ids : raise Warning ("aucun don n'a été généré")
@@ -198,6 +288,11 @@ class DonationDonation(models.Model):
# "limit": 500,
# }
# )
+ if not r:r.create({'last_execution_date':date_generation})
+ if r:r.write({'last_execution_date':date_generation})
+ r=self.env['opendons.recurring_donation'].search([])
+
+
action = self.env.ref("account_payment_order.account_payment_order_inbound_action").sudo().read([])[0]
action.update(
@@ -430,4 +525,56 @@ class DonationDonation(models.Model):
# }
# )
- return action
\ No newline at end of file
+ return action
+
+ def active2suspended(self):
+ self.ensure_one()
+ assert self.recurring_template == "active"
+ self.write({"recurring_template": "suspended"})
+ self.write({"suspended_date": fields.Date.context_today(self)})
+
+ def suspended2active(self):
+ self.ensure_one()
+ assert self.recurring_template == "suspended"
+ self.write({"recurring_template": "active"})
+ self.write({"suspended_date": False})
+
+ def active2stopped(self):
+ self.ensure_one()
+ assert self.recurring_template == "active"
+ view=self.env.ref('opendons.recurring_donation_view')
+
+ wiz=self.env['opendons.recurringdonation.wizard'].create({'stopped_reason':'motif1','donation_id':self.id})
+
+ return {
+ 'name': _('Stop recurring donation'),
+ 'type': 'ir.actions.act_window',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'opendons.recurringdonation.wizard',
+ 'views': [(view.id, 'form')],
+ 'view_id': view.id,
+ 'target': 'new',
+ 'res_id': wiz.id,
+ 'context': self.env.context,
+ }
+
+
+
+ # self.write({"recurring_template": "stopped"})
+ # self.write({"stopped_date": fields.Date.context_today(self)})
+
+ @api.depends("state", "partner_id", "move_id", "recurring_template")
+ def name_get(self):
+ res = []
+ for donation in self:
+ if donation.recurring_template == "active":
+ name = _("Recurring Donation %s") % (donation.number)
+ elif donation.recurring_template == "suspended":
+ name = _("Suspended Recurring Donation %s") % (donation.number)
+ elif donation.recurring_template == "stopped":
+ name = _("Stopped Recurring Donation %s") % (donation.number)
+ else:
+ name = super(DonationDonation, donation).name_get()[0][1]
+ res.append((donation.id, name))
+ return res
\ No newline at end of file
diff --git a/models/donation_recurring_template_letter.py b/models/donation_recurring_template_letter.py
new file mode 100644
index 0000000..d323f2d
--- /dev/null
+++ b/models/donation_recurring_template_letter.py
@@ -0,0 +1,75 @@
+from odoo import api, fields, models,_
+from odoo.exceptions import UserError,Warning
+
+
+class DonationRecurringTemplateLetter(models.Model):
+ _inherit = "donation.donation"
+
+ template_pa_id=fields.Many2one('opendons.template_pa_letter', '(e)mail to send')
+ html_content=fields.Html('html content',compute='pa_html_content')
+ html_content_print=fields.Html('html content print')
+
+ def action_print_pa(self):
+ self.ensure_one()
+
+ if self.html_content:
+ 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=self.html_content
+
+
+ return self.env.ref("opendons.report_donation_recurring_letter").report_action(self)
+ else:
+ raise Warning('please select a mail to print')
+
+ def action_send_pa(self):
+ self.ensure_one()
+
+ if not self.partner_id.email:
+ raise UserError(
+ _("Missing email on partner '%s'.") % self.partner_id.display_name
+ )
+ self.partner_id.display_name
+ template = self.env.ref("opendons.donation_recurring_email_template")
+ compose_form = self.env.ref("mail.email_compose_message_wizard_form")
+ ctx = dict(
+ default_model="donation.donation",
+ default_res_id=self.id,
+ default_use_template=bool(template),
+ default_template_id=template.id,
+ default_composition_mode="comment",
+ default_body_html='dddd'
+ )
+ action = {
+ "name": _("Compose Email"),
+ "type": "ir.actions.act_window",
+ "view_mode": "form",
+ "res_model": "mail.compose.message",
+ "view_id": compose_form.id,
+ "target": "new",
+ "context": ctx,
+ }
+ return action
+
+ def pa_html_content(self):
+ self.html_content=self.template_pa_id.html_content
+
+class opendons_template_pa(models.Model):
+ _name = 'opendons.template_pa_letter'
+ _description = 'manage pa html template'
+
+ name=fields.Char('name')
+ description=fields.Text('description')
+ active=fields.Boolean('active')
+ html_content=fields.Html('Html content')
+
+ def action_update_pa(self):
+
+ pa=self.env['donation.donation'].search([('template_pa_id','=',int(self.id))])
+
+ for p in pa:
+ p.html_content=self.html_content
\ No newline at end of file
diff --git a/models/donation_tax_receipt.py b/models/donation_tax_receipt.py
index f317912..095fca5 100644
--- a/models/donation_tax_receipt.py
+++ b/models/donation_tax_receipt.py
@@ -5,7 +5,7 @@ class DonationTaxReceipt(models.Model):
_inherit = "donation.tax.receipt"
template_rf_id=fields.Many2one('opendons.template_rf', 'RF template')
- html_content=fields.Html('html content',compute='_html_content')
+ html_content=fields.Html('html content',compute='_html_content_rf')
html_content_print=fields.Html('html content print')
def action_print_rf(self):
@@ -22,5 +22,5 @@ class DonationTaxReceipt(models.Model):
return self.env.ref("opendons.report_donation_tax_receipt").report_action(self)
#return True
- def _html_content(self):
+ def _html_content_rf(self):
self.html_content=self.template_rf_id.html_content
\ No newline at end of file
diff --git a/models/partner_import.py b/models/partner_import.py
new file mode 100644
index 0000000..7901bc1
--- /dev/null
+++ b/models/partner_import.py
@@ -0,0 +1,199 @@
+from odoo import models, fields, api
+from odoo.exceptions import UserError, ValidationError, Warning
+from psycopg2 import sql, DatabaseError
+from odoo.tools.safe_eval import safe_eval, datetime
+
+from werkzeug import utils
+import csv
+import base64
+import io
+import json
+
+
+
+class opendons_partnerdraftfile(models.Model):
+ _name = 'opendons.partnerdraftfile'
+ _description = 'draft partner file'
+
+ #file= fields.Binary("Téléverser le fichier des contacts")
+ file = fields.Binary("Attachment")
+ file_name = fields.Char("Nom du fichier")
+ active = fields.Boolean("actif")
+ source_name=fields.Char("Source")
+
+ def import_csv_files(self):
+ self.env["opendons.partnerdraft"].search([]).unlink()
+ files= self.env["opendons.partnerdraftfile"].search([('active','=',True)])
+ #raise Warning('fff')
+ for f in files:
+ decrypted = base64.b64decode(f.file).decode('utf-8-sig')
+ source_name=f.source_name
+ with io.StringIO(decrypted) as fp:
+ reader = csv.DictReader(fp, delimiter=";", quotechar='"')
+ for row in reader:
+ vals={}
+ vals['source_name']=source_name
+ for key, value in row.items():
+
+ field_map=self.env['opendons.partnerdraftfile_mapping'].search([('external_field','=',key)])
+ if field_map:
+ odoo_field=field_map.odoo_field
+ vals[odoo_field]=str(value)
+
+ else: raise Warning('champ '+str(key)+' non trouvé')
+ self.env['opendons.partnerdraft'].create(vals)
+
+ #raise Warning(json.dumps(row))
+ action = self.env.ref("opendons.opendons_partnerdraft_action").sudo().read([])[0]
+
+ return action
+
+ def transfert_draftpartner(self):
+ #transfert des contacts importés, dans la base des contact odoo
+ partners=self.env['opendons.partnerdraft'].search([])
+ fields=self.env['opendons.partnerdraftfile_mapping'].search([])
+ if partners:
+ for p in partners:
+
+ vals={}
+ for f in fields:
+ if f.partner_field=='country_id':
+ if p[f.odoo_field]!='':
+ country=self.env['res.country'].search([('name','=',p[f.odoo_field])])
+ if country:vals[f.partner_field]=country.id
+ else:vals[f.partner_field]=False
+
+ elif f.partner_field=='title':
+ if p[f.odoo_field]!='':
+ title=self.env['res.partner.title'].search([('name','=',p[f.odoo_field])])
+ if title:vals[f.partner_field]=title.id
+ else:vals[f.partner_field]=False
+ else:
+ vals[f.partner_field]=False
+
+ elif f.partner_field in ('origine','statut_contact'):
+ if p[f.odoo_field]!=False:
+ vals[f.partner_field]=p[f.odoo_field].lower()
+
+ else:
+
+ vals[f.partner_field]=p[f.odoo_field]
+
+ vals['company_type']='person'
+
+ self.env['res.partner'].create(vals)
+
+ partners=self.env['opendons.partnerdraft'].search([]).unlink()
+
+
+
+
+
+class opendons_partnerdraftfile_mapping(models.Model):
+ _name = 'opendons.partnerdraftfile_mapping'
+ _description = 'file mapping'
+
+
+ external_field=fields.Char('external field')
+ odoo_field=fields.Selection('odoo_field_selection', string='odoo field')
+ partner_field=fields.Selection('partner_field_selection', string='partner field')
+
+ @api.model
+ def odoo_field_selection(self):
+ field_list=self.env['opendons.partnerdraft'].fields_get()
+
+ result=[]
+ for key in field_list:
+ result.append((key,key))
+ result.sort()
+ return result
+
+ api.model
+ def partner_field_selection(self):
+ field_list=self.env['res.partner'].fields_get()
+
+ result=[]
+ for key in field_list:
+ result.append((key,key))
+ result.sort()
+ return result
+
+class opendons_partnerdraft(models.Model):
+ _name = 'opendons.partnerdraft'
+ _description = 'import draft partner'
+ _order = "id asc"
+
+ external_id=fields.Char(string='external id')
+ name=fields.Char(string='nom')
+ firstname=fields.Char(string='prenom')
+ title=fields.Char(string='civilité')
+ street = fields.Char(string='adresse')
+ street2 = fields.Char(string='adresse2')
+ city = fields.Char(string='ville')
+ country = fields.Char(string='pays')
+ zip = fields.Char(string='code postal')
+ phone = fields.Char(string='tel')
+ email = fields.Char(string='Email')
+ statut_contact=fields.Char('Statut')
+ date_creation_contact=fields.Char(string='Date contact')
+ origine=fields.Char(string='Origine')
+ date_member=fields.Char(string='Date adhesion')
+ doublon=fields.Boolean(string='Doublon')
+ source_name=fields.Char(string='Source')
+
+class partner(models.Model):
+ _inherit = 'res.partner'
+ external_id=fields.Char('id')
+ statut_contact=fields.Selection([('adhérent', 'Adhérent'), ('bienfaiteur', 'Bienfaiteur'),('contact', 'Contact'), ('soutien','Soutien') ],'Statut', index=True)
+ date_creation_contact=fields.Char(string='Date de création du contact', readonly=True)
+ origine=fields.Selection([
+ ('boutique','Boutique'),
+ ('visiteur','Visiteur'),
+ ('vincennes','Vincennes'),
+ ('bercy','Bercy'),
+ ('salon zen','Salon Zen'),
+ ('autre','Autre'),
+ ('internet boutique','Internet Boutique'),
+ ('conf m ricard','Conf M Ricard'),
+ ('visite lzr 09','Visite lzr 09'),
+ ('retraite','Retraite'),
+ ('amis','Amis'),
+ ('centre fpmt','Centre FPMT'),
+ ('site réservations','Site réservations'),
+ ('réservations','Réservations'),
+ ('voyage inde','Voyage inde'),
+ ('internet','Internet'),
+ ('librairie','Librairie'),
+ ('site internet boutique','Site internet boutique'),
+ ('portes ouvertes st cosme','Portes ouvertes st cosme'),
+ ('t','T'),
+ ('maitreya','maitreya'),
+ ('zen','Zen'),
+ ('lille','Lille'),
+ ('alan wallace','Alan wallace'),
+ ('salon rouen','Salon Rouen'),
+ ('stage','Stage'),
+ ('b.actualit','B.Actualit'),
+ ('b. actualit','B. Actualit'),
+ ('r','R'),
+ ('institut vy','Institut vy'),
+ ('initiation kalachakr','Initiation kalachakr'),
+ ('yoga','Yoga'),
+ ('samsara','Samsara'),
+ ('missun@gmail.com','missun@gmail.com'),
+ ('reliques','Reliques'),
+ ('journal m','Journal m'),
+ ('nantes','Nantes'),
+ ('retraite vipassana','retraite vipassana'),
+ ('presse bouddhiste','Presse bouddhiste'),
+ ('réservtions','Réservtions'),
+ ('réservation','Réservation'),
+ ('site','Site'),
+ ('question mail','Question mail'),
+ ('interreligieux','interreligieux'),
+ ('refuge','Refuge'),
+ ('zoom','zoom'),
+ ('contact','contact'),
+ ],'Origine', index=True)
+
+ date_adhesion=fields.Char(string='Date adhesion', readonly=True)
\ No newline at end of file
diff --git a/models/settings.py b/models/settings.py
new file mode 100644
index 0000000..2e23890
--- /dev/null
+++ b/models/settings.py
@@ -0,0 +1,14 @@
+from odoo import fields, models,api, _
+
+class OpendonsSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ #recurring donation params
+ 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')
+
+
+
+
+
diff --git a/report/report.xml b/report/report.xml
index 2e32825..21f2e65 100644
--- a/report/report.xml
+++ b/report/report.xml
@@ -1,10 +1,5 @@
-
+
Donation Tax Receipt
@@ -19,4 +14,19 @@
report
+
+
+ Donation recurring letter
+ donation.donation
+ qweb-pdf
+ opendons.report_donation_recurring
+ opendons.report_donation_recurring
+ 'PA-'+(object.number or '').replace('/','')+'.pdf'
+
+
+ report
+
+
\ No newline at end of file
diff --git a/report/report_donation_recurring.xml b/report/report_donation_recurring.xml
new file mode 100644
index 0000000..f51d827
--- /dev/null
+++ b/report/report_donation_recurring.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/report/report_donationtax.xml b/report/report_donationtax.xml
index 5bf15b5..29ab144 100644
--- a/report/report_donationtax.xml
+++ b/report/report_donationtax.xml
@@ -24,80 +24,6 @@
-
-
diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv
index 3f8b98a..c598f77 100644
--- a/security/ir.model.access.csv
+++ b/security/ir.model.access.csv
@@ -35,4 +35,12 @@ access_opendons_template_rf,opendons_template_rf,model_opendons_template_rf,dona
access_opendons_laposte_ref,opendons_laposte_ref,model_opendons_laposte_ref,donation.group_donation_manager,1,1,1,1
-access_opendons_recurring_donation_configuration,opendons_recurring_donation_configuration,model_opendons_recurring_donation_configuration,donation.group_donation_manager,1,1,1,1
+
+
+access_opendons_recurring_donation_wizard,opendons_recurring_donation_wizard,model_opendons_recurringdonation_wizard,donation.group_donation_manager,1,1,1,1
+access_opendons_recurring_donation,opendons_recurring_donation,model_opendons_recurring_donation,donation.group_donation_manager,1,1,1,1
+access_opendons_template_pa_letter,opendons_template_pa_letter,model_opendons_template_pa_letter,donation.group_donation_manager,1,1,1,1
+
+access_opendons_partnerdraft,opendons_partnerdraft,model_opendons_partnerdraft,donation.group_donation_manager,1,1,1,1
+access_opendons_partnerdraftfile,opendons_partnerdraftfile,model_opendons_partnerdraftfile,donation.group_donation_manager,1,1,1,1
+access_opendons_partnerdraft_file_mapping,opendons_partnerdraft_file_mapping,model_opendons_partnerdraftfile_mapping,donation.group_donation_manager,1,1,1,1
\ No newline at end of file
diff --git a/static/description/icon.png b/static/description/icon.png
new file mode 100644
index 0000000..649558c
Binary files /dev/null and b/static/description/icon.png differ
diff --git a/static/src/img/icon.png b/static/src/img/icon.png
new file mode 100644
index 0000000..649558c
Binary files /dev/null and b/static/src/img/icon.png differ
diff --git a/views/partner_import.xml b/views/partner_import.xml
new file mode 100644
index 0000000..972aa4b
--- /dev/null
+++ b/views/partner_import.xml
@@ -0,0 +1,148 @@
+
+
+
+
+ _partner_draft list
+ opendons.partnerdraft
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _partner_draft file list
+ opendons.partnerdraftfile
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _partner_draft file form
+ opendons.partnerdraftfile
+
+
+
+
+
+
+
+ import file draft partner
+
+ code
+ action=model.import_csv_files()
+
+
+
+ transfert draft partners
+
+ code
+ action=model.transfert_draftpartner()
+
+
+
+ _partner_draft file ampping list
+ opendons.partnerdraftfile_mapping
+
+
+
+
+
+
+
+
+
+
+
+ opendons.res.partner.form
+ res.partner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Partners draft
+ opendons.partnerdraft
+ tree,form
+
+
+
+
+ Partners draft file
+ opendons.partnerdraftfile
+ tree,form
+
+
+
+
+ file mapping
+ opendons.partnerdraftfile_mapping
+ tree,form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/views/donation.xml b/views/recurring_donation.xml
similarity index 55%
rename from views/donation.xml
rename to views/recurring_donation.xml
index 316b6f4..58d2802 100644
--- a/views/donation.xml
+++ b/views/recurring_donation.xml
@@ -8,18 +8,45 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -33,9 +60,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
opendons.donation.direct_debit.form
@@ -43,10 +109,16 @@
+
+
+
+
+
+
{'no_create_edit': True,'no_create': True}
-
+
@@ -69,6 +141,7 @@
+
@@ -95,27 +168,6 @@
-
Recurring Donations
donation.donation
@@ -169,43 +221,4 @@
-
-
-
-
-
-
- opendons.recurring_donation_configuration list
- opendons.recurring_donation_configuration
-
-
-
-
-
-
-
-
-
- opendons.recurring_donation_configuration form
- opendons.recurring_donation_configuration
-
-
-
-
-
-
-
- configuration
- opendons.recurring_donation_configuration
- tree,form
-
-
-
-
\ No newline at end of file
diff --git a/views/settings.xml b/views/settings.xml
new file mode 100644
index 0000000..19e6919
--- /dev/null
+++ b/views/settings.xml
@@ -0,0 +1,55 @@
+
+
+
+ res.config.settings.view.form.inherit.opendons
+ res.config.settings
+
+
+
+
+
Recurring payment management
+
+
+
+
+
+
+
+
+
+ Settings
+ ir.actions.act_window
+ res.config.settings
+
+ form
+ inline
+ {'module':'opendons'}
+
+
+
+
\ No newline at end of file
diff --git a/views/template_pa.xml b/views/template_pa.xml
new file mode 100644
index 0000000..96ca4e9
--- /dev/null
+++ b/views/template_pa.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ opendons_template_pa Form
+ opendons.template_pa_letter
+
+
+
+
+
+
+
+
+ Recurring donation Templates
+ opendons.template_pa_letter
+ tree,form
+
+
+
+
+
\ No newline at end of file
diff --git a/wizard/__init__.py b/wizard/__init__.py
index 9db169a..0899386 100644
--- a/wizard/__init__.py
+++ b/wizard/__init__.py
@@ -1 +1,2 @@
-from . import operation_duplicate_wizard
\ No newline at end of file
+from . import operation_duplicate_wizard
+from . import recurring_donation_wizard
\ No newline at end of file
diff --git a/wizard/recurring_donation_wizard.py b/wizard/recurring_donation_wizard.py
new file mode 100644
index 0000000..26ab442
--- /dev/null
+++ b/wizard/recurring_donation_wizard.py
@@ -0,0 +1,17 @@
+from odoo import fields, models, _
+
+class RecurringDonationWizard(models.TransientModel):
+ _name = 'opendons.recurringdonation.wizard'
+ _description = 'recurring donation wizard'
+
+ stopped_reason=fields.Selection(string='Stop reason',selection=[('motif1', 'Motif 1'), ('motif2', 'Motif 2')])
+ donation_id=fields.Integer('donation id')
+
+
+ def stopRecurringDonation(self):
+
+ donation=self.env['donation.donation'].search([('id','=',self.donation_id)])
+ donation.recurring_template="stopped"
+ donation.stopped_reason=self.stopped_reason
+ donation.stopped_date=fields.Date.context_today(self)
+
\ No newline at end of file
diff --git a/wizard/recurring_donation_wizard.xml b/wizard/recurring_donation_wizard.xml
new file mode 100644
index 0000000..04b4fa7
--- /dev/null
+++ b/wizard/recurring_donation_wizard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+ donation.recurring.wizard
+ opendons.recurringdonation.wizard
+
+
+
+
+
+
+ Stop recurring donation
+ opendons.recurringdonation.wizard
+ form
+ new
+
+
+
+
+
+
\ No newline at end of file