Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6b59ef082 | ||
|
|
dbbba659a8 | ||
|
|
3c3719fa9c | ||
|
|
a7af1d619e | ||
|
|
18eb8c5f68 | ||
|
|
fe977289eb | ||
|
|
45b5b6d11f | ||
|
|
c58b330673 | ||
|
|
5d976ca3ac | ||
|
|
f2f17959ab | ||
|
|
53f7ba26f6 | ||
|
|
1969f9e1ac | ||
|
|
60fcce66f7 |
@@ -654,7 +654,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
def _test_recurring_invoice(self, base_si, first_and_last_day):
|
||||
from webnotes.utils import add_months, get_last_day
|
||||
from accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices
|
||||
from accounts.doctype.sales_invoice.sales_invoice \
|
||||
import manage_recurring_invoices, get_next_date
|
||||
|
||||
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
|
||||
|
||||
@@ -662,7 +663,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
|
||||
where recurring_id=%s and docstatus=1""", base_si.doc.recurring_id)[0][0])
|
||||
|
||||
next_date = add_months(base_si.doc.posting_date, no_of_months)
|
||||
next_date = get_next_date(base_si.doc.posting_date, no_of_months,
|
||||
base_si.doc.repeat_on_day_of_month)
|
||||
|
||||
manage_recurring_invoices(next_date=next_date, commit=False)
|
||||
|
||||
|
||||
@@ -113,9 +113,8 @@ class AccountsReceivableReport(object):
|
||||
if not hasattr(self, "account_map"):
|
||||
self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select
|
||||
acc.name, cust.name as customer, cust.customer_name, cust.territory
|
||||
from `tabAccount` acc, `tabCustomer` cust
|
||||
where acc.master_type="Customer"
|
||||
and cust.name=acc.master_name""", as_dict=True)))
|
||||
from `tabAccount` acc left join `tabCustomer` cust
|
||||
on cust.name=acc.master_name where acc.master_type="Customer" """, as_dict=True)))
|
||||
|
||||
return self.account_map
|
||||
|
||||
@@ -134,7 +133,6 @@ class AccountsReceivableReport(object):
|
||||
self.gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||
where docstatus < 2 {0} order by posting_date, account""".format(conditions),
|
||||
values, as_dict=True)
|
||||
|
||||
return self.gl_entries
|
||||
|
||||
def prepare_conditions(self):
|
||||
|
||||
@@ -356,20 +356,23 @@ def get_actual_expense(args):
|
||||
and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s
|
||||
""" % (args))[0][0]
|
||||
|
||||
def rename_account_for(dt, olddn, newdn, merge):
|
||||
def rename_account_for(dt, olddn, newdn, merge, company):
|
||||
old_account = get_account_for(dt, olddn)
|
||||
if old_account:
|
||||
new_account = None
|
||||
if not merge:
|
||||
if old_account == olddn:
|
||||
new_account = webnotes.rename_doc("Account", olddn, newdn)
|
||||
if old_account == add_abbr_if_missing(olddn, company):
|
||||
new_account = webnotes.rename_doc("Account", old_account, newdn)
|
||||
else:
|
||||
existing_new_account = get_account_for(dt, newdn)
|
||||
new_account = webnotes.rename_doc("Account", old_account,
|
||||
existing_new_account or newdn, merge=True if existing_new_account else False)
|
||||
|
||||
if new_account:
|
||||
webnotes.conn.set_value("Account", new_account, "master_name", newdn)
|
||||
webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn)
|
||||
|
||||
def add_abbr_if_missing(dn, company):
|
||||
from setup.doctype.company.company import get_name_with_abbr
|
||||
return get_name_with_abbr(dn, company)
|
||||
|
||||
def get_account_for(account_for_doctype, account_for):
|
||||
if account_for_doctype in ["Customer", "Supplier"]:
|
||||
|
||||
@@ -161,7 +161,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def before_rename(self, olddn, newdn, merge=False):
|
||||
from accounts.utils import rename_account_for
|
||||
rename_account_for("Supplier", olddn, newdn, merge)
|
||||
rename_account_for("Supplier", olddn, newdn, merge, self.doc.company)
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
set_field = ''
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"app_name": "ERPNext",
|
||||
"app_version": "3.8.0",
|
||||
"app_version": "3.8.2",
|
||||
"base_template": "app/portal/templates/base.html",
|
||||
"modules": {
|
||||
"Accounts": {
|
||||
@@ -74,5 +74,5 @@
|
||||
"type": "module"
|
||||
}
|
||||
},
|
||||
"requires_framework_version": "==3.9.0"
|
||||
"requires_framework_version": "==3.9.1"
|
||||
}
|
||||
@@ -4,14 +4,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
|
||||
def execute():
|
||||
serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where docstatus=0
|
||||
and status in ('Available', 'Sales Returned') and ifnull(warehouse, '') = ''""")
|
||||
for sr in serial_nos:
|
||||
try:
|
||||
sr_bean = webnotes.bean("Serial No", sr[0])
|
||||
sr_bean.make_controller().via_stock_ledger = True
|
||||
sr_bean.save()
|
||||
last_sle = webnotes.bean("Serial No", sr[0]).make_controller().get_last_sle()
|
||||
if last_sle.actual_qty > 0:
|
||||
webnotes.conn.set_value("Serial No", sr[0], "warehouse", last_sle.warehouse)
|
||||
|
||||
webnotes.conn.commit()
|
||||
except:
|
||||
pass
|
||||
@@ -156,7 +156,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def before_rename(self, olddn, newdn, merge=False):
|
||||
from accounts.utils import rename_account_for
|
||||
rename_account_for("Customer", olddn, newdn, merge)
|
||||
rename_account_for("Customer", olddn, newdn, merge, self.doc.company)
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
set_field = ''
|
||||
|
||||
@@ -87,8 +87,6 @@ class DocType(StockController):
|
||||
self.doc.status = "Sales Returned"
|
||||
else:
|
||||
self.doc.status = "Available"
|
||||
if not self.doc.warehouse:
|
||||
self.doc.warehouse = last_sle.warehouse
|
||||
else:
|
||||
if document_type == "Purchase Return":
|
||||
self.doc.status = "Purchase Returned"
|
||||
|
||||
@@ -102,7 +102,7 @@ class DocType:
|
||||
webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
|
||||
|
||||
from accounts.utils import rename_account_for
|
||||
rename_account_for("Warehouse", olddn, newdn, merge)
|
||||
rename_account_for("Warehouse", olddn, newdn, merge, self.doc.company)
|
||||
|
||||
return newdn
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class DocType:
|
||||
def send_form_sms(self, arg):
|
||||
"called from client side"
|
||||
args = load_json(arg)
|
||||
self.send_sms([str(args['number'])], str(args['message']))
|
||||
self.send_sms([cstr(args['number'])], cstr(args['message']))
|
||||
|
||||
def send_sms(self, receiver_list, msg, sender_name = ''):
|
||||
receiver_list = self.validate_receiver_nos(receiver_list)
|
||||
|
||||
Reference in New Issue
Block a user