Browse Source

[FIX] call the set_effective_cooperator parent function only in case of

deferred payment method
pull/1/head
houssine 7 years ago
parent
commit
599d06aba5
  1. 5
      easy_my_coop/models/account_invoice.py
  2. 9
      easy_my_coop_online_payment/models/coop.py

5
easy_my_coop/models/account_invoice.py

@ -62,8 +62,8 @@ class account_invoice(models.Model):
@api.multi
def confirm_paid(self):
super(account_invoice, self).confirm_paid()
for invoice in self:
super(account_invoice, invoice).confirm_paid()
if invoice.partner_id.cooperator and invoice.release_capital_request and invoice.type == 'out_invoice':
effective_date = datetime.now().strftime("%d/%m/%Y")
#take the effective date from the payment. by default the confirmation date is the payment date
@ -72,7 +72,8 @@ class account_invoice(models.Model):
effective_date = move_line.date
invoice.subscription_request.state = 'paid'
# payment_transaction = self.env['payment.transaction'].search([('release_capital_request','=',invoice.id)])
# if len(payment_transaction) == 0:
invoice.post_process_confirm_paid(effective_date)
return True

9
easy_my_coop_online_payment/models/coop.py

@ -10,4 +10,13 @@ class SubscriptionRequest(models.Model):
def send_capital_release_request(self, invoice):
if self.payment_type == 'deferred':
super(SubscriptionRequest, self).send_capital_release_request(invoice)
return True
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
def post_process_confirm_paid(self, effective_date):
if self.payment_type == 'deferred':
self.set_cooperator_effective(effective_date)
return True
Loading…
Cancel
Save