Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
1b01e0ffb5
@ -12,18 +12,17 @@ from accounts.general_ledger import make_gl_entries, delete_gl_entries
|
||||
|
||||
class StockController(AccountsController):
|
||||
def make_gl_entries(self):
|
||||
if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
return
|
||||
|
||||
warehouse_account = self.get_warehouse_account()
|
||||
|
||||
if self.doc.docstatus==1:
|
||||
gl_entries = self.get_gl_entries_for_stock(warehouse_account)
|
||||
make_gl_entries(gl_entries)
|
||||
else:
|
||||
if self.doc.docstatus == 2:
|
||||
delete_gl_entries(voucher_type=self.doc.doctype, voucher_no=self.doc.name)
|
||||
|
||||
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
warehouse_account = self.get_warehouse_account()
|
||||
|
||||
self.update_gl_entries_after(warehouse_account)
|
||||
if self.doc.docstatus==1:
|
||||
gl_entries = self.get_gl_entries_for_stock(warehouse_account)
|
||||
make_gl_entries(gl_entries)
|
||||
|
||||
self.update_gl_entries_after(warehouse_account)
|
||||
|
||||
def get_gl_entries_for_stock(self, warehouse_account=None, default_expense_account=None,
|
||||
default_cost_center=None):
|
||||
@ -91,15 +90,11 @@ class StockController(AccountsController):
|
||||
return stock_ledger
|
||||
|
||||
def get_warehouse_account(self):
|
||||
for d in webnotes.conn.sql("select name from tabWarehouse"):
|
||||
webnotes.bean("Warehouse", d[0]).save()
|
||||
|
||||
warehouse_account = dict(webnotes.conn.sql("""select master_name, name from tabAccount
|
||||
where account_type = 'Warehouse' and ifnull(master_name, '') != ''"""))
|
||||
return warehouse_account
|
||||
|
||||
def update_gl_entries_after(self, warehouse_account=None):
|
||||
from accounts.utils import get_stock_and_account_difference
|
||||
future_stock_vouchers = self.get_future_stock_vouchers()
|
||||
gle = self.get_voucherwise_gl_entries(future_stock_vouchers)
|
||||
if not warehouse_account:
|
||||
|
@ -4,5 +4,7 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.delete_doc("DocType", "Sales and Purchase Return Item")
|
||||
webnotes.delete_doc("DocType", "Sales and Purchase Return Tool")
|
||||
if webnotes.conn.exists("DocType", "Sales and Purchase Return Item"):
|
||||
webnotes.delete_doc("DocType", "Sales and Purchase Return Item")
|
||||
if webnotes.conn.exists("DocType", "Sales and Purchase Return Tool"):
|
||||
webnotes.delete_doc("DocType", "Sales and Purchase Return Tool")
|
@ -11,6 +11,7 @@ def execute():
|
||||
and docstatus=2""" % (entry['voucher_type'], "%s"), entry['voucher_no'])
|
||||
is_cancelled = docstatus and 'Yes' or None
|
||||
if is_cancelled:
|
||||
print entry['voucher_type'], entry['voucher_no']
|
||||
webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'Yes'
|
||||
where voucher_type = %s and voucher_no = %s""",
|
||||
(entry['voucher_type'], entry['voucher_no']))
|
||||
|
@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
def execute():
|
||||
from patches.march_2013 import p06_remove_sales_purchase_return_tool
|
||||
p06_remove_sales_purchase_return_tool.execute()
|
9
patches/october_2013/p04_update_report_permission.py
Normal file
9
patches/october_2013/p04_update_report_permission.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.conn.sql("""update tabDocPerm set `create`=1 where
|
||||
parent='Report'
|
||||
and role in ('Administrator', 'Report Manager', 'System Manager')""")
|
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
def execute():
|
||||
import webnotes
|
||||
entries = webnotes.conn.sql("""select voucher_type, voucher_no
|
||||
from `tabGL Entry` group by voucher_type, voucher_no""", as_dict=1)
|
||||
for entry in entries:
|
||||
try:
|
||||
cancelled_voucher = webnotes.conn.sql("""select name from `tab%s` where name = %s
|
||||
and docstatus=2""" % (entry['voucher_type'], "%s"), entry['voucher_no'])
|
||||
if cancelled_voucher:
|
||||
webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type = %s and
|
||||
voucher_no = %s""", (entry['voucher_type'], entry['voucher_no']))
|
||||
except:
|
||||
pass
|
@ -224,4 +224,7 @@ patch_list = [
|
||||
"patches.october_2013.repost_planned_qty",
|
||||
"patches.october_2013.p02_update_price_list_and_item_details_in_item_price",
|
||||
"execute:webnotes.delete_doc('Report', 'Item-wise Price List')",
|
||||
"patches.october_2013.p03_remove_sales_and_purchase_return_tool",
|
||||
"patches.october_2013.p04_update_report_permission",
|
||||
"patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers",
|
||||
]
|
@ -167,6 +167,11 @@ wn.module_page["Selling"] = [
|
||||
right: true,
|
||||
icon: "icon-list",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Lead Details"),
|
||||
route: "query-report/Lead Details",
|
||||
doctype: "Lead"
|
||||
},
|
||||
{
|
||||
"label":wn._("Customer Addresses And Contacts"),
|
||||
route: "query-report/Customer Addresses And Contacts",
|
||||
|
0
selling/report/lead_details/__init__.py
Normal file
0
selling/report/lead_details/__init__.py
Normal file
22
selling/report/lead_details/lead_details.txt
Normal file
22
selling/report/lead_details/lead_details.txt
Normal file
@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-10-22 11:58:16",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-10-22 12:08:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
|
||||
"ref_doctype": "Lead",
|
||||
"report_name": "Lead Details",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Lead Details"
|
||||
}
|
||||
]
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-02 17:53:24",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-06 11:22:22",
|
||||
"modified": "2013-10-23 10:22:44",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -175,13 +175,6 @@
|
||||
"options": "Standard\nClassic\nModern\nSpartan",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "hr",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "HR",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
|
@ -13,8 +13,11 @@ def repost():
|
||||
"""
|
||||
webnotes.conn.auto_commit_on_many_writes = 1
|
||||
|
||||
for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
|
||||
repost_stock(d[0], d[1])
|
||||
for d in webnotes.conn.sql("""select distinct item_code, warehouse from
|
||||
(select item_code, warehouse from tabBin
|
||||
union
|
||||
select item_code, warehouse from `tabStock Ledger Entry`) a"""):
|
||||
repost_stock(d[0], d[1])
|
||||
|
||||
webnotes.conn.auto_commit_on_many_writes = 0
|
||||
|
||||
@ -31,7 +34,10 @@ def repost_stock(item_code, warehouse):
|
||||
|
||||
def repost_actual_qty(item_code, warehouse):
|
||||
from stock.stock_ledger import update_entries_after
|
||||
update_entries_after({ "item_code": item_code, "warehouse": warehouse })
|
||||
try:
|
||||
update_entries_after({ "item_code": item_code, "warehouse": warehouse })
|
||||
except:
|
||||
pass
|
||||
|
||||
def get_reserved_qty(item_code, warehouse):
|
||||
reserved_qty = webnotes.conn.sql("""
|
||||
|
Loading…
Reference in New Issue
Block a user