|
|
@ -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 |