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

Python doc.addchild函数代码示例

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

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



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

示例1: get_item_details

	def get_item_details(self):
	
		items=webnotes.conn.sql(""" select item,quantity,description,warehouse from `tabItem Detail` 
					where parent=%s""",(self.doc.special_type_project),as_dict=1)
		employee=webnotes.conn.sql(""" select employee,employee_name,employee_contact_no from `tabEmployee Detail` 
					where parent=%s""",(self.doc.special_type_project),as_dict=1)
		#webnotes.errprint(milestone)
		for d in items:
			#self.doclist=self.doc.clear_table(self.doclist,'')

			ch = addchild(self.doc, 'item_details_table', 
					'Item Detail', self.doclist)
			#webnotes.errprint(t[0])
			ch.item = d.get('item')
			ch.quantity= d.get('quantity')
			ch.description=d.get('description')
			ch.warehouse=d.get('warehouse')
			#webnotes.errprint(ch)
		for t in employee:
			ch = addchild(self.doc, 'employee_details_table', 
				'Employee Detail', self.doclist)
				#webnotes.errprint(t[0])
			ch.employee=t.get('employee')
			ch.employee_name= t.get('employee_name')
			ch.employee_contact_no=t.get('employee_contact_no')
开发者ID:Tejal011089,项目名称:med2-app,代码行数:25,代码来源:project_management.py


示例2: upload_accounts_transactions

    def upload_accounts_transactions(self):
        import csv

        data = csv.reader(self.get_csv_data().splitlines())

        abbr = sql("select concat(' - ',abbr) as abbr from tabCompany where name=%s", self.doc.company)
        updated = 0
        jv_name = ""
        # 		jv = Document('Journal Voucher')
        global line, jv, name, jv_go
        for line in data:
            if len(line) >= 7:  # Minimum no of fields
                if line[3] != jv_name:  # Create JV
                    if jv_name != "":
                        jv_go = get_obj("Journal Voucher", name, with_children=1)
                        jv_go.validate()
                        jv_go.on_submit()

                    jv_name = line[3]
                    jv = Document("Journal Voucher")
                    jv.voucher_type = line[0]
                    jv.naming_series = line[1]
                    jv.voucher_date = formatdate(line[2])
                    jv.posting_date = formatdate(line[2])
                    # 					jv.name = line[3]
                    jv.fiscal_year = self.doc.fiscal_year
                    jv.company = self.doc.company
                    jv.remark = len(line) == 8 and line[3] + " " + line[7] or line[3] + " Uploaded Record"
                    jv.docstatus = 1
                    jv.save(1)
                    name = jv.name

                    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
                    jc.account = line[4] + abbr[0][0]
                    jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
                    if line[5] != "":
                        jc.debit = line[5]
                    else:
                        jc.credit = line[6]
                    jc.save()

                else:  # Create JV Child
                    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
                    jc.account = line[4] + abbr[0][0]
                    jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
                    if line[5] != "":
                        jc.debit = line[5]
                    else:
                        jc.credit = line[6]
                    jc.save()
            else:
                msgprint("[Ignored] Incorrect format: %s" % str(line))
        if jv_name != "":
            jv_go = get_obj("Journal Voucher", name, with_children=1)
            jv_go.validate()
            jv_go.on_submit()

        msgprint("<b>%s</b> items updated" % updated)
开发者ID:Vichagserp,项目名称:cimworks,代码行数:58,代码来源:upload_accounts_transactions.py


示例3: execute

def execute():
    import webnotes
    from webnotes.model import delete_doc
    from webnotes.model.code import get_obj
    from webnotes.model.doc import addchild

    # delete doctypes and tables
    for dt in [
        "TDS Payment",
        "TDS Return Acknowledgement",
        "Form 16A",
        "TDS Rate Chart",
        "TDS Category",
        "TDS Control",
        "TDS Detail",
        "TDS Payment Detail",
        "TDS Rate Detail",
        "TDS Category Account",
        "Form 16A Ack Detail",
        "Form 16A Tax Detail",
    ]:
        delete_doc("DocType", dt)

        webnotes.conn.commit()
        webnotes.conn.sql("drop table if exists `tab%s`" % dt)
        webnotes.conn.begin()

    delete_doc("Search Criteria", "tds_return")

    # Add tds entry in tax table for purchase invoice
    pi_list = webnotes.conn.sql(
        """select name from `tabPurchase Invoice` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0"""
    )
    for pi in pi_list:
        piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
        ch = addchild(piobj.doc, "taxes_and_charges", "Purchase Taxes and Charges")
        ch.charge_type = "Actual"
        ch.account_head = piobj.doc.tax_code
        ch.description = piobj.doc.tax_code
        ch.rate = -1 * piobj.doc.ded_amount
        ch.tax_amount = -1 * piobj.doc.ded_amount
        ch.category = "Total"
        ch.save(1)

        # Add tds entry in entries table for journal voucher
    jv_list = webnotes.conn.sql(
        """select name from `tabJournal Voucher` 
		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0"""
    )
    for jv in jv_list:
        jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
        ch = addchild(jvobj.doc, "entries", "Journal Voucher Detail")
        ch.account = jvobj.doc.tax_code
        ch.credit = jvobj.doc.ded_amount
        ch.save(1)
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:56,代码来源:deprecate_tds.py


示例4: fetch_gases

	def fetch_gases(self):
		gases = webnotes.conn.sql("select name from tabGas where name!='TGC'")
		self.doclist=self.doc.clear_table(self.doclist,'dissolved_gas_detail')
		if gases:

			nl = addchild(self.doc, 'dissolved_gas_detail', 'Dissolved Gas Analysis Detail', self.doclist)
			nl.gas='TGC'
			for gas in gases:
				nl = addchild(self.doc, 'dissolved_gas_detail', 'Dissolved Gas Analysis Detail', self.doclist)
				nl.gas = gas
		else:
			webnotes.msgprint("There is no any Gas Recorded In Gas Table")
开发者ID:saurabh6790,项目名称:tru_app_back,代码行数:12,代码来源:dissolved_gas_analysis.py


示例5: add_roles

	def add_roles(self, pr):
		roles_list = ['Accounts Manager', 'Accounts User', 'Blogger', 'HR Manager', 'HR User', 'Maintenance User', 'Maintenance Manager', 'Material Manager', 'Material User', 'Material Master Manager', 'Production Manager', 'Production User', 'Projects User', 'Purchase Manager', 'Purchase User', 'Purchase Master Manager', 'Quality Manager', 'Sales Manager', 'Sales User', 'Sales Master Manager', 'Support Manager', 'Support Team', 'System Manager', 'Website Manager']
		for r in roles_list:
			d = addchild(pr, 'userroles', 'UserRole', 1)
			d.role = r
			d.save(1)

		# Add roles to Administrator profile
		pr = Document('Profile','Administrator')
		for r in roles_list:
			d = addchild(pr,'userroles', 'UserRole', 1)
			d.role = r
			d.save(1)
开发者ID:NorrWing,项目名称:erpnext,代码行数:13,代码来源:setup_control.py


示例6: get_open_sales_order

  def get_open_sales_order(self):
    if not (self.doc.from_date and self.doc.to_date):
      msgprint("From Date and To Date are Mandatory")
      return
    
    cond = ''  
    if self.doc.customer:
      cond += " AND t1.customer = '%s' " % self.doc.customer
    if self.doc.sales_order:
      cond += " AND t1.name = '%s' " % self.doc.sales_order
    if self.doc.territory:
      cond += " AND t1.territory = '%s' " %self.doc.territory

    dl = sql("select distinct t1.name, t1.customer,  t1.delivery_date, t1.territory, t1.rounded_total from `tabSales Order` t1, `tabSales Order Detail` t2 where  t1.transaction_date >= '%s' and t1.transaction_date <= '%s' and t1.docstatus=1 and t1.status != 'Completed' and t1.name = t2.parent and t2.docstatus =1 and t2.qty > t2.delivered_qty and (t2.confirmation_date is null or t2.confirmation_date= '' or t2.confirmation_date='0000-00-00') %s"% (self.doc.from_date, self.doc.to_date, cond)) 
    self.doc.clear_table(self.doclist, 'entries')
    count = 0 
    for d in dl:
      nl = addchild(self.doc, 'entries', 'Update Delivery Date Detail', 1, self.doclist)
      nl.sales_order_no = str(d[0])
      nl.customer = str(d[1])
      nl.territory = str(d[3])
      nl.rounded_total = str(d[4])
      nl.delivery_date = str(d[2])
      count = count +1
    if not count:
      msgprint("No Sales Order found as per filters set.")
开发者ID:antoxin,项目名称:erpnext,代码行数:26,代码来源:update_delivery_date.py


示例7: update_against_doc

def update_against_doc(d, jv_obj):
	"""
		Updates against document, if partial amount splits into rows
	"""

	webnotes.conn.sql("""
		update `tabJournal Voucher Detail` t1, `tabJournal Voucher` t2	
		set t1.%(dr_or_cr)s = '%(allocated_amt)s', 
		t1.%(against_fld)s = '%(against_voucher)s', t2.modified = now() 
		where t1.name = '%(voucher_detail_no)s' and t1.parent = t2.name""" % d)
	
	if d['allocated_amt'] < d['unadjusted_amt']:
		jvd = webnotes.conn.sql("""select cost_center, balance, against_account, is_advance 
			from `tabJournal Voucher Detail` where name = %s""", d['voucher_detail_no'])
		# new entry with balance amount
		ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail')
		ch.account = d['account']
		ch.cost_center = cstr(jvd[0][0])
		ch.balance = cstr(jvd[0][1])
		ch.fields[d['dr_or_cr']] = flt(d['unadjusted_amt']) - flt(d['allocated_amt'])
		ch.fields[d['dr_or_cr']== 'debit' and 'credit' or 'debit'] = 0
		ch.against_account = cstr(jvd[0][2])
		ch.is_advance = cstr(jvd[0][3])
		ch.docstatus = 1
		ch.save(1)
开发者ID:robertbecht,项目名称:erpnext,代码行数:25,代码来源:utils.py


示例8: reorder_indent

	def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
		indent = Document('Indent')
		indent.transaction_date = nowdate()
		indent.naming_series = 'IDT'
		indent.company = get_defaults()['company']
		indent.fiscal_year = get_defaults()['fiscal_year']
		indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
		indent.save(1)
		indent_obj = get_obj('Indent',indent.name,with_children=1)
		indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
		indent_details_child.item_code = self.doc.item_code
		indent_details_child.uom = self.doc.stock_uom
		indent_details_child.warehouse = self.doc.warehouse
		indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
		indent_details_child.item_name = i['item_name']
		indent_details_child.description = i['description']
		indent_details_child.item_group = i['item_group']
		if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
			indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
		else:
			indent_details_child.qty = i['min_order_qty']
		indent_details_child.brand = i['brand']
		indent_details_child.save()
		indent_obj = get_obj('Indent',indent.name,with_children=1)
		indent_obj.validate()
		set(indent_obj.doc,'docstatus',1)
		indent_obj.on_submit()
		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
		if(email_notify):
			send_email_notification(doc_type,doc_name)
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:30,代码来源:bin.py


示例9: add_charges_in_pr

	def add_charges_in_pr(self):
		""" Add additional charges in selected pr proportionately"""
		total_amt = self.get_total_amt()
		
		for pr in self.selected_pr:
			pr_obj = get_obj('Purchase Receipt', pr, with_children = 1)
			cumulative_grand_total = flt(pr_obj.doc.grand_total)
			
			for lc in getlist(self.doclist, 'landed_cost_details'):
				amt = flt(lc.amount) * flt(pr_obj.doc.net_total)/ flt(total_amt)
				self.prwise_cost[pr] = self.prwise_cost.get(pr, 0) + amt
				cumulative_grand_total += amt
				
				pr_oc_row = sql("select name from `tabPurchase Taxes and Charges` where parent = %s and category = 'Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head))
				if not pr_oc_row:	# add if not exists
					ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1)
					ch.category = 'Valuation'
					ch.add_deduct_tax = 'Add'
					ch.charge_type = 'Actual'
					ch.description = lc.description
					ch.account_head = lc.account_head
					ch.rate = amt
					ch.tax_amount = amt
					ch.total = cumulative_grand_total
					ch.docstatus = 1
					ch.idx = 500 # add at the end
					ch.save(1)
				else:	# overwrite if exists
					sql("update `tabPurchase Taxes and Charges` set rate = %s, tax_amount = %s where name = %s and parent = %s ", (amt, amt, pr_oc_row[0][0], pr))
开发者ID:trycatcher,项目名称:erpnext,代码行数:29,代码来源:landed_cost_wizard.py


示例10: create_auto_indent

	def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
		"""	Create indent on reaching reorder level	"""

		indent = Document('Purchase Request')
		indent.transaction_date = nowdate()
		indent.naming_series = 'IDT'
		indent.company = get_defaults()['company']
		indent.fiscal_year = get_defaults()['fiscal_year']
		indent.remark = "This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
		indent.save(1)
		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
		indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0)
		indent_details_child.item_code = self.doc.item_code
		indent_details_child.uom = self.doc.stock_uom
		indent_details_child.warehouse = self.doc.warehouse
		indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
		indent_details_child.item_name = i['item_name']
		indent_details_child.description = i['description']
		indent_details_child.item_group = i['item_group']
		indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
		indent_details_child.brand = i['brand']
		indent_details_child.save()
		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
		indent_obj.validate()
		set(indent_obj.doc,'docstatus',1)
		indent_obj.on_submit()
		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
		if(i['email_notify']):
			send_email_notification(doc_type,doc_name)
开发者ID:NorrWing,项目名称:erpnext,代码行数:29,代码来源:bin.py


示例11: update_warranty_amc_history

 def update_warranty_amc_history(self, submit = 1):
   if submit:
     for d in getlist(self.doclist, 'delivery_note_details'):
       if d.serial_no:
         serial_nos = self.get_sr_no_list(d.serial_no)
         for s in serial_nos:
           sr = Document('Serial No', s)
           child = addchild(sr, 'warranty_amc_history', 'Warranty AMC History', 0)
           child.from_date = self.doc.transaction_date
           child.to_date = d.warranty_expiry_date
           child.status = 'Under Warranty'
           child.against_doctype = self.doc.doctype
           child.against_docname = self.doc.name
           child.customer = self.doc.customer
           child.territory = self.doc.territory
           child.save()
           sr.warranty_amc_status = 'Under Warranty'
           sr.warranty_expiry_date = d.warranty_expiry_date
           sr.save()
   else:
     sql("delete from `tabWarranty AMC History` where against_doctype = %s and against_docname = %s", (self.doc.doctype, self.doc.name))
     sr_list = []
     for d in getlist(self.doclist, 'service_order_details'):
       if d.serial_no:
         serial_nos = self.get_sr_no_list(d.serial_no)
         for s in serial_nos:
           sql("update `tabSerial No` set warranty_expiry_date = '' where name = '%s'" % (s))
           sr_list.append(s)
     self.update_serial_no_warranty_amc_status(serial_no_list = sr_list) 
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:29,代码来源:delivery_note.py


示例12: on_update

	def on_update(self):
		bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
		if bin and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
			msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
			raise Exception
		check_list = []
		for d in getlist(self.doclist,'uom_conversion_details'):
			if not self.doc.stock_uom:
				msgprint("Please enter Stock UOM first.")
				raise Exception
			
			if cstr(d.uom) in check_list:
				msgprint("UOM %s has been entered more than once in Conversion Factor Details." % cstr(d.uom))
				raise Exception
			
			if not cstr(d.uom) in check_list:
				check_list.append(cstr(d.uom))
							
			if cstr(d.uom) == cstr(self.doc.stock_uom):
				if flt(d.conversion_factor) != 1:
					msgprint("Conversion Fator of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
					raise Exception
				# else set uom_exist as true
				uom_exist='true'
			elif cstr(d.uom) != cstr(self.doc.stock_uom) and flt(d.conversion_factor) == 1:
				msgprint("Conversion Factor of UOM : %s should not be equal to 1. As UOM : %s is not Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
				raise Exception
		
		if not cstr(self.doc.stock_uom) in check_list :
			child = addchild( self.doc, 'uom_conversion_details', 'UOM Conversion Detail', 1, self.doclist)
			child.uom = self.doc.stock_uom
			child.conversion_factor = 1
			child.save()
开发者ID:ravidey,项目名称:erpnext,代码行数:33,代码来源:item.py


示例13: get_weekly_off_date_list

        def get_weekly_off_date_list(self, year_start_date, year_end_date):
                from webnotes.utils import getdate
                year_start_date, year_end_date = getdate(year_start_date), getdate(year_end_date)

                from dateutil import relativedelta
                from datetime import timedelta
                import calendar

                date_list = []
                date_list1 = []
                if self.doc.weekly_off=='3rd Saturday':
                        webnotes.errprint(self.doc.weekly_off)
                        weekday = getattr(calendar, ('Saturday').upper())
                        reference_date = year_start_date + relativedelta.relativedelta(weekday=weekday)
                        while reference_date <= year_end_date:
                                date_list1.append(reference_date)
                                reference_date += timedelta(days=7)
                        for dt in date_list1:
                                if dt.day>14 :
                                        if dt.day <22:
                                                #webnotes.errprint(dt)
                                                ch = addchild(self.doc, 'holiday_list_details', 'Holiday', self.doclist)
                                                ch.description = self.doc.weekly_off
                                                ch.holiday_date = dt
                        return date_list
                else:
                        weekday = getattr(calendar, (self.doc.weekly_off).upper())
                        reference_date = year_start_date + relativedelta.relativedelta(weekday=weekday)
                        while reference_date <= year_end_date:
                                date_list.append(reference_date)
                                reference_date += timedelta(days=7)
                        return date_list
开发者ID:Tejal011089,项目名称:med2-app,代码行数:32,代码来源:holiday_list.py


示例14: update_ref_rate

    def update_ref_rate(self, i):
        ref_rate, count, p, currency = 0, 0, self.doc.price_list, self.doc.currency
        if not cstr(self.doc.price_list):
            msgprint("Please enter Price List.")
            raise Exception
        if not cstr(self.doc.currency):
            msgprint("Please enter Currency.")
            raise Exception
        for d in getlist(self.doclist, "sales_bom_items"):
            item_rate = sql(
                "select ref_rate,ref_currency from `tabRef Rate Detail` where price_list_name=%s and parent=%s",
                (p, d.item_code),
            )
            if not item_rate:
                msgprint(
                    "Item %s does not have a rate for Price List %s. Did not update rates for this Price List"
                    % (d.item_code, p)
                )
                raise Exception
            # if count == 0 : currency = cstr(item_rate[0][1])
            if not cstr(currency) == cstr(item_rate[0][1]):
                msgprint(
                    "Item %s currency %s does not match with other items currency i.e. %s "
                    % (d.item_code, item_rate[0][1], currency)
                )
                raise Exception
            count += 1
            ref_rate += flt(d.qty) * flt(item_rate[0][0])

        pld = addchild(i, "ref_rate_details", "Ref Rate Detail")
        pld.price_list_name = p
        pld.ref_rate = flt(ref_rate)
        pld.ref_currency = currency
        pld.save()
开发者ID:Vichagserp,项目名称:cimworks,代码行数:34,代码来源:sales_bom.py


示例15: get_tds

    def get_tds(self):
        self.doc.clear_table(self.doclist, "form_16A_tax_details")
        import datetime

        if self.doc.from_date and self.doc.to_date and self.doc.tds_category:
            tot = 0.0
            party_tds_list = sql(
                "select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_no from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1"
                % (self.doc.tds_category, self.doc.party_name, self.doc.from_date, self.doc.to_date)
            )
            for s in party_tds_list:
                child = addchild(self.doc, "form_16A_tax_details", "Form 16A Tax Detail", 1, self.doclist)
                child.amount_paid = s and flt(s[0]) or ""
                child.date_of_payment = s and s[1].strftime("%Y-%m-%d") or ""
                child.tds_main = s and flt(s[2]) or ""
                child.surcharge = 0
                child.cess_on_tds = s and flt(s[3]) or ""
                child.total_tax_deposited = s and flt(s[4]) or ""
                child.cheque_no = s and s[5] or ""
                child.bsr_code = s and s[6] or ""
                child.tax_deposited_date = s and s[7].strftime("%Y-%m-%d") or ""
                child.challan_no = s and s[8] or ""
                tot = flt(tot) + flt(s[4])
            self.doc.total_amount = flt(tot)
        else:
            msgprint("Plaese enter from date, to date and TDS category")
开发者ID:ravidey,项目名称:erpnext,代码行数:26,代码来源:form_16a.py


示例16: fill_sample_alloacation_detail

	def fill_sample_alloacation_detail(self, sample_details, sample_id):
		if self.doc.sample_id:
			self.doclist=self.doc.clear_table(self.doclist,'sample_allocation_detail')
		for sample in sample_details:
			nl = addchild(self.doc, 'sample_allocation_detail', 'Sample Allocation Detail', self.doclist)
			nl.sample_no = sample_id
			nl.test = sample[0]
开发者ID:saurabh6790,项目名称:trufil_app,代码行数:7,代码来源:sample_allocation.py


示例17: update_ref_rate

    def update_ref_rate(self, i):
        ref_rate = 0
        if self.doc.price_list:
            if not cstr(self.doc.currency):
                msgprint("Please enter Currency.")
                raise Exception
            for d in getlist(self.doclist, "sales_bom_items"):
                item_rate = sql(
                    "select ref_rate,ref_currency from `tabItem Price` where price_list_name=%s and parent=%s",
                    (self.doc.price_list, d.item_code),
                )
                ref_rate += flt(d.qty) * (item_rate and flt(item_rate[0][0]) or 0)

            if ref_rate:
                # clear old rates
                sql(
                    "delete from `tabItem Price` where parent=%s and price_list_name = %s",
                    (i.name, self.doc.price_list),
                )

                pld = addchild(i, "ref_rate_details", "Item Price")
                pld.price_list_name = self.doc.price_list
                pld.ref_rate = flt(ref_rate)
                pld.ref_currency = self.doc.currency
                pld.save()
开发者ID:nijil,项目名称:erpnext,代码行数:25,代码来源:sales_bom.py


示例18: get_balance

  def get_balance(self):
    if not getlist(self.doclist,'entries'):
      msgprint("Please enter atleast 1 entry in 'GL Entries' table")
    else:
      flag, self.doc.total_debit, self.doc.total_credit = 0,0,0
      diff = flt(self.doc.difference)
      
      # If any row without amount, set the diff on that row
      for d in getlist(self.doclist,'entries'):
        if (d.credit==0 or d.credit is None) and (d.debit==0 or d.debit is None) and (flt(diff) != 0):
          if diff>0:
            d.credit = flt(diff)
          elif diff<0:
            d.debit = flt(diff)
          flag = 1
          
      # Set the diff in a new row
      if flag == 0 and (flt(diff) != 0):
        jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
        if diff>0:
          jd.credit = flt(diff)
        elif diff<0:
          jd.debit = flt(diff)
          
      # Set the total debit, total credit and difference
      for d in getlist(self.doclist,'entries'):
        self.doc.total_debit += flt(d.debit)
        self.doc.total_credit += flt(d.credit)

      if self.doc.tds_applicable == 'Yes':
        self.doc.total_credit = flt(self.doc.total_credit) + flt(self.doc.ded_amount)

      self.doc.difference = flt(self.doc.total_debit) - flt(self.doc.total_credit)
开发者ID:tassadaque,项目名称:erpnext,代码行数:33,代码来源:journal_voucher.py


示例19: get_loan_details

	def get_loan_details(self):
		end= self.doc.doi_closing
		list1 = []	
		#list1.append(self.doc.doi_start)
		#webnotes.errprint(start)
		#webnotes.errprint(number)
		#webnotes.errprint((cstr(self.doc.doi_start) + datetime.timedelta(12*365/12)).isoformat())
		#self.doc.doi_closing=(self.doc.doi_start + datetime.timedelta(12*365/12)).isformat()
		#webnotes.errprint(self.doc.doi_closing)
		#j=0
		j=self.doc.number_of_installments
		dt=self.doc.doi_start
		for j in range(0,j):
			date=add_months(getdate(dt),1)
			#ebnotes.errprint(["j",date])
		 	#ebnotes.errprint(["hii",end])
			if date<=getdate(end):
				list1.append(date)
			dt=date
			#webnotes.errprint(date)
			#ebnotes.errprint(list1)
			self.doclist=self.doc.clear_table(self.doclist,'installment')

		for i in list1:
			#ebnotes.errprint("in for loop")
			#self.doclist=self.doc.clear_table(self.doclist,'installment')
			ch = addchild(self.doc, 'installment', 
					'Loan Installment Details', self.doclist)
			ch.date_of_installment = i
			ch.amount_to_be_paid =self.doc.amount_per_month 
			ch.status='Unpaid'			
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:31,代码来源:employee_loan.py


示例20: update_packing_list_item

	def update_packing_list_item(self,obj, packing_item_code, qty, warehouse, line):
		bin = self.get_bin_qty(packing_item_code, warehouse)
		item = self.get_packing_item_details(packing_item_code)

		# check if exists
		exists = 0
		for d in getlist(obj.doclist, 'packing_details'):
			if d.parent_item == line.item_code and d.item_code == packing_item_code and d.parent_detail_docname == line.name:
				pi, exists = d, 1
				break

		if not exists:
			pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Item', 
				obj.doclist)

		pi.parent_item = line.item_code
		pi.item_code = packing_item_code
		pi.item_name = item['item_name']
		pi.parent_detail_docname = line.name
		pi.description = item['description']
		pi.uom = item['stock_uom']
		pi.qty = flt(qty)
		pi.actual_qty = bin and flt(bin['actual_qty']) or 0
		pi.projected_qty = bin and flt(bin['projected_qty']) or 0
		pi.prevdoc_doctype = line.prevdoc_doctype
		if not pi.warehouse:
			pi.warehouse = warehouse
		if not pi.batch_no:
			pi.batch_no = cstr(line.batch_no)
		pi.idx = self.packing_list_idx
		
		# saved, since this function is called on_update of delivery note
		pi.save()
		
		self.packing_list_idx += 1
开发者ID:BillTheBest,项目名称:erpnext,代码行数:35,代码来源:sales_common.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python doc.make_autoname函数代码示例发布时间:2022-05-26
下一篇:
Python code.get_obj函数代码示例发布时间: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