frappe/frappe#478, fixed list passed in
This commit is contained in:
parent
558a9aabfb
commit
a504f0638b
@ -77,7 +77,7 @@ def save_entries(gl_map, adv_adj, update_outstanding):
|
||||
|
||||
def make_entry(args, adv_adj, update_outstanding):
|
||||
args.update({"doctype": "GL Entry"})
|
||||
gle = frappe.get_doc([args])
|
||||
gle = frappe.get_doc(args)
|
||||
gle.ignore_permissions = 1
|
||||
gle.insert()
|
||||
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
|
||||
|
@ -17,7 +17,7 @@ def execute():
|
||||
else:
|
||||
item_group = d.item_group
|
||||
|
||||
frappe.get_doc([{
|
||||
frappe.get_doc({
|
||||
"doctype": "Pricing Rule",
|
||||
"apply_on": "Item Group",
|
||||
"item_group": item_group,
|
||||
@ -25,7 +25,7 @@ def execute():
|
||||
"customer": d.parent,
|
||||
"price_or_discount": "Discount",
|
||||
"discount_percentage": d.discount
|
||||
}]).insert()
|
||||
}).insert()
|
||||
|
||||
frappe.db.auto_commit_on_many_writes = False
|
||||
|
||||
|
@ -112,7 +112,7 @@ class Company(Document):
|
||||
|
||||
def import_chart_of_account(self):
|
||||
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):
|
||||
account = frappe.get_doc({
|
||||
|
@ -40,7 +40,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
title: frappe._("ERPNext Setup Guide"),
|
||||
welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
|
||||
<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!') +
|
||||
'</p>',
|
||||
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):
|
||||
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",
|
||||
'year': curr_fiscal_year,
|
||||
'year_start_date': args.get('fy_start_date'),
|
||||
'year_end_date': args.get('fy_end_date'),
|
||||
}]).insert()
|
||||
}).insert()
|
||||
|
||||
print args
|
||||
# Company
|
||||
frappe.get_doc([{
|
||||
frappe.get_doc({
|
||||
"doctype":"Company",
|
||||
'domain': args.get("industry"),
|
||||
'company_name':args.get('company_name'),
|
||||
@ -90,27 +90,23 @@ def create_fiscal_year_and_company(args):
|
||||
'default_currency':args.get('currency'),
|
||||
'country': args.get('country'),
|
||||
'chart_of_accounts': args.get(('chart_of_accounts')),
|
||||
}]).insert()
|
||||
}).insert()
|
||||
|
||||
args["curr_fiscal_year"] = curr_fiscal_year
|
||||
|
||||
def create_price_lists(args):
|
||||
for pl_type in ["Selling", "Buying"]:
|
||||
frappe.get_doc([
|
||||
{
|
||||
frappe.get_doc({
|
||||
"doctype": "Price List",
|
||||
"price_list_name": "Standard " + pl_type,
|
||||
"enabled": 1,
|
||||
"buying": 1 if pl_type == "Buying" else 0,
|
||||
"selling": 1 if pl_type == "Selling" else 0,
|
||||
"currency": args["currency"]
|
||||
},
|
||||
{
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
]).insert()
|
||||
"currency": args["currency"],
|
||||
"valid_for_territories": {
|
||||
"territory": "All Territories"
|
||||
}
|
||||
}).insert()
|
||||
|
||||
def set_defaults(args):
|
||||
# enable default currency
|
||||
|
@ -31,9 +31,9 @@ def boot_session(bootinfo):
|
||||
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
|
||||
|
||||
def load_country_and_currency(bootinfo):
|
||||
if bootinfo.control_panel.country and \
|
||||
frappe.db.exists("Country", bootinfo.control_panel.country):
|
||||
bootinfo["docs"] += [frappe.get_doc("Country", bootinfo.control_panel.country)]
|
||||
country = frappe.db.get_default("country")
|
||||
if country and frappe.db.exists("Country", country):
|
||||
bootinfo["docs"] += [frappe.get_doc("Country", country)]
|
||||
|
||||
bootinfo["docs"] += frappe.db.sql("""select * from tabCurrency
|
||||
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)
|
||||
|
||||
def _insert_stock_entry(self, qty1, qty2):
|
||||
se = frappe.get_doc([
|
||||
{
|
||||
se = frappe.get_doc({
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"posting_date": "2013-03-01",
|
||||
"posting_time": "00:00:00",
|
||||
"purpose": "Material Receipt",
|
||||
"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.submit()
|
||||
|
@ -264,7 +264,7 @@ def update_serial_nos(sle, item_det):
|
||||
for serial_no in serial_nos:
|
||||
if frappe.db.exists("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.save()
|
||||
elif sle.actual_qty > 0:
|
||||
@ -284,7 +284,7 @@ def make_serial_no(serial_no, sle):
|
||||
sr.serial_no = serial_no
|
||||
sr.item_code = sle.item_code
|
||||
sr.warehouse = None
|
||||
sr.make_controller().via_stock_ledger = True
|
||||
sr.via_stock_ledger = True
|
||||
sr.insert()
|
||||
sr.warehouse = sle.warehouse
|
||||
sr.status = "Available"
|
||||
|
@ -41,7 +41,7 @@ class StockLedger(Document):
|
||||
|
||||
def make_entry(self, args):
|
||||
args.update({"doctype": "Stock Ledger Entry"})
|
||||
sle = frappe.get_doc([args])
|
||||
sle = frappe.get_doc(args)
|
||||
sle.ignore_permissions = 1
|
||||
sle.insert()
|
||||
return sle.name
|
||||
|
@ -175,7 +175,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
frappe.db.sql("delete from `tabGL Entry`")
|
||||
|
||||
def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
|
||||
stock_reco = frappe.get_doc([{
|
||||
stock_reco = frappe.get_doc({
|
||||
"doctype": "Stock Reconciliation",
|
||||
"posting_date": posting_date,
|
||||
"posting_time": posting_time,
|
||||
@ -187,7 +187,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
["Item Code", "Warehouse", "Quantity", "Valuation Rate"],
|
||||
["_Test Item", "_Test Warehouse - _TC", qty, rate]
|
||||
]),
|
||||
}])
|
||||
})
|
||||
stock_reco.insert()
|
||||
stock_reco.submit()
|
||||
return stock_reco
|
||||
|
@ -49,7 +49,7 @@ def set_as_cancel(voucher_type, voucher_no):
|
||||
|
||||
def make_entry(args):
|
||||
args.update({"doctype": "Stock Ledger Entry"})
|
||||
sle = frappe.get_doc([args])
|
||||
sle = frappe.get_doc(args)
|
||||
sle.ignore_permissions = 1
|
||||
sle.insert()
|
||||
sle.submit()
|
||||
@ -137,11 +137,11 @@ def update_entries_after(args, verbose=1):
|
||||
# update bin
|
||||
if not frappe.db.exists({"doctype": "Bin", "item_code": args["item_code"],
|
||||
"warehouse": args["warehouse"]}):
|
||||
bin_wrapper = frappe.get_doc([{
|
||||
bin_wrapper = frappe.get_doc({
|
||||
"doctype": "Bin",
|
||||
"item_code": args["item_code"],
|
||||
"warehouse": args["warehouse"],
|
||||
}])
|
||||
})
|
||||
bin_wrapper.ignore_permissions = 1
|
||||
bin_wrapper.insert()
|
||||
|
||||
|
@ -40,16 +40,15 @@ def get_latest_stock_balance():
|
||||
def get_bin(item_code, warehouse):
|
||||
bin = frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
|
||||
if not bin:
|
||||
bin_wrapper = frappe.get_doc([{
|
||||
bin_obj = frappe.get_doc({
|
||||
"doctype": "Bin",
|
||||
"item_code": item_code,
|
||||
"warehouse": warehouse,
|
||||
}])
|
||||
bin_wrapper.ignore_permissions = 1
|
||||
bin_wrapper.insert()
|
||||
bin_obj = bin_wrapper.make_controller()
|
||||
})
|
||||
bin_obj.ignore_permissions = 1
|
||||
bin_obj.insert()
|
||||
else:
|
||||
bin_obj = frappe.get_doc('Bin', bin)
|
||||
bin_obj = frappe.get_doc('Bin', bin)
|
||||
return bin_obj
|
||||
|
||||
def update_bin(args):
|
||||
|
@ -58,7 +58,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
self.update_amc_date(serial_nos, d.end_date)
|
||||
|
||||
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()
|
||||
|
||||
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.save()
|
||||
else:
|
||||
ticket = frappe.get_doc([decode_dict({
|
||||
ticket = frappe.get_doc(decode_dict({
|
||||
"doctype":"Support Ticket",
|
||||
"description": content,
|
||||
"subject": subject,
|
||||
"raised_by": sender,
|
||||
"content_type": mail.content_type if mail else None,
|
||||
"status": "Open",
|
||||
})])
|
||||
}))
|
||||
ticket.ignore_permissions = True
|
||||
ticket.ignore_mandatory = True
|
||||
ticket.insert()
|
||||
|
Loading…
x
Reference in New Issue
Block a user