Ejemplo n.º 1
0
def create_child_testresult(parent,value,test_detail,label):
	from webnotes.model.doc import get
	if parent and value and label:
		doc = get('Test Results', parent)
		doclist = get('Test Results', parent, with_children=1)
		ch = addchild(doc[0], 'test_result_detail', 'Test Result Details', doclist)
		ch.test_name = test_detail.get("test")
		ch.test_values=value
		ch.parent=parent
		ch.spec_limits = test_detail.get('pgcil_limit')
		ch.test_method = test_detail.get('method')
		ch.particulors_of_test=label
		ch.save()
Ejemplo n.º 2
0
def fill_study_items(study):
    from webnotes.model.doc import get
    doc = get('Study', study)
    doclist = get('Study', study, with_children=1)
    item_list = webnotes.conn.sql(
        """select item, qty from `tabStudy Recipe Details`
                where parent = '%s'""" % study,
        as_list=1,
        debug=1)
    for item in item_list:
        std_item = addchild(doc[0], 'study_items', 'Encounter Study Item',
                            doclist)
        std_item.item_name = item[0]
        std_item.qty = item[1]
        std_item.save()
Ejemplo n.º 3
0
	def post(self):
		"""
			Save diff between Customize Form Bean and DocType Bean as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from webnotes.core.doctype.doctype.doctype import validate_fields_for_doctype
			
			this_doclist = webnotes.doclist([self.doc] + self.doclist)
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			self.idx_dirty = False
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			if self.idx_dirty:
				self.make_idx_property_setter(this_doclist, diff_list)
			
			self.set_properties(diff_list)

			validate_fields_for_doctype(self.doc.doc_type)

			webnotes.clear_cache(doctype=self.doc.doc_type)
			webnotes.msgprint("Updated")
Ejemplo n.º 4
0
def create_gl_entry(jv, remark, company,cancel=0, adv_adj=0):
	from accounts.general_ledger import make_gl_entries
	from webnotes.model.doc import get
	from webnotes.utils import today

	gl_map = []
	for d in get('Journal Voucher', jv).get({"parentfield": "entries"}):
		if d.debit or d.credit:
			gl_map.append(
				get_gl_dict({
					"account": d.account,
					"against": d.against_account,
					"debit": d.debit,
					"credit": d.credit,
					"against_voucher_type": ((d.against_voucher and "Purchase Invoice") 
						or (d.against_invoice and "Sales Invoice") 
						or (d.against_jv and "Journal Voucher")),
					"against_voucher": d.against_voucher or d.against_invoice or d.against_jv,
					"remarks": remark,
					"cost_center": d.cost_center,
					'company': company,
					'posting_date': today(),
					'voucher_type': 'Journal Voucher',
					'voucher_no': jv,
					'aging_date': today(),
					'fiscal_year':  webnotes.conn.get_value('Global Defaults',None,'current_fiscal_year'),
				})
			)
	if gl_map:
		make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj)
Ejemplo n.º 5
0
	def create_child_test_preparation(self, samples, test_name, parent):
		temp = 0
		childtab = {'Neutralization Value':['neutralisation_test_details', 'Neutralization Test Details']}
		from webnotes.model.doc import get
		if parent and samples:
			doc = get('Neutralization Value' if test_name=='Neutralization Value' else 'Test Preparation', parent)
			doclist = get('Neutralization Value' if test_name=='Neutralization Value' else 'Test Preparation', parent, with_children=1)
			for sample in samples:
				ch = addchild(doc[0], childtab.get(test_name)[0] if childtab.get(test_name) else 'sample_details', childtab.get(test_name)[1] if childtab.get(test_name) else 'Sample Preparation Details', doclist)
				ch.sample_no = sample
				ch.bottle_no= webnotes.conn.get_value("Sample", sample, "barcode")
				if test_name != 'Neutralization Value': 
					ch.tester=self.doc.tester 
				ch.save()
				temp = get_temp(sample)
				
			d = Document('Neutralization Value' if test_name=='Neutralization Value' else 'Test Preparation', parent)
			d.temperature = temp
			d.save()
Ejemplo n.º 6
0
	def get_ref_doclist(self):
		"""
			* Gets doclist of type self.doc.doc_type
			* Applies property setter properties on the doclist
			* returns the modified doclist
		"""
		from webnotes.model.doctype import _DocType
		from webnotes.model.doc import get
		
		ref_doclist = get('DocType', self.true_doctype)
		_DocType(self.true_doctype)._override_field_properties(ref_doclist)
		
		return ref_doclist
Ejemplo n.º 7
0
    def get_ref_doclist(self):
        """
			* Gets doclist of type self.doc.doc_type
			* Applies property setter properties on the doclist
			* returns the modified doclist
		"""
        from webnotes.model.doctype import _DocType
        from webnotes.model.doc import get

        ref_doclist = get('DocType', self.doc.doc_type)
        _DocType(self.doc.doc_type)._override_field_properties(ref_doclist)

        return ref_doclist
Ejemplo n.º 8
0
	def post(self):
		"""
			Save diff between DocLayer DocList and DocType DocList as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from webnotes.model.doctype import get
			
			this_doclist = [self.doc] + self.doclist
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.true_doctype)
			
			# get a list of property setter docs
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			self.set_properties(diff_list)
Ejemplo n.º 9
0
    def post(self):
        """
			Save diff between DocLayer DocList and DocType DocList as property setter entries
		"""
        if self.doc.doc_type:
            from webnotes.model import doc
            from webnotes.model.doctype import get

            this_doclist = [self.doc] + self.doclist
            ref_doclist = self.get_ref_doclist()
            dt_doclist = doc.get('DocType', self.doc.doc_type)

            # get a list of property setter docs
            diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)

            self.set_properties(diff_list)
Ejemplo n.º 10
0
def create_gl_entry(jv, remark, company, cancel=0, adv_adj=0):
    from accounts.general_ledger import make_gl_entries
    from webnotes.model.doc import get
    from webnotes.utils import today

    gl_map = []
    for d in get('Journal Voucher', jv).get({"parentfield": "entries"}):
        if d.debit or d.credit:
            gl_map.append(
                get_gl_dict({
                    "account":
                    d.account,
                    "against":
                    d.against_account,
                    "debit":
                    d.debit,
                    "credit":
                    d.credit,
                    "against_voucher_type":
                    ((d.against_voucher and "Purchase Invoice")
                     or (d.against_invoice and "Sales Invoice")
                     or (d.against_jv and "Journal Voucher")),
                    "against_voucher":
                    d.against_voucher or d.against_invoice or d.against_jv,
                    "remarks":
                    remark,
                    "cost_center":
                    d.cost_center,
                    'company':
                    company,
                    'posting_date':
                    today(),
                    'voucher_type':
                    'Journal Voucher',
                    'voucher_no':
                    jv,
                    'aging_date':
                    today(),
                    'fiscal_year':
                    webnotes.conn.get_value('Global Defaults', None,
                                            'current_fiscal_year'),
                }))
    if gl_map:
        make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj)
	def post(self):
		"""
			Save diff between Customize Form ModelWrapper and DocType ModelWrapper as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from core.doctype.doctype.doctype import validate_fields_for_doctype
			
			this_doclist = webnotes.doclist([self.doc] + self.doclist)
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			self.set_properties(diff_list)

			validate_fields_for_doctype(self.doc.doc_type)

			webnotes.clear_cache(doctype=self.doc.doc_type)
Ejemplo n.º 12
0
	def post(self):
		"""
			Save diff between Customize Form DocList and DocType DocList as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from webnotes.model.doctype import get
			
			this_doclist = [self.doc] + self.doclist
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			self.set_properties(diff_list)

			from webnotes.utils.cache import CacheItem
			CacheItem(self.doc.doc_type).clear()
			CacheItem('tags-' + self.doc.doc_type).clear()
Ejemplo n.º 13
0
	def post(self):
		"""
			Save diff between Customize Form ModelWrapper and DocType ModelWrapper as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from core.doctype.doctype.doctype import validate_fields_for_doctype
			
			this_doclist = webnotes.doclist([self.doc] + self.doclist)
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			self.set_properties(diff_list)

			validate_fields_for_doctype(self.doc.doc_type)

			webnotes.clear_cache(doctype=self.doc.doc_type)