mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
Rename fields: initial commit
This commit is contained in:
@@ -135,8 +135,8 @@ var set_print_hide= function(doc, cdt, cdn){
|
||||
if (doc.print_without_amount) {
|
||||
dn_fields['currency'].print_hide = 1;
|
||||
dn_item_fields['export_rate'].print_hide = 1;
|
||||
dn_item_fields['adj_rate'].print_hide = 1;
|
||||
dn_item_fields['ref_rate'].print_hide = 1;
|
||||
dn_item_fields['discount_percentage'].print_hide = 1;
|
||||
dn_item_fields['price_list_rate'].print_hide = 1;
|
||||
dn_item_fields['export_amount'].print_hide = 1;
|
||||
} else {
|
||||
if (dn_fields_copy['currency'].print_hide != 1)
|
||||
|
||||
@@ -242,12 +242,12 @@ class DocType(SellingController):
|
||||
def update_reserved_qty(self, d):
|
||||
if d['reserved_qty'] < 0 :
|
||||
# Reduce reserved qty from reserved warehouse mentioned in so
|
||||
if not d["reserved_warehouse"]:
|
||||
if not d["warehouse"]:
|
||||
webnotes.throw(_("Reserved Warehouse is missing in Sales Order"))
|
||||
|
||||
args = {
|
||||
"item_code": d['item_code'],
|
||||
"warehouse": d["reserved_warehouse"],
|
||||
"warehouse": d["warehouse"],
|
||||
"voucher_type": self.doc.doctype,
|
||||
"voucher_no": self.doc.name,
|
||||
"reserved_qty": (self.doc.docstatus==1 and 1 or -1)*flt(d['reserved_qty']),
|
||||
|
||||
@@ -52,7 +52,7 @@ cur_frm.fields_dict['default_bom'].get_query = function(doc) {
|
||||
|
||||
// Expense Account
|
||||
// ---------------------------------
|
||||
cur_frm.fields_dict['purchase_account'].get_query = function(doc) {
|
||||
cur_frm.fields_dict['expense_account'].get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'debit_or_credit': "Debit",
|
||||
@@ -76,7 +76,7 @@ cur_frm.fields_dict['default_income_account'].get_query = function(doc) {
|
||||
|
||||
// Purchase Cost Center
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict['cost_center'].get_query = function(doc) {
|
||||
cur_frm.fields_dict['buying_cost_center'].get_query = function(doc) {
|
||||
return {
|
||||
filters:{ 'group_or_ledger': "Ledger" }
|
||||
}
|
||||
@@ -85,7 +85,7 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc) {
|
||||
|
||||
// Sales Cost Center
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) {
|
||||
cur_frm.fields_dict['selling_cost_center'].get_query = function(doc) {
|
||||
return {
|
||||
filters:{ 'group_or_ledger': "Ledger" }
|
||||
}
|
||||
|
||||
@@ -310,8 +310,8 @@ def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
|
||||
# get last purchase order item details
|
||||
last_purchase_order = webnotes.conn.sql("""\
|
||||
select po.name, po.transaction_date, po.conversion_rate,
|
||||
po_item.conversion_factor, po_item.purchase_ref_rate,
|
||||
po_item.discount_rate, po_item.purchase_rate
|
||||
po_item.conversion_factor, po_item.base_price_list_rate,
|
||||
po_item.discount_percentage, po_item.purchase_rate
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||
where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and
|
||||
po.name = po_item.parent
|
||||
@@ -321,7 +321,7 @@ def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
|
||||
# get last purchase receipt item details
|
||||
last_purchase_receipt = webnotes.conn.sql("""\
|
||||
select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
|
||||
pr_item.conversion_factor, pr_item.purchase_ref_rate, pr_item.discount_rate,
|
||||
pr_item.conversion_factor, pr_item.base_price_list_rate, pr_item.discount_percentage,
|
||||
pr_item.purchase_rate
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
|
||||
@@ -351,15 +351,15 @@ def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
|
||||
|
||||
conversion_factor = flt(last_purchase.conversion_factor)
|
||||
out = webnotes._dict({
|
||||
"purchase_ref_rate": flt(last_purchase.purchase_ref_rate) / conversion_factor,
|
||||
"base_price_list_rate": flt(last_purchase.base_price_list_rate) / conversion_factor,
|
||||
"purchase_rate": flt(last_purchase.purchase_rate) / conversion_factor,
|
||||
"discount_rate": flt(last_purchase.discount_rate),
|
||||
"discount_percentage": flt(last_purchase.discount_percentage),
|
||||
"purchase_date": purchase_date
|
||||
})
|
||||
|
||||
conversion_rate = flt(conversion_rate) or 1.0
|
||||
out.update({
|
||||
"import_ref_rate": out.purchase_ref_rate / conversion_rate,
|
||||
"price_list_rate": out.base_price_list_rate / conversion_rate,
|
||||
"import_rate": out.purchase_rate / conversion_rate,
|
||||
"rate": out.purchase_rate
|
||||
})
|
||||
|
||||
@@ -81,7 +81,7 @@ test_records = [
|
||||
"stock_uom": "_Test UOM",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"selling_cost_center": "_Test Cost Center - _TC",
|
||||
}, {
|
||||
"doctype": "Item Reorder",
|
||||
@@ -111,7 +111,7 @@ test_records = [
|
||||
"stock_uom": "_Test UOM",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC"
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC"
|
||||
}],
|
||||
[{
|
||||
"doctype": "Item",
|
||||
@@ -121,7 +121,7 @@ test_records = [
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@@ -148,7 +148,7 @@ test_records = [
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@@ -169,7 +169,7 @@ test_records = [
|
||||
"description": "_Test Sales BOM Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_stock_item": "No",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@@ -191,7 +191,7 @@ test_records = [
|
||||
"is_stock_item": "Yes",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
@@ -268,7 +268,7 @@ test_records = [
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@@ -291,7 +291,7 @@ test_records = [
|
||||
"is_stock_item": "Yes",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"purchase_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
|
||||
@@ -17,7 +17,7 @@ test_records = [
|
||||
"doctype": "Item Price",
|
||||
"price_list": "_Test Price List",
|
||||
"item_code": "_Test Item",
|
||||
"ref_rate": 100
|
||||
"price_list_rate": 100
|
||||
}
|
||||
]
|
||||
]
|
||||
@@ -65,7 +65,7 @@ def make_packing_list(obj, item_table_fieldname):
|
||||
parent_items = []
|
||||
for d in obj.doclist.get({"parentfield": item_table_fieldname}):
|
||||
warehouse = (item_table_fieldname == "sales_order_details") \
|
||||
and d.reserved_warehouse or d.warehouse
|
||||
and d.warehouse or d.warehouse
|
||||
if webnotes.conn.get_value("Sales BOM", {"new_item_code": d.item_code}):
|
||||
for i in get_sales_bom_items(d.item_code):
|
||||
update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty),
|
||||
|
||||
@@ -373,7 +373,7 @@ class DocType(StockController):
|
||||
def get_item_details(self, arg):
|
||||
arg = json.loads(arg)
|
||||
item = webnotes.conn.sql("""select stock_uom, description, item_name,
|
||||
purchase_account, cost_center from `tabItem`
|
||||
expense_account, buying_cost_center from `tabItem`
|
||||
where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00'
|
||||
or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
|
||||
if not item:
|
||||
@@ -384,9 +384,9 @@ class DocType(StockController):
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'description' : item and item[0]['description'] or '',
|
||||
'item_name' : item and item[0]['item_name'] or '',
|
||||
'expense_account' : item and item[0]['purchase_account'] or arg.get("expense_account") \
|
||||
'expense_account' : item and item[0]['expense_account'] or arg.get("expense_account") \
|
||||
or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"),
|
||||
'cost_center' : item and item[0]['cost_center'] or arg.get("cost_center"),
|
||||
'cost_center' : item and item[0]['buying_cost_center'] or arg.get("cost_center"),
|
||||
'qty' : 0,
|
||||
'transfer_qty' : 0,
|
||||
'conversion_factor' : 1,
|
||||
@@ -464,7 +464,7 @@ class DocType(StockController):
|
||||
# add finished good item to Stock Entry Detail table -- along with bom_no
|
||||
if self.doc.production_order and self.doc.purpose == "Manufacture/Repack":
|
||||
item = webnotes.conn.get_value("Item", pro_obj.doc.production_item, ["item_name",
|
||||
"description", "stock_uom", "purchase_account", "cost_center"], as_dict=1)
|
||||
"description", "stock_uom", "expense_account", "buying_cost_center"], as_dict=1)
|
||||
self.add_to_stock_entry_detail({
|
||||
cstr(pro_obj.doc.production_item): {
|
||||
"to_warehouse": pro_obj.doc.fg_warehouse,
|
||||
@@ -473,8 +473,8 @@ class DocType(StockController):
|
||||
"item_name": item.item_name,
|
||||
"description": item.description,
|
||||
"stock_uom": item.stock_uom,
|
||||
"expense_account": item.purchase_account,
|
||||
"cost_center": item.cost_center,
|
||||
"expense_account": item.expense_account,
|
||||
"cost_center": item.buying_cost_center,
|
||||
}
|
||||
}, bom_no=pro_obj.doc.bom_no, idx=idx)
|
||||
|
||||
@@ -483,7 +483,7 @@ class DocType(StockController):
|
||||
self.doc.from_warehouse = ""
|
||||
|
||||
item = webnotes.conn.sql("""select name, item_name, description,
|
||||
stock_uom, purchase_account, cost_center from `tabItem`
|
||||
stock_uom, expense_account, buying_cost_center from `tabItem`
|
||||
where name=(select item from tabBOM where name=%s)""",
|
||||
self.doc.bom_no, as_dict=1)
|
||||
self.add_to_stock_entry_detail({
|
||||
@@ -493,8 +493,8 @@ class DocType(StockController):
|
||||
"description": item[0]["description"],
|
||||
"stock_uom": item[0]["stock_uom"],
|
||||
"from_warehouse": "",
|
||||
"expense_account": item[0].purchase_account,
|
||||
"cost_center": item[0].cost_center,
|
||||
"expense_account": item[0].expense_account,
|
||||
"cost_center": item[0].buying_cost_center,
|
||||
}
|
||||
}, bom_no=self.doc.bom_no, idx=idx)
|
||||
|
||||
@@ -911,7 +911,7 @@ def make_return_jv_from_purchase_receipt(se, ref):
|
||||
|
||||
ref_item = ref_item[0]
|
||||
|
||||
account = ref_item.expense_head
|
||||
account = ref_item.expense_account
|
||||
|
||||
if account not in children:
|
||||
children.append(account)
|
||||
|
||||
@@ -480,7 +480,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
pi.doc.posting_date = pr.doc.posting_date
|
||||
pi.doc.credit_to = "_Test Supplier - _TC"
|
||||
for d in pi.doclist.get({"parentfield": "entries"}):
|
||||
d.expense_head = "_Test Account Cost for Goods Sold - _TC"
|
||||
d.expense_account = "_Test Account Cost for Goods Sold - _TC"
|
||||
d.cost_center = "_Test Cost Center - _TC"
|
||||
|
||||
for d in pi.doclist.get({"parentfield": "other_charges"}):
|
||||
@@ -583,7 +583,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
pi.doc.posting_date = pr.doc.posting_date
|
||||
pi.doc.credit_to = "_Test Supplier - _TC"
|
||||
for d in pi.doclist.get({"parentfield": "entries"}):
|
||||
d.expense_head = "_Test Account Cost for Goods Sold - _TC"
|
||||
d.expense_account = "_Test Account Cost for Goods Sold - _TC"
|
||||
d.cost_center = "_Test Cost Center - _TC"
|
||||
for d in pi.doclist.get({"parentfield": "other_charges"}):
|
||||
d.cost_center = "_Test Cost Center - _TC"
|
||||
|
||||
@@ -132,7 +132,7 @@ def get_basic_details(args, item_bean):
|
||||
"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
|
||||
"income_account": item.default_income_account or args.income_account \
|
||||
or webnotes.conn.get_value("Company", args.company, "default_income_account"),
|
||||
"expense_account": item.purchase_account or args.expense_account \
|
||||
"expense_account": item.expense_account or args.expense_account \
|
||||
or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
|
||||
"cost_center": item.selling_cost_center \
|
||||
if args.transaction_type == "selling" else args.buying_cost_center,
|
||||
@@ -165,7 +165,7 @@ def get_price_list_rate(args, item_bean, out):
|
||||
validate_conversion_rate(args, meta)
|
||||
|
||||
price_list_rate = webnotes.conn.get_value("Item Price",
|
||||
{"price_list": args.price_list, "item_code": args.item_code}, "ref_rate")
|
||||
{"price_list": args.price_list, "item_code": args.item_code}, "price_list_rate")
|
||||
|
||||
if not price_list_rate: return {}
|
||||
|
||||
@@ -223,7 +223,7 @@ def validate_conversion_rate(args, meta):
|
||||
# discount = flt(res[0][0])
|
||||
# break
|
||||
#
|
||||
# return {"adj_rate": discount}
|
||||
# return {"discount_percentage": discount}
|
||||
|
||||
def get_party_item_code(args, item_bean, out):
|
||||
if args.transaction_type == "selling":
|
||||
|
||||
@@ -58,7 +58,7 @@ def get_price_list():
|
||||
rate = {}
|
||||
|
||||
price_list = webnotes.conn.sql("""select ip.item_code, ip.buying, ip.selling,
|
||||
concat(ip.price_list, " - ", ip.currency, " ", ip.ref_rate) as price
|
||||
concat(ip.price_list, " - ", ip.currency, " ", ip.price_list_rate) as price
|
||||
from `tabItem Price` ip, `tabPrice List` pl
|
||||
where ip.price_list=pl.name and pl.enabled=1""", as_dict=1)
|
||||
|
||||
@@ -86,8 +86,8 @@ def get_last_purchase_rate():
|
||||
po_item.item_code,
|
||||
po_item.item_name,
|
||||
po.transaction_date as posting_date,
|
||||
po_item.purchase_ref_rate,
|
||||
po_item.discount_rate,
|
||||
po_item.base_price_list_rate,
|
||||
po_item.discount_percentage,
|
||||
po_item.purchase_rate
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||
where po.name = po_item.parent and po.docstatus = 1)
|
||||
@@ -96,8 +96,8 @@ def get_last_purchase_rate():
|
||||
pr_item.item_code,
|
||||
pr_item.item_name,
|
||||
pr.posting_date,
|
||||
pr_item.purchase_ref_rate,
|
||||
pr_item.discount_rate,
|
||||
pr_item.base_price_list_rate,
|
||||
pr_item.discount_percentage,
|
||||
pr_item.purchase_rate
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.name = pr_item.parent and pr.docstatus = 1)
|
||||
|
||||
Reference in New Issue
Block a user