Commit 34f303f1 authored by Charles-Henri Decultot's avatar Charles-Henri Decultot
Browse files

Merge branch 'staging'

parents 14195bb1 144d51ab
......@@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '1.3.10'
__version__ = '1.3.11'
def get_default_company(user=None):
'''Get default company for user'''
......
......@@ -134,11 +134,17 @@ class PaymentRequest(Document):
def check_if_immediate_payment_is_autorized(self):
try:
output = []
for gateway in self.payment_gateways:
result = self.check_immediate_payment_for_gateway(gateway.payment_gateway)
if self.payment_gateway:
result = self.check_immediate_payment_for_gateway(self.payment_gateway)
if result:
output.append(result)
else:
for gateway in self.payment_gateways:
result = self.check_immediate_payment_for_gateway(gateway.payment_gateway)
if result:
output.append(result)
return output or False
except Exception:
......
......@@ -104,6 +104,7 @@ class Subscription(Document):
self.generate_invoice(payment_entry=payment_entry)
elif not self.has_invoice_for_period() and self.period_has_passed(add_days(self.current_invoice_start, -1)):
self.generate_sales_order()
self.generate_invoice(payment_entry=payment_entry)
self.save()
......@@ -147,9 +148,11 @@ class Subscription(Document):
return data
def set_subscription_status(self):
if self.is_trial() and self.status != 'Trial':
if self.is_cancelled() and self.status != 'Cancelled':
self.db_set('status', 'Cancelled')
elif not self.is_cancelled() and self.is_trial() and self.status != 'Trial':
self.db_set('status', 'Trial')
elif not self.is_trial() and self.status != 'Cancelled':
elif not self.is_cancelled() and not self.is_trial() and self.status != 'Cancelled':
self.db_set('status', 'Active')
self.reload()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment