mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
frappe/frappe#478, fixed list passed in
This commit is contained in:
@@ -77,7 +77,7 @@ def save_entries(gl_map, adv_adj, update_outstanding):
|
|||||||
|
|
||||||
def make_entry(args, adv_adj, update_outstanding):
|
def make_entry(args, adv_adj, update_outstanding):
|
||||||
args.update({"doctype": "GL Entry"})
|
args.update({"doctype": "GL Entry"})
|
||||||
gle = frappe.get_doc([args])
|
gle = frappe.get_doc(args)
|
||||||
gle.ignore_permissions = 1
|
gle.ignore_permissions = 1
|
||||||
gle.insert()
|
gle.insert()
|
||||||
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
|
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def execute():
|
|||||||
else:
|
else:
|
||||||
item_group = d.item_group
|
item_group = d.item_group
|
||||||
|
|
||||||
frappe.get_doc([{
|
frappe.get_doc({
|
||||||
"doctype": "Pricing Rule",
|
"doctype": "Pricing Rule",
|
||||||
"apply_on": "Item Group",
|
"apply_on": "Item Group",
|
||||||
"item_group": item_group,
|
"item_group": item_group,
|
||||||
@@ -25,7 +25,7 @@ def execute():
|
|||||||
"customer": d.parent,
|
"customer": d.parent,
|
||||||
"price_or_discount": "Discount",
|
"price_or_discount": "Discount",
|
||||||
"discount_percentage": d.discount
|
"discount_percentage": d.discount
|
||||||
}]).insert()
|
}).insert()
|
||||||
|
|
||||||
frappe.db.auto_commit_on_many_writes = False
|
frappe.db.auto_commit_on_many_writes = False
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class Company(Document):
|
|||||||
|
|
||||||
def import_chart_of_account(self):
|
def import_chart_of_account(self):
|
||||||
chart = frappe.get_doc("Chart of Accounts", self.chart_of_accounts)
|
chart = frappe.get_doc("Chart of Accounts", self.chart_of_accounts)
|
||||||
chart.make_controller().create_accounts(self.name)
|
chart.create_accounts(self.name)
|
||||||
|
|
||||||
def add_acc(self,lst):
|
def add_acc(self,lst):
|
||||||
account = frappe.get_doc({
|
account = frappe.get_doc({
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
|||||||
title: frappe._("ERPNext Setup Guide"),
|
title: frappe._("ERPNext Setup Guide"),
|
||||||
welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
|
welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
|
||||||
<h2 class="text-center">'+frappe._('ERPNext Setup')+'</h2>\
|
<h2 class="text-center">'+frappe._('ERPNext Setup')+'</h2>\
|
||||||
<p class="text-center">' +
|
<p class="text-center" style="margin: 0px 100px">' +
|
||||||
frappe._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') +
|
frappe._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') +
|
||||||
'</p>',
|
'</p>',
|
||||||
working_html: '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
|
working_html: '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
|
||||||
|
|||||||
@@ -73,16 +73,16 @@ def update_user_name(args):
|
|||||||
|
|
||||||
def create_fiscal_year_and_company(args):
|
def create_fiscal_year_and_company(args):
|
||||||
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
|
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
|
||||||
frappe.get_doc([{
|
frappe.get_doc({
|
||||||
"doctype":"Fiscal Year",
|
"doctype":"Fiscal Year",
|
||||||
'year': curr_fiscal_year,
|
'year': curr_fiscal_year,
|
||||||
'year_start_date': args.get('fy_start_date'),
|
'year_start_date': args.get('fy_start_date'),
|
||||||
'year_end_date': args.get('fy_end_date'),
|
'year_end_date': args.get('fy_end_date'),
|
||||||
}]).insert()
|
}).insert()
|
||||||
|
|
||||||
print args
|
print args
|
||||||
# Company
|
# Company
|
||||||
frappe.get_doc([{
|
frappe.get_doc({
|
||||||
"doctype":"Company",
|
"doctype":"Company",
|
||||||
'domain': args.get("industry"),
|
'domain': args.get("industry"),
|
||||||
'company_name':args.get('company_name'),
|
'company_name':args.get('company_name'),
|
||||||
@@ -90,27 +90,23 @@ def create_fiscal_year_and_company(args):
|
|||||||
'default_currency':args.get('currency'),
|
'default_currency':args.get('currency'),
|
||||||
'country': args.get('country'),
|
'country': args.get('country'),
|
||||||
'chart_of_accounts': args.get(('chart_of_accounts')),
|
'chart_of_accounts': args.get(('chart_of_accounts')),
|
||||||
}]).insert()
|
}).insert()
|
||||||
|
|
||||||
args["curr_fiscal_year"] = curr_fiscal_year
|
args["curr_fiscal_year"] = curr_fiscal_year
|
||||||
|
|
||||||
def create_price_lists(args):
|
def create_price_lists(args):
|
||||||
for pl_type in ["Selling", "Buying"]:
|
for pl_type in ["Selling", "Buying"]:
|
||||||
frappe.get_doc([
|
frappe.get_doc({
|
||||||
{
|
|
||||||
"doctype": "Price List",
|
"doctype": "Price List",
|
||||||
"price_list_name": "Standard " + pl_type,
|
"price_list_name": "Standard " + pl_type,
|
||||||
"enabled": 1,
|
"enabled": 1,
|
||||||
"buying": 1 if pl_type == "Buying" else 0,
|
"buying": 1 if pl_type == "Buying" else 0,
|
||||||
"selling": 1 if pl_type == "Selling" else 0,
|
"selling": 1 if pl_type == "Selling" else 0,
|
||||||
"currency": args["currency"]
|
"currency": args["currency"],
|
||||||
},
|
"valid_for_territories": {
|
||||||
{
|
"territory": "All Territories"
|
||||||
"doctype": "Applicable Territory",
|
}
|
||||||
"parentfield": "valid_for_territories",
|
}).insert()
|
||||||
"territory": "All Territories"
|
|
||||||
}
|
|
||||||
]).insert()
|
|
||||||
|
|
||||||
def set_defaults(args):
|
def set_defaults(args):
|
||||||
# enable default currency
|
# enable default currency
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ def boot_session(bootinfo):
|
|||||||
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
|
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
|
||||||
|
|
||||||
def load_country_and_currency(bootinfo):
|
def load_country_and_currency(bootinfo):
|
||||||
if bootinfo.control_panel.country and \
|
country = frappe.db.get_default("country")
|
||||||
frappe.db.exists("Country", bootinfo.control_panel.country):
|
if country and frappe.db.exists("Country", country):
|
||||||
bootinfo["docs"] += [frappe.get_doc("Country", bootinfo.control_panel.country)]
|
bootinfo["docs"] += [frappe.get_doc("Country", country)]
|
||||||
|
|
||||||
bootinfo["docs"] += frappe.db.sql("""select * from tabCurrency
|
bootinfo["docs"] += frappe.db.sql("""select * from tabCurrency
|
||||||
where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
|
where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
|
||||||
|
|||||||
@@ -71,39 +71,40 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
|
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
|
||||||
|
|
||||||
def _insert_stock_entry(self, qty1, qty2):
|
def _insert_stock_entry(self, qty1, qty2):
|
||||||
se = frappe.get_doc([
|
se = frappe.get_doc({
|
||||||
{
|
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"doctype": "Stock Entry",
|
"doctype": "Stock Entry",
|
||||||
"posting_date": "2013-03-01",
|
"posting_date": "2013-03-01",
|
||||||
"posting_time": "00:00:00",
|
"posting_time": "00:00:00",
|
||||||
"purpose": "Material Receipt",
|
"purpose": "Material Receipt",
|
||||||
"fiscal_year": "_Test Fiscal Year 2013",
|
"fiscal_year": "_Test Fiscal Year 2013",
|
||||||
|
"mtn_details": [
|
||||||
|
{
|
||||||
|
"conversion_factor": 1.0,
|
||||||
|
"doctype": "Stock Entry Detail",
|
||||||
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
|
"parentfield": "mtn_details",
|
||||||
|
"incoming_rate": 100,
|
||||||
|
"qty": qty1,
|
||||||
|
"stock_uom": "_Test UOM 1",
|
||||||
|
"transfer_qty": qty1,
|
||||||
|
"uom": "_Test UOM 1",
|
||||||
|
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conversion_factor": 1.0,
|
||||||
|
"doctype": "Stock Entry Detail",
|
||||||
|
"item_code": "_Test Item Home Desktop 200",
|
||||||
|
"parentfield": "mtn_details",
|
||||||
|
"incoming_rate": 100,
|
||||||
|
"qty": qty2,
|
||||||
|
"stock_uom": "_Test UOM 1",
|
||||||
|
"transfer_qty": qty2,
|
||||||
|
"uom": "_Test UOM 1",
|
||||||
|
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"conversion_factor": 1.0,
|
|
||||||
"doctype": "Stock Entry Detail",
|
|
||||||
"item_code": "_Test Item Home Desktop 100",
|
|
||||||
"parentfield": "mtn_details",
|
|
||||||
"incoming_rate": 100,
|
|
||||||
"qty": qty1,
|
|
||||||
"stock_uom": "_Test UOM 1",
|
|
||||||
"transfer_qty": qty1,
|
|
||||||
"uom": "_Test UOM 1",
|
|
||||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"conversion_factor": 1.0,
|
|
||||||
"doctype": "Stock Entry Detail",
|
|
||||||
"item_code": "_Test Item Home Desktop 200",
|
|
||||||
"parentfield": "mtn_details",
|
|
||||||
"incoming_rate": 100,
|
|
||||||
"qty": qty2,
|
|
||||||
"stock_uom": "_Test UOM 1",
|
|
||||||
"transfer_qty": qty2,
|
|
||||||
"uom": "_Test UOM 1",
|
|
||||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
se.insert()
|
se.insert()
|
||||||
se.submit()
|
se.submit()
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ def update_serial_nos(sle, item_det):
|
|||||||
for serial_no in serial_nos:
|
for serial_no in serial_nos:
|
||||||
if frappe.db.exists("Serial No", serial_no):
|
if frappe.db.exists("Serial No", serial_no):
|
||||||
sr = frappe.get_doc("Serial No", serial_no)
|
sr = frappe.get_doc("Serial No", serial_no)
|
||||||
sr.make_controller().via_stock_ledger = True
|
sr.via_stock_ledger = True
|
||||||
sr.warehouse = sle.warehouse if sle.actual_qty > 0 else None
|
sr.warehouse = sle.warehouse if sle.actual_qty > 0 else None
|
||||||
sr.save()
|
sr.save()
|
||||||
elif sle.actual_qty > 0:
|
elif sle.actual_qty > 0:
|
||||||
@@ -284,7 +284,7 @@ def make_serial_no(serial_no, sle):
|
|||||||
sr.serial_no = serial_no
|
sr.serial_no = serial_no
|
||||||
sr.item_code = sle.item_code
|
sr.item_code = sle.item_code
|
||||||
sr.warehouse = None
|
sr.warehouse = None
|
||||||
sr.make_controller().via_stock_ledger = True
|
sr.via_stock_ledger = True
|
||||||
sr.insert()
|
sr.insert()
|
||||||
sr.warehouse = sle.warehouse
|
sr.warehouse = sle.warehouse
|
||||||
sr.status = "Available"
|
sr.status = "Available"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class StockLedger(Document):
|
|||||||
|
|
||||||
def make_entry(self, args):
|
def make_entry(self, args):
|
||||||
args.update({"doctype": "Stock Ledger Entry"})
|
args.update({"doctype": "Stock Ledger Entry"})
|
||||||
sle = frappe.get_doc([args])
|
sle = frappe.get_doc(args)
|
||||||
sle.ignore_permissions = 1
|
sle.ignore_permissions = 1
|
||||||
sle.insert()
|
sle.insert()
|
||||||
return sle.name
|
return sle.name
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class TestStockReconciliation(unittest.TestCase):
|
|||||||
frappe.db.sql("delete from `tabGL Entry`")
|
frappe.db.sql("delete from `tabGL Entry`")
|
||||||
|
|
||||||
def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
|
def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
|
||||||
stock_reco = frappe.get_doc([{
|
stock_reco = frappe.get_doc({
|
||||||
"doctype": "Stock Reconciliation",
|
"doctype": "Stock Reconciliation",
|
||||||
"posting_date": posting_date,
|
"posting_date": posting_date,
|
||||||
"posting_time": posting_time,
|
"posting_time": posting_time,
|
||||||
@@ -187,7 +187,7 @@ class TestStockReconciliation(unittest.TestCase):
|
|||||||
["Item Code", "Warehouse", "Quantity", "Valuation Rate"],
|
["Item Code", "Warehouse", "Quantity", "Valuation Rate"],
|
||||||
["_Test Item", "_Test Warehouse - _TC", qty, rate]
|
["_Test Item", "_Test Warehouse - _TC", qty, rate]
|
||||||
]),
|
]),
|
||||||
}])
|
})
|
||||||
stock_reco.insert()
|
stock_reco.insert()
|
||||||
stock_reco.submit()
|
stock_reco.submit()
|
||||||
return stock_reco
|
return stock_reco
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def set_as_cancel(voucher_type, voucher_no):
|
|||||||
|
|
||||||
def make_entry(args):
|
def make_entry(args):
|
||||||
args.update({"doctype": "Stock Ledger Entry"})
|
args.update({"doctype": "Stock Ledger Entry"})
|
||||||
sle = frappe.get_doc([args])
|
sle = frappe.get_doc(args)
|
||||||
sle.ignore_permissions = 1
|
sle.ignore_permissions = 1
|
||||||
sle.insert()
|
sle.insert()
|
||||||
sle.submit()
|
sle.submit()
|
||||||
@@ -137,11 +137,11 @@ def update_entries_after(args, verbose=1):
|
|||||||
# update bin
|
# update bin
|
||||||
if not frappe.db.exists({"doctype": "Bin", "item_code": args["item_code"],
|
if not frappe.db.exists({"doctype": "Bin", "item_code": args["item_code"],
|
||||||
"warehouse": args["warehouse"]}):
|
"warehouse": args["warehouse"]}):
|
||||||
bin_wrapper = frappe.get_doc([{
|
bin_wrapper = frappe.get_doc({
|
||||||
"doctype": "Bin",
|
"doctype": "Bin",
|
||||||
"item_code": args["item_code"],
|
"item_code": args["item_code"],
|
||||||
"warehouse": args["warehouse"],
|
"warehouse": args["warehouse"],
|
||||||
}])
|
})
|
||||||
bin_wrapper.ignore_permissions = 1
|
bin_wrapper.ignore_permissions = 1
|
||||||
bin_wrapper.insert()
|
bin_wrapper.insert()
|
||||||
|
|
||||||
|
|||||||
@@ -40,16 +40,15 @@ def get_latest_stock_balance():
|
|||||||
def get_bin(item_code, warehouse):
|
def get_bin(item_code, warehouse):
|
||||||
bin = frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
|
bin = frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
|
||||||
if not bin:
|
if not bin:
|
||||||
bin_wrapper = frappe.get_doc([{
|
bin_obj = frappe.get_doc({
|
||||||
"doctype": "Bin",
|
"doctype": "Bin",
|
||||||
"item_code": item_code,
|
"item_code": item_code,
|
||||||
"warehouse": warehouse,
|
"warehouse": warehouse,
|
||||||
}])
|
})
|
||||||
bin_wrapper.ignore_permissions = 1
|
bin_obj.ignore_permissions = 1
|
||||||
bin_wrapper.insert()
|
bin_obj.insert()
|
||||||
bin_obj = bin_wrapper.make_controller()
|
|
||||||
else:
|
else:
|
||||||
bin_obj = frappe.get_doc('Bin', bin)
|
bin_obj = frappe.get_doc('Bin', bin)
|
||||||
return bin_obj
|
return bin_obj
|
||||||
|
|
||||||
def update_bin(args):
|
def update_bin(args):
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class MaintenanceSchedule(TransactionBase):
|
|||||||
self.update_amc_date(serial_nos, d.end_date)
|
self.update_amc_date(serial_nos, d.end_date)
|
||||||
|
|
||||||
if d.sales_person not in email_map:
|
if d.sales_person not in email_map:
|
||||||
sp = frappe.get_doc("Sales Person", d.sales_person).make_controller()
|
sp = frappe.get_doc("Sales Person", d.sales_person)
|
||||||
email_map[d.sales_person] = sp.get_email_id()
|
email_map[d.sales_person] = sp.get_email_id()
|
||||||
|
|
||||||
scheduled_date = frappe.db.sql("""select scheduled_date from
|
scheduled_date = frappe.db.sql("""select scheduled_date from
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ def add_support_communication(subject, content, sender, docname=None, mail=None)
|
|||||||
ticket.ignore_permissions = True
|
ticket.ignore_permissions = True
|
||||||
ticket.save()
|
ticket.save()
|
||||||
else:
|
else:
|
||||||
ticket = frappe.get_doc([decode_dict({
|
ticket = frappe.get_doc(decode_dict({
|
||||||
"doctype":"Support Ticket",
|
"doctype":"Support Ticket",
|
||||||
"description": content,
|
"description": content,
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
"raised_by": sender,
|
"raised_by": sender,
|
||||||
"content_type": mail.content_type if mail else None,
|
"content_type": mail.content_type if mail else None,
|
||||||
"status": "Open",
|
"status": "Open",
|
||||||
})])
|
}))
|
||||||
ticket.ignore_permissions = True
|
ticket.ignore_permissions = True
|
||||||
ticket.ignore_mandatory = True
|
ticket.ignore_mandatory = True
|
||||||
ticket.insert()
|
ticket.insert()
|
||||||
|
|||||||
Reference in New Issue
Block a user