Merge branch 'develop'
This commit is contained in:
commit
fc49c2c5f9
@ -2,7 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
__version__ = '7.0.5'
|
||||
__version__ = '7.0.6'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
@ -279,7 +279,7 @@ execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=
|
||||
erpnext.patches.v7_0.update_mins_to_first_response
|
||||
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
|
||||
erpnext.patches.v7_0.system_settings_setup_complete
|
||||
erpnext.patches.v7_0.set_naming_series_for_timesheet
|
||||
erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'project')
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'project_user')
|
||||
erpnext.patches.v7_0.convert_timelogbatch_to_timesheet
|
||||
@ -303,3 +303,4 @@ erpnext.patches.v7_0.migrate_schools_to_erpnext
|
||||
erpnext.patches.v7_0.remove_administrator_role_in_doctypes
|
||||
erpnext.patches.v7_0.rename_fee_amount_to_fee_component
|
||||
erpnext.patches.v7_0.calculate_total_costing_amount
|
||||
erpnext.patches.v7_0.fix_nonwarehouse_ledger_gl_entries_for_transactions
|
||||
|
@ -11,5 +11,6 @@ def execute():
|
||||
ts.update_cost()
|
||||
ts.calculate_total_amounts()
|
||||
ts.flags.ignore_validate = True
|
||||
ts.flags.ignore_mandatory = True
|
||||
ts.flags.ignore_validate_update_after_submit = True
|
||||
ts.save()
|
||||
|
@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
if not frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock"):
|
||||
return
|
||||
|
||||
frappe.reload_doctype("Account")
|
||||
|
||||
warehouses = frappe.db.sql_list("""select name from tabAccount
|
||||
where account_type = 'Stock' and is_group = 0
|
||||
and (warehouse is null or warehouse = '')""")
|
||||
if warehouses:
|
||||
warehouses = set_warehouse_for_stock_account(warehouses)
|
||||
|
||||
stock_vouchers = frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no
|
||||
from `tabStock Ledger Entry` sle
|
||||
where sle.warehouse in (%s) and creation > '2016-05-01'
|
||||
and not exists(select name from `tabGL Entry`
|
||||
where account=sle.warehosue and voucher_type=sle.voucher_type and voucher_no=sle.voucher_no)
|
||||
order by sle.posting_date""" %
|
||||
', '.join(['%s']*len(warehouses)), tuple(warehouses))
|
||||
|
||||
rejected = []
|
||||
for voucher_type, voucher_no in stock_vouchers:
|
||||
try:
|
||||
frappe.db.sql("""delete from `tabGL Entry`
|
||||
where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no))
|
||||
|
||||
voucher = frappe.get_doc(voucher_type, voucher_no)
|
||||
voucher.make_gl_entries()
|
||||
frappe.db.commit()
|
||||
except Exception, e:
|
||||
print frappe.get_traceback()
|
||||
rejected.append([voucher_type, voucher_no])
|
||||
frappe.db.rollback()
|
||||
|
||||
print rejected
|
||||
|
||||
def set_warehouse_for_stock_account(warehouse_account):
|
||||
for account in warehouse_account:
|
||||
if frappe.db.exists('Warehouse', account):
|
||||
frappe.db.set_value("Account", account, "warehouse", account)
|
||||
else:
|
||||
warehouse_account.remove(account)
|
||||
|
||||
return warehouse_account
|
@ -13,6 +13,6 @@ class FeeStructure(Document):
|
||||
def calculate_total(self):
|
||||
"""Calculates total amount."""
|
||||
self.total_amount = 0
|
||||
for d in self.amount:
|
||||
for d in self.components:
|
||||
self.total_amount += d.amount
|
||||
|
||||
|
@ -71,9 +71,11 @@ def get_conditions(filters):
|
||||
conditions += " and item_code = '%s'" % frappe.db.escape(filters.get("item_code"), percent=False)
|
||||
|
||||
if filters.get("warehouse"):
|
||||
lft, rgt = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"])
|
||||
conditions += " and exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(lft, rgt)
|
||||
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
||||
if warehouse_details:
|
||||
conditions += " and exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft,
|
||||
warehouse_details.rgt)
|
||||
|
||||
return conditions
|
||||
|
||||
|
@ -99,8 +99,10 @@ def get_opening_balance(filters, columns):
|
||||
return row
|
||||
|
||||
def get_warehouse_condition(warehouse):
|
||||
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
|
||||
|
||||
return " exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(lft, rgt)
|
||||
|
||||
warehouse_details = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"], as_dict=1)
|
||||
if warehouse_details:
|
||||
return " exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft,
|
||||
warehouse_details.rgt)
|
||||
|
||||
return ''
|
||||
|
@ -63,10 +63,12 @@ def get_bin_list(filters):
|
||||
conditions.append("item_code = '%s' "%filters.item_code)
|
||||
|
||||
if filters.warehouse:
|
||||
lft, rgt = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"])
|
||||
|
||||
conditions.append(" exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(lft, rgt))
|
||||
warehouse_details = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"], as_dict=1)
|
||||
|
||||
if warehouse_details:
|
||||
conditions.append(" exists (select name from `tabWarehouse` wh \
|
||||
where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(warehouse_details.lft,
|
||||
warehouse_details.rgt))
|
||||
|
||||
bin_list = frappe.db.sql("""select item_code, warehouse, actual_qty, planned_qty, indented_qty,
|
||||
ordered_qty, reserved_qty, reserved_qty_for_production, projected_qty
|
||||
|
Loading…
Reference in New Issue
Block a user