• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python code.get_obj函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make_single_entry

	def make_single_entry(self,parent,d,le_map,cancel, merge_entries):
		if self.get_val(le_map['account'], d, parent) and \
				(self.get_val(le_map['debit'], d, parent) \
				or self.get_val(le_map['credit'], d, parent)):
			flist = ['account', 'cost_center', 'against', 'debit', 'credit', 'remarks',
			 	'voucher_type', 'voucher_no', 'posting_date', 'fiscal_year', 'against_voucher',
			 	'against_voucher_type', 'company', 'is_opening', 'aging_date']

			# Check budget before gl entry
			#check budget only if account is expense account
			is_expense_acct = webnotes.conn.sql("""select name from tabAccount 
				where is_pl_account='Yes' and debit_or_credit='Debit' 
				and name=%s""",self.get_val(le_map['account'], d, parent))
				
			if is_expense_acct and self.get_val(le_map['cost_center'], d, parent):
				get_obj('Budget Control').check_budget([self.get_val(le_map[k], d, parent) 
					for k in flist if k in ['account', 'cost_center', 'debit', 
					'credit', 'posting_date', 'fiscal_year', 'company']],cancel)

			# Create new GL entry object and map values
			le = Document('GL Entry')
			for k in flist:
				le.fields[k] = self.get_val(le_map[k], d, parent)
			# if there is already an entry in this account then just add it to that entry
			same_head = self.check_if_in_list(le)
			if same_head and merge_entries:
				same_head = same_head[0]
				same_head.debit	= flt(same_head.debit)	+ flt(le.debit)
				same_head.credit = flt(same_head.credit) + flt(le.credit)
			else:
				self.entries.append(le)
开发者ID:MiteshC,项目名称:erpnext,代码行数:31,代码来源:gl_control.py


示例2: on_submit

	def on_submit(self):
		if cint(self.doc.update_stock) == 1:			
			self.update_stock_ledger(update_stock=1)
			self.update_serial_nos()
		else:
			# Check for Approving Authority
			if not self.doc.recurring_id:
				get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, 
				 	self.doc.company, self.doc.grand_total, self)
				
		self.set_buying_amount()
		self.check_prev_docstatus()
		
		self.update_status_updater_args()
		self.update_prevdoc_status()
		
		# this sequence because outstanding may get -ve
		self.make_gl_entries()

		if not cint(self.doc.is_pos) == 1:
			self.update_against_document_in_jv()

		self.update_c_form()
		self.update_time_log_batch(self.doc.name)
		self.convert_to_recurring()
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:25,代码来源:sales_invoice.py


示例3: validate

	def validate(self):
		self.so_dn_required()
		self.validate_proj_cust()
		sales_com_obj = get_obj('Sales Common')
		sales_com_obj.check_stop_sales_order(self)
		sales_com_obj.check_active_sales_items(self)
		sales_com_obj.check_conversion_rate(self)
		sales_com_obj.validate_max_discount(self, 'entries')	 #verify whether rate is not greater than tolerance
		sales_com_obj.get_allocated_sum(self)	# this is to verify that the allocated % of sales persons is 100%
		sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
		self.validate_customer()
		self.validate_customer_account()
		self.validate_debit_acc()
		self.validate_fixed_asset_account()
		self.add_remarks()
		if cint(self.doc.is_pos):
			self.validate_pos()
			self.validate_write_off_account()
			if cint(self.doc.update_stock):
				sl = get_obj('Stock Ledger')
				sl.validate_serial_no(self, 'entries')
				sl.validate_serial_no(self, 'packing_details')
				self.validate_item_code()
				self.update_current_stock()
				self.validate_delivery_note()
		self.set_in_words()
		if not self.doc.is_opening:
			self.doc.is_opening = 'No'
		self.set_aging_date()
		self.clear_advances()
		self.set_against_income_account()
		self.validate_c_form()
		self.validate_recurring_invoice()
开发者ID:masums,项目名称:erpnext,代码行数:33,代码来源:sales_invoice.py


示例4: reconcile_against_document

	def reconcile_against_document(self, args):
		"""
			Cancel JV, Update aginst document, split if required and resubmit jv
		"""
		
		for d in args:
			self.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 = get_obj('Journal Voucher', d['voucher_no'], with_children=1)
			self.make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)

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

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


示例5: validate

  def validate(self):
    self.so_required()
    self.validate_fiscal_year()
    self.validate_proj_cust()
    sales_com_obj = get_obj(dt = 'Sales Common')
    sales_com_obj.check_stop_sales_order(self)
    sales_com_obj.check_active_sales_items(self)
    sales_com_obj.get_prevdoc_date(self)
    self.validate_mandatory()
    #self.validate_prevdoc_details()
    self.validate_reference_value()
    self.validate_for_items()
    sales_com_obj.make_packing_list(self,'delivery_note_details')
    get_obj('Stock Ledger').validate_serial_no(self, 'packing_details')
    sales_com_obj.validate_max_discount(self, 'delivery_note_details')             #verify whether rate is not greater than max discount
    sales_com_obj.get_allocated_sum(self)  # this is to verify that the allocated % of sales persons is 100%
    sales_com_obj.check_conversion_rate(self)
    # ::::::: Get total in Words ::::::::
    dcc = TransactionBase().get_company_currency(self.doc.company)
    self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
    self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)

    # ::::::: Set Net Weight of each Packing
    self.update_pack_nett_weight()
    self.print_packing_slip()
    # ::::::: Set actual qty for each item in selected warehouse :::::::
    self.update_current_stock()
    # :::::: set DN status :::::::

    self.doc.status = 'Draft'
    if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
    if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
开发者ID:tobrahma,项目名称:erpnext,代码行数:32,代码来源:delivery_note.py


示例6: pull_details

    def pull_details(self):
        """Pull Details of Delivery Note or Sales Order Selected"""
        if self.doc.delivery_note_main:
            self.validate_prev_docname("delivery note")
            self.doclist = self.doc.clear_table(self.doclist, "other_charges")
            self.doclist = get_obj("DocType Mapper", "Delivery Note-Sales Invoice").dt_map(
                "Delivery Note",
                "Sales Invoice",
                self.doc.delivery_note_main,
                self.doc,
                self.doclist,
                """[['Delivery Note', 'Sales Invoice'],
					['Delivery Note Item', 'Sales Invoice Item'],
					['Sales Taxes and Charges','Sales Taxes and Charges'],
					['Sales Team','Sales Team']]""",
            )
            self.get_income_expense_account("entries")

        elif self.doc.sales_order_main:
            self.validate_prev_docname("sales order")
            self.doclist = self.doc.clear_table(self.doclist, "other_charges")
            get_obj("DocType Mapper", "Sales Order-Sales Invoice").dt_map(
                "Sales Order",
                "Sales Invoice",
                self.doc.sales_order_main,
                self.doc,
                self.doclist,
                """[['Sales Order', 'Sales Invoice'],['Sales Order Item', 'Sales Invoice Item'], 
				['Sales Taxes and Charges','Sales Taxes and Charges'], 
				['Sales Team', 'Sales Team']]""",
            )
            self.get_income_expense_account("entries")

        ret = self.get_debit_to()
        self.doc.debit_to = ret.get("debit_to")
开发者ID:rohitw1991,项目名称:erpnext,代码行数:35,代码来源:sales_invoice.py


示例7: test_leave_bal

	def test_leave_bal(self):
		leaves.l_all.save(1)
		leaves.l_app1.save(1)
		leaves.l_app2.save(1)

		la1 = get_obj('Leave Application', leaves.l_app1.name, with_children=1)
		la1.validate()
		la1.doc.docstatus = 1
		la1.doc.save()
		
		self.assertTrue(la1.doc.total_leave_days == 2)
		
		la1.doc.half_day  = 1
		la1.validate()
		la1.doc.save()
		
		self.assertTrue(la1.doc.total_leave_days == .5)

		print "Test case for leave applied no of days"
		
				
		la2 = get_obj('Leave Application', leaves.l_app2.name, with_children=1)
		la2.validate()
		bal = la2.get_leave_balance()
		self.assertTrue(bal, 18)
		print "Test case for leave balance"
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:26,代码来源:test_leave.py


示例8: rewrite_pages

	def rewrite_pages(self):
		"""rewrite all web pages"""
		import webnotes
		from webnotes.model.doclist import DocList
		from webnotes.model.code import get_obj
		
		# rewrite all web pages
		for name in webnotes.conn.sql("""select name, modified from `tabWeb Page` 
			where docstatus=0"""):
			DocList('Web Page', name[0]).save()
			webnotes.conn.set_value('Web Page', name[0], 'modified', name[1])

		# rewrite all blog pages
		for name in webnotes.conn.sql("""select name, modified from `tabBlog` 
			where docstatus=0 and ifnull(published,0)=1"""):
			DocList('Blog', name[0]).save()
			webnotes.conn.set_value('Blog', name[0], 'modified', name[1])
		
		from webnotes.cms.make import make_web_core
		make_web_core()
		
		get_obj('Page', 'blog').write_cms_page(force=True)
		get_obj('Page', 'Login Page').write_cms_page(force=True)
		
		webnotes.msgprint('Rebuilt all blogs and pages')
开发者ID:NorrWing,项目名称:erpnext,代码行数:25,代码来源:website_settings.py


示例9: on_submit

	def on_submit(self):
		self.validate_packed_qty()

		# Check for Approving Authority
		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
		
		# validate serial no for item table (non-sales-bom item) and packing list (sales-bom item)
		sl_obj = get_obj("Stock Ledger")
		sl_obj.validate_serial_no(self, 'delivery_note_details')
		sl_obj.validate_serial_no_warehouse(self, 'delivery_note_details')
		sl_obj.validate_serial_no(self, 'packing_details')
		sl_obj.validate_serial_no_warehouse(self, 'packing_details')
		
		# update delivery details in serial no
		sl_obj.update_serial_record(self, 'delivery_note_details', is_submit = 1, is_incoming = 0)
		sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0)
		
		# update delivered qty in sales order
		get_obj("Sales Common").update_prevdoc_detail(1,self)
		
		# create stock ledger entry
		self.update_stock_ledger(update_stock = 1)

		self.credit_limit()
		
		self.set_buying_amount()
		self.make_gl_entries()

		# set DN status
		webnotes.conn.set(self.doc, 'status', 'Submitted')
开发者ID:BillTheBest,项目名称:erpnext,代码行数:30,代码来源:delivery_note.py


示例10: calculate_cost

	def calculate_cost(self, bom_no):
		main_bom_list = get_obj('Production Control').traverse_bom_tree( bom_no = bom_no, qty = 1, calculate_cost = 1)
		main_bom_list.reverse()
		for bom in main_bom_list:
			bom_obj = get_obj('BOM', bom, with_children = 1)
			bom_obj.calculate_cost()
		return 'calculated'
开发者ID:smilekk,项目名称:erpnext,代码行数:7,代码来源:bom_control.py


示例11: validate

 def validate(self):
     self.so_dn_required()
     # self.dn_required()
     self.validate_proj_cust()
     sales_com_obj = get_obj("Sales Common")
     sales_com_obj.check_stop_sales_order(self)
     sales_com_obj.check_active_sales_items(self)
     sales_com_obj.check_conversion_rate(self)
     sales_com_obj.validate_max_discount(self, "entries")  # verify whether rate is not greater than tolerance
     sales_com_obj.get_allocated_sum(self)  # this is to verify that the allocated % of sales persons is 100%
     sales_com_obj.validate_fiscal_year(self.doc.fiscal_year, self.doc.posting_date, "Posting Date")
     self.validate_customer()
     self.validate_debit_to_acc()
     self.validate_debit_acc()
     self.validate_fixed_asset_account()
     self.add_remarks()
     if cint(self.doc.is_pos):
         self.validate_pos()
         self.validate_write_off_account()
         if cint(self.doc.update_stock):
             get_obj("Stock Ledger").validate_serial_no(self, "entries")
             self.validate_item_code()
             self.update_current_stock()
     self.set_in_words()
     if not self.doc.is_opening:
         self.doc.is_opening = "No"
     self.set_aging_date()
     self.clear_advances()
     # Set against account
     self.set_against_income_account()
     self.validate_c_form()
开发者ID:aarohan,项目名称:erpnext,代码行数:31,代码来源:sales_invoice.py


示例12: update_against_document_in_jv

    def update_against_document_in_jv(self):
        """
			Links invoice and advance voucher:
				1. cancel advance voucher
				2. split into multiple rows if partially adjusted, assign against voucher
				3. submit advance voucher
		"""

        lst = []
        for d in getlist(self.doclist, "advance_adjustment_details"):
            if flt(d.allocated_amount) > 0:
                args = {
                    "voucher_no": d.journal_voucher,
                    "voucher_detail_no": d.jv_detail_no,
                    "against_voucher_type": "Sales Invoice",
                    "against_voucher": self.doc.name,
                    "account": self.doc.debit_to,
                    "is_advance": "Yes",
                    "dr_or_cr": "credit",
                    "unadjusted_amt": flt(d.advance_amount),
                    "allocated_amt": flt(d.allocated_amount),
                }
                lst.append(args)

        if lst:
            get_obj("GL Control").reconcile_against_document(lst)
开发者ID:aarohan,项目名称:erpnext,代码行数:26,代码来源:sales_invoice.py


示例13: update_stock

    def update_stock(self, values):
        for v in values:
            sle_id, serial_nos = "", ""

            # get serial nos
            if v["serial_no"]:
                serial_nos = self.get_sr_no_list(v["serial_no"], v["actual_qty"])

                # reverse quantities for cancel
            if v["is_cancelled"] == "Yes":
                v["actual_qty"] = -flt(v["actual_qty"])
                # cancel matching entry
                sql(
                    "update `tabStock Ledger Entry` set is_cancelled='Yes' where voucher_no=%s and voucher_type=%s",
                    (v["voucher_no"], v["voucher_type"]),
                )

            if v["actual_qty"]:
                sle_id = self.make_entry(v)

            get_obj("Warehouse", v["warehouse"]).update_bin(
                flt(v["actual_qty"]),
                0,
                0,
                0,
                0,
                v["item_code"],
                v["posting_date"],
                sle_id,
                v["posting_time"],
                "",
                v["is_cancelled"],
            )
开发者ID:tobrahma,项目名称:erpnext,代码行数:33,代码来源:stock_ledger.py


示例14: validate

	def validate(self):
		super(DocType, self).validate()
		
		self.po_required()
		self.validate_fiscal_year()

		if not self.doc.status:
			self.doc.status = "Draft"

		import utilities
		utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Cancelled"])

		self.validate_accepted_rejected_qty()
		self.validate_inspection()						 # Validate Inspection
		get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
		self.validate_challan_no()

		pc_obj = get_obj(dt='Purchase Common')
		pc_obj.validate_for_items(self)
		pc_obj.get_prevdoc_date(self)
		pc_obj.validate_reference_value(self)
		self.check_for_stopped_status(pc_obj)

		# sub-contracting
		self.validate_for_subcontracting()
		self.update_raw_materials_supplied("pr_raw_material_details")
		
		self.update_valuation_rate("purchase_receipt_details")
开发者ID:twocngdagz,项目名称:erpnext,代码行数:28,代码来源:purchase_receipt.py


示例15: update_stock_ledger

	def update_stock_ledger(self, update_stock):
		self.values = []
		for d in self.get_item_list():
			if webnotes.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
				# this happens when item is changed from non-stock to stock item
				if not d["warehouse"]:
					continue
				
				if d['reserved_qty'] < 0 :
					# Reduce reserved qty from reserved warehouse mentioned in so
					if not d["reserved_warehouse"]:
						webnotes.throw(_("Reserved Warehouse is missing in Sales Order"))
						
					args = {
						"item_code": d['item_code'],
						"voucher_type": self.doc.doctype,
						"voucher_no": self.doc.name,
						"reserved_qty": flt(update_stock) * flt(d['reserved_qty']),
						"posting_date": self.doc.posting_date,
						"is_amended": self.doc.amended_from and 'Yes' or 'No'
					}
					get_obj("Warehouse", d["reserved_warehouse"]).update_bin(args)
						
				# Reduce actual qty from warehouse
				self.make_sl_entry(d, d['warehouse'], - flt(d['qty']) , 0, update_stock)
		
		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:27,代码来源:delivery_note.py


示例16: stop_unstop

	def stop_unstop(self, status):
		""" Called from client side on Stop/Unstop event"""
		self.update_status(status)
		# Update Planned Qty of Production Item
		qty = (flt(self.doc.qty) - flt(self.doc.produced_qty)) * ((status == 'Stopped') and -1 or 1)
		get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0, flt(qty), self.doc.production_item, now())
		msgprint("Production Order has been %s" % status)
开发者ID:antoxin,项目名称:erpnext,代码行数:7,代码来源:production_order.py


示例17: update_production_order

	def update_production_order(self, is_submit):
		if self.doc.production_order:
			# first perform some validations
			# (they are here coz this fn is also called during on_cancel)
			pro_obj = get_obj("Production Order", self.doc.production_order)
			if flt(pro_obj.doc.docstatus) != 1:
				msgprint("""You cannot do any transaction against 
					Production Order : %s, as it's not submitted"""
					% (pro_obj.doc.name), raise_exception=1)
					
			if pro_obj.doc.status == 'Stopped':
				msgprint("""You cannot do any transaction against Production Order : %s, 
					as it's status is 'Stopped'"""% (pro_obj.doc.name), raise_exception=1)
					
			# update bin
			if self.doc.purpose == "Manufacture/Repack":
				pro_obj.doc.produced_qty = flt(pro_obj.doc.produced_qty) + \
					(is_submit and 1 or -1 ) * flt(self.doc.fg_completed_qty)
				args = {
					"item_code": pro_obj.doc.production_item,
					"posting_date": self.doc.posting_date,
					"planned_qty": (is_submit and -1 or 1 ) * flt(self.doc.fg_completed_qty)
				}
				get_obj('Warehouse', pro_obj.doc.fg_warehouse).update_bin(args)
			
			# update production order status
			pro_obj.doc.status = (flt(pro_obj.doc.qty)==flt(pro_obj.doc.produced_qty)) \
				and 'Completed' or 'In Process'
			pro_obj.doc.save()
开发者ID:MrTomato8,项目名称:erpnext,代码行数:29,代码来源:stock_entry.py


示例18: get_tds

	def get_tds(self):
		if cstr(self.doc.is_opening) != 'Yes':
			if not self.doc.credit_to:
				msgprint("Please Enter Credit To account first")
				raise Exception
			else:
				tds_applicable = sql("select tds_applicable from tabAccount where name = '%s'" % self.doc.credit_to)
				if tds_applicable and cstr(tds_applicable[0][0]) == 'Yes':
					if not self.doc.tds_applicable:
						msgprint("Please enter whether TDS Applicable or not")
						raise Exception
					if self.doc.tds_applicable == 'Yes':
						if not self.doc.tds_category:
							msgprint("Please select TDS Category")
							raise Exception
						else:
							get_obj('TDS Control').get_tds_amount(self)
							self.doc.total_tds_on_voucher = self.doc.ded_amount
							self.doc.total_amount_to_pay=flt(self.doc.grand_total) - flt(self.doc.ded_amount) - self.doc.write_off_amount
							self.doc.outstanding_amount = self.doc.total_amount_to_pay - flt(self.doc.total_advance)
					elif self.doc.tds_applicable == 'No':
						self.doc.tds_category = ''
						self.doc.tax_code = ''
						self.doc.rate = 0
						self.doc.ded_amount = 0
						self.doc.total_tds_on_voucher = 0
开发者ID:trycatcher,项目名称:erpnext,代码行数:26,代码来源:purchase_invoice.py


示例19: pull_so_details

	def pull_so_details(self):
		self.check_if_already_pulled()
		if self.doc.sales_order_no:
			get_obj('DocType Mapper', 'Sales Order-Purchase Request', with_children=1).dt_map('Sales Order', 'Purchase Request', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Purchase Request'],['Sales Order Item', 'Purchase Request Item']]")
			self.get_item_defaults()
		else:
			msgprint("Please select Sales Order whose details need to pull")
开发者ID:NorrWing,项目名称:erpnext,代码行数:7,代码来源:purchase_request.py


示例20: repost

def repost():
	"""
	Repost everything!
	"""
	from webnotes.model.code import get_obj
	for wh in webnotes.conn.sql("select name from tabWarehouse"):
		get_obj('Warehouse', wh[0]).repost_stock()
开发者ID:Yellowen,项目名称:Owrang,代码行数:7,代码来源:utils.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python doc.addchild函数代码示例发布时间:2022-05-26
下一篇:
Python bean.getlist函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap