当前位置: 首页>>代码示例>>Python>>正文


Python webnotes.get_obj函数代码示例

本文整理汇总了Python中webnotes.get_obj函数的典型用法代码示例。如果您正苦于以下问题:Python get_obj函数的具体用法?Python get_obj怎么用?Python get_obj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_obj函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

def execute():
	import webnotes
	webnotes.reload_doc("buying", "doctype", "purchase_order_item")
	webnotes.reload_doc("stock", "doctype", "purchase_receipt_item")
	for pi in webnotes.conn.sql("""select name from `tabPurchase Invoice` where docstatus = 1"""):
		webnotes.get_obj("Purchase Invoice", pi[0], 
			with_children=1).update_qty(change_modified=False)
开发者ID:antaryaami,项目名称:erpnext,代码行数:7,代码来源:p06_update_billed_amt_po_pr.py

示例2: reconcile_against_document

def reconcile_against_document(args):
	"""
		Cancel JV, Update aginst document, split if required and resubmit jv
	"""
	for d in args:
		check_if_jv_modified(d)

		against_fld = {
			'Journal Voucher' : 'against_jv',
			'Sales Invoice' : 'against_invoice',
			'Purchase Invoice' : 'against_voucher'
		}
		
		d['against_fld'] = against_fld[d['against_voucher_type']]

		# cancel JV
		jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children=1)
		jv_obj.make_gl_entries(cancel=1, adv_adj=1)
		
		# update ref in JV Detail
		update_against_doc(d, jv_obj)

		# re-submit JV
		jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children =1)
		jv_obj.make_gl_entries(cancel = 0, adv_adj =1)
开发者ID:robertbecht,项目名称:erpnext,代码行数:25,代码来源:utils.py

示例3: execute

def execute():
	import webnotes
	webnotes.reload_doc('stock', 'doctype', 'packed_item')
	for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
		webnotes.get_obj("Sales Invoice", si[0], 
			with_children=1).update_qty(change_modified=False)
		webnotes.conn.commit()
开发者ID:Anirudh887,项目名称:erpnext,代码行数:7,代码来源:p07_repost_billed_amt_in_sales_cycle.py

示例4: execute

def execute():
	webnotes.reload_doc("stock", "doctype", "delivery_note_item")
	webnotes.reload_doc("accounts", "doctype", "sales_invoice_item")

	webnotes.conn.auto_commit_on_many_writes = True
	for company in webnotes.conn.sql("select name from `tabCompany`"):
		stock_ledger_entries = webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
			voucher_detail_no, posting_date, posting_time, stock_value, 
			warehouse, actual_qty as qty from `tabStock Ledger Entry` 
			where ifnull(`is_cancelled`, "No") = "No" and company = %s
			order by item_code desc, warehouse desc, 
			posting_date desc, posting_time desc, name desc""", company[0], as_dict=True)
		
		dn_list = webnotes.conn.sql("""select name from `tabDelivery Note` 
			where docstatus < 2 and company = %s""", company[0])
		
		for dn in dn_list:
			dn = webnotes.get_obj("Delivery Note", dn[0], with_children = 1)
			dn.set_buying_amount(stock_ledger_entries)
		
		si_list = webnotes.conn.sql("""select name from `tabSales Invoice` 
			where docstatus < 2	and company = %s""", company[0])
		for si in si_list:
			si = webnotes.get_obj("Sales Invoice", si[0], with_children = 1)
			si.set_buying_amount(stock_ledger_entries)
		
	webnotes.conn.auto_commit_on_many_writes = False
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:27,代码来源:p03_update_buying_amount.py

示例5: insert_entries

	def insert_entries(self, opts, row):
		"""Insert Stock Ledger Entries"""		
		args = webnotes._dict({
			"doctype": "Stock Ledger Entry",
			"item_code": row.item_code,
			"warehouse": row.warehouse,
			"posting_date": self.doc.posting_date,
			"posting_time": self.doc.posting_time,
			"voucher_type": self.doc.doctype,
			"voucher_no": self.doc.name,
			"company": self.doc.company,
			"is_cancelled": "No",
			"voucher_detail_no": row.voucher_detail_no
		})
		args.update(opts)
		# create stock ledger entry
		sle_wrapper = webnotes.bean([args])
		sle_wrapper.ignore_permissions = 1
		sle_wrapper.insert()
		
		# update bin
		webnotes.get_obj('Warehouse', row.warehouse).update_bin(args)
		
		# append to entries
		self.entries.append(args)
开发者ID:PhamThoTam,项目名称:erpnext,代码行数:25,代码来源:stock_reconciliation.py

示例6: reconcile_against_document

def reconcile_against_document(args):
    """
		Cancel JV, Update aginst document, split if required and resubmit jv
	"""
    for d in args:
        check_if_jv_modified(d)

        against_fld = {
            "Journal Voucher": "against_jv",
            "Sales Invoice": "against_invoice",
            "Purchase Invoice": "against_voucher",
        }

        d["against_fld"] = against_fld[d["against_voucher_type"]]

        # cancel JV
        jv_obj = webnotes.get_obj("Journal Voucher", d["voucher_no"], with_children=1)
        jv_obj.make_gl_entries(cancel=1, adv_adj=1)

        # update ref in JV Detail
        update_against_doc(d, jv_obj)

        # re-submit JV
        jv_obj = webnotes.get_obj("Journal Voucher", d["voucher_no"], with_children=1)
        jv_obj.make_gl_entries(cancel=0, adv_adj=1)
开发者ID:nivawebs,项目名称:erpnext,代码行数:25,代码来源:utils.py

示例7: check_budget

def check_budget(gl_map, cancel):
    for gle in gl_map:
        if gle.get("cost_center"):
            # check budget only if account is expense account
            acc_details = webnotes.conn.get_value("Account", gle["account"], ["is_pl_account", "debit_or_credit"])
            if acc_details[0] == "Yes" and acc_details[1] == "Debit":
                webnotes.get_obj("Budget Control").check_budget(gle, cancel)
开发者ID:rohitw1991,项目名称:latestadberp,代码行数:7,代码来源:general_ledger.py

示例8: _update_requested_qty

def _update_requested_qty(controller, mr_obj, mr_items):
    """update requested qty (before ordered_qty is updated)"""
    for mr_item_name in mr_items:
        mr_item = mr_obj.doclist.getone({"parentfield": "indent_details", "name": mr_item_name})
        se_detail = controller.doclist.getone(
            {"parentfield": "mtn_details", "material_request": mr_obj.doc.name, "material_request_item": mr_item_name}
        )

        mr_item.ordered_qty = flt(mr_item.ordered_qty)
        mr_item.qty = flt(mr_item.qty)
        se_detail.transfer_qty = flt(se_detail.transfer_qty)

        if (
            se_detail.docstatus == 2
            and mr_item.ordered_qty > mr_item.qty
            and se_detail.transfer_qty == mr_item.ordered_qty
        ):
            add_indented_qty = mr_item.qty
        elif se_detail.docstatus == 1 and mr_item.ordered_qty + se_detail.transfer_qty > mr_item.qty:
            add_indented_qty = mr_item.qty - mr_item.ordered_qty
        else:
            add_indented_qty = se_detail.transfer_qty

        webnotes.get_obj("Warehouse", se_detail.t_warehouse).update_bin(
            {
                "item_code": se_detail.item_code,
                "indented_qty": (se_detail.docstatus == 2 and 1 or -1) * add_indented_qty,
                "posting_date": controller.doc.posting_date,
            }
        )
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:30,代码来源:material_request.py

示例9: execute

def execute():
	si_no_gle = webnotes.conn.sql("""select si.name from `tabSales Invoice` si 
		where docstatus=1 and not exists(select name from `tabGL Entry` 
			where voucher_type='Sales Invoice' and voucher_no=si.name) 
		and modified >= '2013-08-01'""")

	for si in si_no_gle:
		webnotes.get_obj("Sales Invoice", si[0]).make_gl_entries()
开发者ID:Jdfkat,项目名称:erpnext,代码行数:8,代码来源:p01_make_gl_entries_for_si.py

示例10: check_budget

def check_budget(gl_map, cancel):
	for gle in gl_map:
		if gle.get('cost_center'):
			#check budget only if account is expense account
			acc_details = webnotes.conn.get_value("Account", gle['account'], 
				['is_pl_account', 'debit_or_credit'])
			if acc_details[0]=="Yes" and acc_details[1]=="Debit":
				webnotes.get_obj('Budget Control').check_budget(gle, cancel)
开发者ID:hfeeki,项目名称:erpnext,代码行数:8,代码来源:general_ledger.py

示例11: run_on_trash

def run_on_trash(doctype, name, doclist):
	# call on_trash if required
	if doclist:
		obj = webnotes.get_obj(doclist=doclist)
	else:
		obj = webnotes.get_obj(doctype, name)

	if hasattr(obj,'on_trash'):
		obj.on_trash()
开发者ID:alvz,项目名称:wnframework,代码行数:9,代码来源:utils.py

示例12: set_as_default

	def set_as_default(self):
		webnotes.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
		webnotes.get_obj("Global Defaults").on_update()
		
		# clear cache
		webnotes.clear_cache()
		
		msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
			Please refresh your browser for the change to take effect."""))
开发者ID:BillTheBest,项目名称:erpnext,代码行数:9,代码来源:fiscal_year.py

示例13: update_user_default

	def update_user_default(self):
		if self.doc.user_id:
			webnotes.conn.set_default("employee", self.doc.name, self.doc.user_id)
			webnotes.conn.set_default("employee_name", self.doc.employee_name, self.doc.user_id)
			webnotes.conn.set_default("company", self.doc.company, self.doc.user_id)
			
			# add employee role if missing
			if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
				where parent=%s""", self.doc.user_id):
				webnotes.get_obj("Profile", self.doc.user_id).add_role("Employee")
开发者ID:robertbecht,项目名称:erpnext,代码行数:10,代码来源:employee.py

示例14: on_update

	def on_update(self):
		# reset birthday reminders
		if cint(self.doc.stop_birthday_reminders) != self.original_stop_birthday_reminders:
			webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
		
			if not self.doc.stop_birthday_reminders:
				for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and 
					ifnull(date_of_birth, '')!=''"""):
					webnotes.get_obj("Employee", employee).update_dob_event()
					
			webnotes.msgprint(webnotes._("Updated Birthday Reminders"))
开发者ID:mxmo-co,项目名称:erpnext,代码行数:11,代码来源:hr_settings.py

示例15: test_block_list

	def test_block_list(self):
		import webnotes
		webnotes.conn.set_value("Employee", "_T-Employee-0001", "department", 
			"_Test Department with Block List")
		
		application = webnotes.model_wrapper(test_records[1])
		application.doc.from_date = "2013-01-01"
		application.doc.to_date = "2013-01-05"
		self.assertRaises(LeaveDayBlockedError, application.insert)
		
		webnotes.session.user = "[email protected]"
		webnotes.get_obj("Profile", "[email protected]").add_role("HR User")
		self.assertTrue(application.insert())
开发者ID:robertbecht,项目名称:erpnext,代码行数:13,代码来源:test_leave_application.py


注:本文中的webnotes.get_obj函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。