Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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
Exemple #4
0
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
Exemple #5
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)
Exemple #6
0
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))
Exemple #7
0
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))
Exemple #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
Exemple #9
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
	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)