diff --git a/__manifest__.py b/__manifest__.py
index fba33a8..ef0630c 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -20,7 +20,7 @@
'version': '0.1',
# any module necessary for this one to work correctly
- 'depends': ['base','donation_recurring','website_sale'],
+ 'depends': ['base','base_iban','donation_recurring','website_sale','donation','donation_base','donation_direct_debit'],
# always loaded
'data': [
diff --git a/data/recurring_donation_configuration.xml b/data/recurring_donation_configuration.xml
new file mode 100644
index 0000000..17659b9
--- /dev/null
+++ b/data/recurring_donation_configuration.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ 5
+ 15
+
+
+
+
+
+
\ No newline at end of file
diff --git a/models/__init__.py b/models/__init__.py
index f5ad92c..4e88124 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -17,4 +17,4 @@ from . import duplicate
from . import template_rf
from . import donation_tax_receipt
from . import laposte_ref
-from . import res_partner_bank
\ No newline at end of file
+#from . import res_partner_bank
\ No newline at end of file
diff --git a/models/donation.py b/models/donation.py
index deb7a5e..9bd65da 100644
--- a/models/donation.py
+++ b/models/donation.py
@@ -73,16 +73,16 @@ class DonationDonation(models.Model):
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')
+ # 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')
+ # else:
+ # raise Warning('Please configure method sepa payment')
return res
@@ -218,7 +218,8 @@ class DonationDonation(models.Model):
apoo = self.env["account.payment.order"].sudo()
vals={}
vals['payment_mode_id']=payment_mode_id
- vals['sepa']=True
+
+
payorder = apoo.create(vals)
@@ -390,14 +391,25 @@ class DonationDonation(models.Model):
return
def recurring_donation_action(self):
+ 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:
+ payment_mode_id=sepa_payment_mode.id
+ else:
+ raise Warning('Please configure mode sepa payment')
+
+ else:
+ raise Warning('Please configure method sepa payment')
+
action = self.env.ref("opendons.donation_recurring_action").sudo().read([])[0]
action.update(
{
"res_model": 'donation.donation',
- "name": 'Prélèvements automatiques : mai 2022',
"view_mode": 'tree,form,pivot,graph',
- "context": {'default_recurring_template': 'active', 'recurring_view': True,'default_tax_receipt_option':'annual'},
+ "context": {'default_recurring_template': 'active', 'recurring_view': True,'default_payment_mode_id':payment_mode_id,
+ 'default_tax_receipt_option':'annual'},
"domain": [('recurring_template', '!=', False)]
}
)
@@ -406,16 +418,16 @@ class DonationDonation(models.Model):
def payment_order_action(self):
- payorder=self.env['account.payment.order'].search([('state','=','draft')],order='create_date desc', limit=2)
+ #payorder=self.env['account.payment.order'].search([('state','=','draft')],order='create_date desc', limit=2)
action = self.env.ref("account_payment_order.account_payment_order_inbound_action").sudo().read([])[0]
- action.update(
- {
- "view_mode": "form",
- "view_type":"list",
- "res_id": payorder[0].id if payorder[0].id else False
- }
- )
+ # action.update(
+ # {
+ # "view_mode": "tree",
+ # "view_type":"list",
+ # #"res_id": payorder[0].id if payorder[0].id else False
+ # }
+ # )
return action
\ No newline at end of file
diff --git a/models/res_partner_bank.py b/models/res_partner_bank.py
new file mode 100644
index 0000000..c31ca79
--- /dev/null
+++ b/models/res_partner_bank.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from odoo import api, fields, models, _
+from odoo.exceptions import UserError, ValidationError
+
+
+
+class ResPartnerBank(models.Model):
+ _inherit = "res.partner.bank"
+
+ @api.model
+ def create(self, values):
+ values['acc_type']='iban'
+ res = super(ResPartnerBank, self).create(values)
+
+ # here you can do accordingly
+ return res
+
+
+
+
+ # class ResPartnerBank(models.Model):
+ # _inherit = 'res.partner.bank'
+
+ # @api.onchange('acc_number')
+ # def _onchange_acc_number(self):
+ # #validation IBAN
+ # #https://www.regextester.com/115565
+ # if self.acc_number:
+
+ # regex = re.compile(r'(^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$)+')
+
+ # if not re.fullmatch(regex, self.acc_number):
+ # raise Warning('Invalid IBAN')
+
+ # @api.constrains('acc_number')
+ # def _onchange_acc_number(self):
+ # #validation IBAN
+ # #https://www.regextester.com/115565
+ # if self.acc_number:
+
+ # regex = re.compile(r'(^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$)+')
+
+ # if not re.fullmatch(regex, self.acc_number):
+
+ # raise Warning('Invalid IBAN')
+
+ # @api.onchange('acc_number')
+ # def _onchange_acc_number(self):
+ # #validation IBAN
+ # #https://www.regextester.com/115565
+ # if self.acc_number:
+
+ # regex = re.compile(r'(^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$)+')
+
+ # if not re.fullmatch(regex, self.acc_number):
+ # raise Warning('Invalid IBAN')
+
+ # @api.constrains('acc_number')
+ # def _onchange_acc_number(self):
+ # #validation IBAN
+ # #https://www.regextester.com/115565
+ # if self.acc_number:
+
+ # regex = re.compile(r'(^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$)+')
+
+ # if not re.fullmatch(regex, self.acc_number):
+
+ # raise Warning('Invalid IBAN')
\ No newline at end of file
diff --git a/views/donation.xml b/views/donation.xml
index 04b56ae..316b6f4 100644
--- a/views/donation.xml
+++ b/views/donation.xml
@@ -19,6 +19,7 @@
+
@@ -27,10 +28,7 @@
context.get('recurring_view')
-
-
-
-
+
@@ -38,6 +36,21 @@
+
+
+ opendons.donation.direct_debit.form
+ donation.donation
+
+
+
+
+ {'no_create_edit': True,'no_create': True}
+
+
+
+
+
+
@@ -107,9 +120,9 @@
Recurring Donations
donation.donation
tree,form,pivot,graph
- {'default_recurring_template': 'active', 'recurring_view': True,'default_tax_receipt_option':'annual','default_donation_date':time.strftime('%Y-%m-%d')}
+ >{'default_recurring_template': 'active', 'recurring_view': True,'default_tax_receipt_option':'annual','default_donation_date':time.strftime('%Y-%m-%d')} -->
[('recurring_template', '!=', False)]