コード例 #1
0
ファイル: doctype.py プロジェクト: bindscha/wnframework_old
def add_workflows(doclist):
	from webnotes.model.workflow import get_workflow_name
	doctype = doclist[0].name
	
	# get active workflow
	workflow_name = get_workflow_name(doctype)

	if workflow_name and webnotes.conn.exists("Workflow", workflow_name):
		doclist += webnotes.get_doclist("Workflow", workflow_name)
		
		# add workflow states (for icons and style)
		for state in map(lambda d: d.state, doclist.get({"doctype":"Workflow Document State"})):
			doclist += webnotes.get_doclist("Workflow State", state)
コード例 #2
0
ファイル: doctype.py プロジェクト: rohitw1991/wnframework
def add_workflows(doclist):
    from webnotes.model.workflow import get_workflow_name
    doctype = doclist[0].name

    # get active workflow
    workflow_name = get_workflow_name(doctype)

    if workflow_name and webnotes.conn.exists("Workflow", workflow_name):
        doclist += webnotes.get_doclist("Workflow", workflow_name)

        # add workflow states (for icons and style)
        for state in map(lambda d: d.state,
                         doclist.get({"doctype": "Workflow Document State"})):
            doclist += webnotes.get_doclist("Workflow State", state)
コード例 #3
0
ファイル: doctype.py プロジェクト: rohitw1991/wnframework
def get_doctype_doclist(doctype):
    """get doclist of single doctype"""
    doclist = webnotes.get_doclist('DocType', doctype)
    add_custom_fields(doctype, doclist)
    apply_property_setters(doctype, doclist)
    sort_fields(doclist)
    return doclist
コード例 #4
0
ファイル: doctype.py プロジェクト: bindscha/wnframework_old
def get_doctype_doclist(doctype):
	"""get doclist of single doctype"""
	doclist = webnotes.get_doclist('DocType', doctype)
	add_custom_fields(doctype, doclist)
	apply_property_setters(doctype, doclist)
	sort_fields(doclist)
	return doclist
コード例 #5
0
ファイル: tax_controller.py プロジェクト: MiteshC/erpnext
    def append_taxes(self):
        """append taxes as per tax master link field"""
        # clear tax table
        self.doclist = self.doclist.get(
            {"parentfield": ["!=", self.fmap.taxes_and_charges]})

        tax_master_doctype = self.meta.get_options(
            self.fmap.taxes_and_charges_master)
        master_tax_list = webnotes.get_doclist(
            tax_master_doctype,
            self.doc.fields.get(self.fmap.taxes_and_charges_master)).get(
                {"parentfield": self.fmap.taxes_and_charges})

        for base_tax in master_tax_list:
            tax = _dict([[field, base_tax.fields.get(field)]
                         for field in base_tax.fields
                         if field not in webnotes.model.default_fields])
            tax.update({
                "doctype":
                self.meta.get_options(self.fmap.taxes_and_charges),
                "parentfield":
                self.fmap.taxes_and_charges,
                "rate":
                flt(tax.rate, self.precision.tax.rate),
            })
            self.doclist.append(tax)
コード例 #6
0
ファイル: doctype.py プロジェクト: rohitw1991/wnframework
def add_validators(doctype, doclist):
    for validator in webnotes.conn.sql(
            """select name from `tabDocType Validator` where
		for_doctype=%s""",
            doctype,
            as_dict=1):
        doclist.extend(
            webnotes.get_doclist('DocType Validator', validator.name))
コード例 #7
0
ファイル: doctype.py プロジェクト: rohitw1991/latestadbwnf
def add_validators(doctype, doclist):
    for validator in webnotes.conn.sql(
        """select name from `tabDocType Validator` where
		for_doctype=%s""",
        doctype,
        as_dict=1,
    ):
        doclist.extend(webnotes.get_doclist("DocType Validator", validator.name))
コード例 #8
0
def get_return_doclist_and_details(args):
    ref = webnotes._dict()

    # get ref_doclist
    if args["purpose"] in return_map:
        for fieldname, val in return_map[args["purpose"]].items():
            if args.get(fieldname):
                ref.fieldname = fieldname
                ref.doclist = webnotes.get_doclist(val[0], args[fieldname])
                ref.parentfields = val[1]
                break

    return ref
コード例 #9
0
ファイル: stock_entry.py プロジェクト: andrewabel/erpnext
def get_return_doclist_and_details(args):
	ref = webnotes._dict()
	
	# get ref_doclist
	if args["purpose"] in return_map:
		for fieldname, val in return_map[args["purpose"]].items():
			if args.get(fieldname):
				ref.fieldname = fieldname
				ref.doclist = webnotes.get_doclist(val[0], args[fieldname])
				ref.parentfields = val[1]
				break
				
	return ref
コード例 #10
0
	def append_taxes(self):
		"""append taxes as per tax master link field"""
		# clear tax table
		self.doclist = self.doclist.get({"parentfield": ["!=",
			self.fmap.taxes_and_charges]})
		
		tax_master_doctype = self.meta.get_options(self.fmap.taxes_and_charges_master)
		master_tax_list = webnotes.get_doclist(tax_master_doctype,
			self.doc.fields.get(self.fmap.taxes_and_charges_master)).get(
			{"parentfield": self.fmap.taxes_and_charges})
			
		for base_tax in master_tax_list:
			tax = _dict([[field, base_tax.fields.get(field)]
				for field in base_tax.fields
				if field not in webnotes.model.default_fields])
			tax.update({
				"doctype": self.meta.get_options(self.fmap.taxes_and_charges),
				"parentfield": self.fmap.taxes_and_charges,
				"rate": flt(tax.rate, self.precision.tax.rate),
			})
			self.doclist.append(tax)