mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
chore: Drop old patches
v7 backup was restored and upgraded to latest v10.x.x branch. The patches run uptil the upgrade are removed in this change. This means only existing v10 sites are allowed direct upgrade to v13 and newer
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
# 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():
|
||||
return
|
||||
# country = get_country_info(country="Turkey")
|
||||
# add_country_and_currency("Turkey", country)
|
||||
@@ -1,11 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
return
|
||||
# frappe.reload_doc('website', 'doctype', 'style_settings')
|
||||
# style_settings = frappe.get_doc("Style Settings", "Style Settings")
|
||||
# if not style_settings.apply_style:
|
||||
# style_settings.update(default_properties)
|
||||
# style_settings.apply_style = 1
|
||||
# style_settings.save()
|
||||
@@ -1,14 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
cancelled_invoices = frappe.db.sql_list("""select name from `tabSales Invoice`
|
||||
where docstatus = 2 and ifnull(update_stock, 0) = 1""")
|
||||
|
||||
if cancelled_invoices:
|
||||
frappe.db.sql("""delete from `tabGL Entry`
|
||||
where voucher_type = 'Sales Invoice' and voucher_no in (%s)"""
|
||||
% (', '.join(['%s']*len(cancelled_invoices))), tuple(cancelled_invoices))
|
||||
@@ -1,23 +0,0 @@
|
||||
# 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():
|
||||
old_formats = ("Sales Invoice", "Sales Invoice Spartan", "Sales Invoice Modern",
|
||||
"Sales Invoice Classic",
|
||||
"Sales Order Spartan", "Sales Order Modern", "Sales Order Classic",
|
||||
"Purchase Order Spartan", "Purchase Order Modern", "Purchase Order Classic",
|
||||
"Quotation Spartan", "Quotation Modern", "Quotation Classic",
|
||||
"Delivery Note Spartan", "Delivery Note Modern", "Delivery Note Classic")
|
||||
|
||||
for fmt in old_formats:
|
||||
# update property setter
|
||||
for ps in frappe.db.sql_list("""select name from `tabProperty Setter`
|
||||
where property='default_print_format' and value=%s""", fmt):
|
||||
ps = frappe.get_doc("Property Setter", ps)
|
||||
ps.value = "Standard"
|
||||
ps.save(ignore_permissions = True)
|
||||
|
||||
frappe.delete_doc_if_exists("Print Format", fmt)
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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
|
||||
from frappe.modules import scrub, get_doctype_module
|
||||
|
||||
def execute():
|
||||
for dt in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
|
||||
frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
|
||||
frappe.db.sql("""update `tab{0}` set base_discount_amount=discount_amount,
|
||||
discount_amount=discount_amount/conversion_rate""".format(dt))
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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():
|
||||
for d in frappe.db.sql("""select name from `tabAccount`
|
||||
where ifnull(master_type, '') not in ('Customer', 'Supplier', 'Employee', '') and docstatus=0"""):
|
||||
ac = frappe.get_doc("Account", d[0])
|
||||
ac.master_type = None
|
||||
ac.save()
|
||||
@@ -1,54 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
|
||||
def execute():
|
||||
from erpnext.stock.stock_balance import repost
|
||||
repost(allow_zero_rate=True, only_actual=True)
|
||||
|
||||
frappe.reload_doctype("Account")
|
||||
|
||||
warehouse_account = frappe.db.sql("""select name, master_name from tabAccount
|
||||
where ifnull(account_type, '') = 'Warehouse'""")
|
||||
if warehouse_account:
|
||||
warehouses = [d[1] for d in warehouse_account]
|
||||
accounts = [d[0] for d in warehouse_account]
|
||||
|
||||
stock_vouchers = frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no
|
||||
from `tabStock Ledger Entry` sle
|
||||
where sle.warehouse in (%s)
|
||||
order by sle.posting_date""" %
|
||||
', '.join(['%s']*len(warehouses)), tuple(warehouses))
|
||||
|
||||
rejected = []
|
||||
for voucher_type, voucher_no in stock_vouchers:
|
||||
stock_bal = frappe.db.sql("""select sum(stock_value_difference) from `tabStock Ledger Entry`
|
||||
where voucher_type=%s and voucher_no =%s and warehouse in (%s)""" %
|
||||
('%s', '%s', ', '.join(['%s']*len(warehouses))), tuple([voucher_type, voucher_no] + warehouses))
|
||||
|
||||
account_bal = frappe.db.sql("""select ifnull(sum(ifnull(debit, 0) - ifnull(credit, 0)), 0)
|
||||
from `tabGL Entry`
|
||||
where voucher_type=%s and voucher_no =%s and account in (%s)
|
||||
group by voucher_type, voucher_no""" %
|
||||
('%s', '%s', ', '.join(['%s']*len(accounts))), tuple([voucher_type, voucher_no] + accounts))
|
||||
|
||||
if stock_bal and account_bal and abs(flt(stock_bal[0][0]) - flt(account_bal[0][0])) > 0.1:
|
||||
try:
|
||||
print(voucher_type, voucher_no, stock_bal[0][0], account_bal[0][0])
|
||||
|
||||
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 as e:
|
||||
print(frappe.get_traceback())
|
||||
rejected.append([voucher_type, voucher_no])
|
||||
frappe.db.rollback()
|
||||
|
||||
print("Failed to repost: ")
|
||||
print(rejected)
|
||||
@@ -1,41 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
sales_orders = frappe.db.sql("""select name from `tabSales Order`
|
||||
where docstatus = 1 and ifnull(is_recurring, 0) = 1
|
||||
and (per_delivered > 0 or per_billed > 0)""", as_dict=1)
|
||||
|
||||
for so in sales_orders:
|
||||
if not frappe.db.exists("Delivery Note Item", {"against_sales_order": so.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabSales Order` set per_delivered = 0,
|
||||
delivery_status = 'Not Delivered' where name = %s""", so.name)
|
||||
frappe.db.sql("""update `tabSales Order Item` set delivered_qty = 0
|
||||
where parent = %s""", so.name)
|
||||
|
||||
if not frappe.db.exists("Sales Invoice Item", {"sales_order": so.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabSales Order` set per_billed = 0,
|
||||
billing_status = 'Not Billed' where name = %s""", so.name)
|
||||
frappe.db.sql("""update `tabSales Order Item` set billed_amt = 0
|
||||
where parent = %s""", so.name)
|
||||
|
||||
purchase_orders = frappe.db.sql("""select name from `tabPurchase Order`
|
||||
where docstatus = 1 and ifnull(is_recurring, 0) = 1
|
||||
and (per_received > 0 or per_billed > 0)""", as_dict=1)
|
||||
|
||||
for po in purchase_orders:
|
||||
if not frappe.db.exists("Purchase Receipt Item", {"prevdoc_doctype": "Purchase Order",
|
||||
"prevdoc_docname": po.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabPurchase Order` set per_received = 0
|
||||
where name = %s""", po.name)
|
||||
frappe.db.sql("""update `tabPurchase Order Item` set received_qty = 0
|
||||
where parent = %s""", po.name)
|
||||
|
||||
if not frappe.db.exists("Purchase Invoice Item", {"purchase_order": po.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabPurchase Order` set per_billed = 0
|
||||
where name = %s""", po.name)
|
||||
frappe.db.sql("""update `tabPurchase Order Item` set billed_amt = 0
|
||||
where parent = %s""", po.name)
|
||||
@@ -1,117 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("accounts", "doctype", "account")
|
||||
frappe.reload_doc("setup", "doctype", "company")
|
||||
frappe.reload_doc("accounts", "doctype", "gl_entry")
|
||||
frappe.reload_doc("accounts", "doctype", "journal_entry_account")
|
||||
receivable_payable_accounts = create_receivable_payable_account()
|
||||
if receivable_payable_accounts:
|
||||
set_party_in_jv_and_gl_entry(receivable_payable_accounts)
|
||||
delete_individual_party_account()
|
||||
remove_customer_supplier_account_report()
|
||||
|
||||
def create_receivable_payable_account():
|
||||
receivable_payable_accounts = frappe._dict()
|
||||
|
||||
def _create_account(args):
|
||||
if args["parent_account"] and frappe.db.exists("Account", args["parent_account"]):
|
||||
account_id = frappe.db.get_value("Account",
|
||||
{"account_name": args["account_name"], "company": args["company"]})
|
||||
if not account_id:
|
||||
account = frappe.new_doc("Account")
|
||||
account.is_group = 0
|
||||
account.update(args)
|
||||
account.insert()
|
||||
|
||||
account_id = account.name
|
||||
|
||||
frappe.db.set_value("Company", args["company"], ("default_receivable_account"
|
||||
if args["account_type"]=="Receivable" else "default_payable_account"), account_id)
|
||||
|
||||
receivable_payable_accounts.setdefault(args["company"], {}).setdefault(args["account_type"], account_id)
|
||||
|
||||
for company in frappe.db.sql_list("select name from tabCompany"):
|
||||
_create_account({
|
||||
"account_name": "Debtors",
|
||||
"account_type": "Receivable",
|
||||
"company": company,
|
||||
"parent_account": get_parent_account(company, "Customer")
|
||||
})
|
||||
|
||||
_create_account({
|
||||
"account_name": "Creditors",
|
||||
"account_type": "Payable",
|
||||
"company": company,
|
||||
"parent_account": get_parent_account(company, "Supplier")
|
||||
})
|
||||
|
||||
return receivable_payable_accounts
|
||||
|
||||
def get_parent_account(company, master_type):
|
||||
parent_account = None
|
||||
|
||||
if "receivables_group" in frappe.db.get_table_columns("Company"):
|
||||
parent_account = frappe.get_cached_value('Company', company,
|
||||
"receivables_group" if master_type=="Customer" else "payables_group")
|
||||
if not parent_account:
|
||||
parent_account = frappe.db.get_value("Account", {"company": company,
|
||||
"account_name": "Accounts Receivable" if master_type=="Customer" else "Accounts Payable"})
|
||||
|
||||
if not parent_account:
|
||||
parent_account = frappe.db.sql_list("""select parent_account from tabAccount
|
||||
where company=%s and ifnull(master_type, '')=%s and ifnull(master_name, '')!='' limit 1""",
|
||||
(company, master_type))
|
||||
parent_account = parent_account[0][0] if parent_account else None
|
||||
|
||||
return parent_account
|
||||
|
||||
def set_party_in_jv_and_gl_entry(receivable_payable_accounts):
|
||||
accounts = frappe.db.sql("""select name, master_type, master_name, company from `tabAccount`
|
||||
where ifnull(master_type, '') in ('Customer', 'Supplier') and ifnull(master_name, '') != ''""", as_dict=1)
|
||||
|
||||
account_map = frappe._dict()
|
||||
for d in accounts:
|
||||
account_map.setdefault(d.name, d)
|
||||
|
||||
if not account_map:
|
||||
return
|
||||
|
||||
for dt in ["Journal Entry Account", "GL Entry"]:
|
||||
records = frappe.db.sql("""select name, account from `tab%s`
|
||||
where account in (%s) and ifnull(party, '') = '' and docstatus < 2""" %
|
||||
(dt, ", ".join(['%s']*len(account_map))), tuple(account_map.keys()), as_dict=1)
|
||||
for i, d in enumerate(records):
|
||||
account_details = account_map.get(d.account, {})
|
||||
account_type = "Receivable" if account_details.get("master_type")=="Customer" else "Payable"
|
||||
new_account = receivable_payable_accounts[account_details.get("company")][account_type]
|
||||
|
||||
frappe.db.sql("update `tab{0}` set account=%s, party_type=%s, party=%s where name=%s".format(dt),
|
||||
(new_account, account_details.get("master_type"), account_details.get("master_name"), d.name))
|
||||
|
||||
if i%500 == 0:
|
||||
frappe.db.commit()
|
||||
|
||||
def delete_individual_party_account():
|
||||
frappe.db.sql("""delete from `tabAccount`
|
||||
where ifnull(master_type, '') in ('Customer', 'Supplier')
|
||||
and ifnull(master_name, '') != ''
|
||||
and not exists(select gle.name from `tabGL Entry` gle
|
||||
where gle.account = tabAccount.name)""")
|
||||
|
||||
accounts_not_deleted = frappe.db.sql_list("""select tabAccount.name from `tabAccount`
|
||||
where ifnull(master_type, '') in ('Customer', 'Supplier')
|
||||
and ifnull(master_name, '') != ''
|
||||
and exists(select gle.name from `tabGL Entry` gle where gle.account = tabAccount.name)""")
|
||||
|
||||
if accounts_not_deleted:
|
||||
print("Accounts not deleted: " + "\n".join(accounts_not_deleted))
|
||||
|
||||
|
||||
def remove_customer_supplier_account_report():
|
||||
for d in ["Customer Account Head", "Supplier Account Head"]:
|
||||
frappe.delete_doc("Report", d)
|
||||
@@ -1,16 +0,0 @@
|
||||
# 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():
|
||||
for d in frappe.db.sql("select name from `tabBOM` where docstatus < 2"):
|
||||
try:
|
||||
document = frappe.get_doc('BOM', d[0])
|
||||
if document.docstatus == 1:
|
||||
document.flags.ignore_validate_update_after_submit = True
|
||||
document.calculate_cost()
|
||||
document.save()
|
||||
except:
|
||||
pass
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.stock_ledger import NegativeStockError
|
||||
|
||||
def execute():
|
||||
si_list = frappe.db.sql("""select distinct si.name
|
||||
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
||||
where si.name = si_item.parent and si.modified > '2015-02-16' and si.docstatus=1
|
||||
and ifnull(si_item.warehouse, '') = '' and ifnull(si.update_stock, 0) = 1
|
||||
order by posting_date, posting_time""", as_dict=1)
|
||||
|
||||
failed_list = []
|
||||
for si in si_list:
|
||||
try:
|
||||
si_doc = frappe.get_doc("Sales Invoice", si.name)
|
||||
si_doc.docstatus = 2
|
||||
si_doc.on_cancel()
|
||||
|
||||
si_doc.docstatus = 1
|
||||
si_doc.set_missing_item_details()
|
||||
si_doc.on_submit()
|
||||
frappe.db.commit()
|
||||
except:
|
||||
failed_list.append(si.name)
|
||||
frappe.local.stockledger_exceptions = None
|
||||
frappe.db.rollback()
|
||||
|
||||
print("Failed to repost: ", failed_list)
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# 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
|
||||
import json
|
||||
|
||||
def execute():
|
||||
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
|
||||
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
|
||||
|
||||
head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"]
|
||||
stock_reco_to_be_reposted = []
|
||||
for d in frappe.db.sql("""select name, reconciliation_json from `tabStock Reconciliation`
|
||||
where docstatus=1 and creation > '2014-03-01'""", as_dict=1):
|
||||
data = json.loads(d.reconciliation_json)
|
||||
for row in data[data.index(head_row)+1:]:
|
||||
if row[3] in ["", None]:
|
||||
stock_reco_to_be_reposted.append(d.name)
|
||||
break
|
||||
|
||||
for dn in stock_reco_to_be_reposted:
|
||||
reco = frappe.get_doc("Stock Reconciliation", dn)
|
||||
reco.docstatus = 2
|
||||
reco.on_cancel()
|
||||
|
||||
reco.docstatus = 1
|
||||
reco.validate()
|
||||
reco.on_submit()
|
||||
|
||||
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
|
||||
@@ -1,17 +0,0 @@
|
||||
# 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():
|
||||
frappe.reload_doc('manufacturing', 'doctype', 'bom_operation')
|
||||
for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2""", as_dict=1):
|
||||
try:
|
||||
bom = frappe.get_doc('BOM', d.name)
|
||||
bom.flags.ignore_validate_update_after_submit = True
|
||||
bom.calculate_cost()
|
||||
bom.save()
|
||||
frappe.db.commit()
|
||||
except:
|
||||
frappe.db.rollback()
|
||||
@@ -1,9 +0,0 @@
|
||||
# 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():
|
||||
frappe.db.sql("""update `tabStock Entry` set purpose='Manufacture' where purpose='Manufacture/Repack' and ifnull(work_order,"")!="" """)
|
||||
frappe.db.sql("""update `tabStock Entry` set purpose='Repack' where purpose='Manufacture/Repack' and ifnull(work_order,"")="" """)
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
country = frappe.db.get_single_value("Global Defaults", "country")
|
||||
if not country:
|
||||
print("Country not specified in Global Defaults")
|
||||
return
|
||||
|
||||
for company in frappe.db.sql_list("""select name from `tabCompany`
|
||||
where ifnull(country, '')=''"""):
|
||||
frappe.db.set_value("Company", company, "country", country)
|
||||
@@ -1,65 +0,0 @@
|
||||
# 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():
|
||||
frappe.db.sql("update tabItem set has_batch_no = 0 where ifnull(has_batch_no, '') = ''")
|
||||
frappe.db.sql("update tabItem set has_serial_no = 0 where ifnull(has_serial_no, '') = ''")
|
||||
|
||||
item_list = frappe.db.sql("""select name, has_batch_no, has_serial_no from tabItem
|
||||
where is_stock_item = 1""", as_dict=1)
|
||||
|
||||
sle_count = get_sle_count()
|
||||
sle_with_batch = get_sle_with_batch()
|
||||
sle_with_serial = get_sle_with_serial()
|
||||
|
||||
batch_items = get_items_with_batch()
|
||||
serialized_items = get_items_with_serial()
|
||||
|
||||
for d in item_list:
|
||||
if d.has_batch_no == 1:
|
||||
if d.name not in batch_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_batch.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", 0)
|
||||
else:
|
||||
if d.name in batch_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_batch.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", 1)
|
||||
|
||||
if d.has_serial_no == 1:
|
||||
if d.name not in serialized_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_serial.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", 0)
|
||||
else:
|
||||
if d.name in serialized_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_serial.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", 1)
|
||||
|
||||
|
||||
def get_sle_count():
|
||||
sle_count = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry` group by item_code""", as_dict=1):
|
||||
sle_count.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_count
|
||||
|
||||
def get_sle_with_batch():
|
||||
sle_with_batch = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry`
|
||||
where ifnull(batch_no, '') != '' group by item_code""", as_dict=1):
|
||||
sle_with_batch.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_with_batch
|
||||
|
||||
|
||||
def get_sle_with_serial():
|
||||
sle_with_serial = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry`
|
||||
where ifnull(serial_no, '') != '' group by item_code""", as_dict=1):
|
||||
sle_with_serial.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_with_serial
|
||||
|
||||
def get_items_with_batch():
|
||||
return frappe.db.sql_list("select item from tabBatch")
|
||||
|
||||
def get_items_with_serial():
|
||||
return frappe.db.sql_list("select item_code from `tabSerial No`")
|
||||
@@ -1,9 +0,0 @@
|
||||
# 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():
|
||||
global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
|
||||
global_defaults.toggle_rounded_total()
|
||||
@@ -1,10 +0,0 @@
|
||||
# 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():
|
||||
frappe.reload_doc("stock", "doctype", "landed_cost_voucher")
|
||||
frappe.db.sql("""update `tabLanded Cost Voucher` set distribute_charges_based_on = 'Amount'
|
||||
where docstatus=1""")
|
||||
@@ -1,9 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for project in frappe.db.sql_list("select name from tabProject"):
|
||||
frappe.reload_doc("projects", "doctype", "project")
|
||||
p = frappe.get_doc("Project", project)
|
||||
p.update_milestones_completed()
|
||||
p.db_set("percent_milestones_completed", p.percent_milestones_completed)
|
||||
@@ -1,7 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
|
||||
frappe.db.sql("""update `tabSales Invoice` set from_date = invoice_period_from_date,
|
||||
to_date = invoice_period_to_date, is_recurring = convert_into_recurring_invoice""")
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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():
|
||||
frappe.db.sql("""update `tabStock Ledger Entry` sle, tabItem item
|
||||
set sle.stock_uom = item.stock_uom
|
||||
where sle.voucher_type="Delivery Note" and item.name = sle.item_code
|
||||
and sle.stock_uom != item.stock_uom""")
|
||||
Reference in New Issue
Block a user