Merge branch 'develop' into develop-customer-item-price-report
This commit is contained in:
		
						commit
						4bf65dd0d9
					
				| @ -451,6 +451,10 @@ def make_customer_and_address(customers): | ||||
| 
 | ||||
| 
 | ||||
| def add_customer(data): | ||||
| 	customer = data.get('full_name') or data.get('customer') | ||||
| 	if frappe.db.exists("Customer", customer.strip()): | ||||
| 		return customer.strip() | ||||
| 
 | ||||
| 	customer_doc = frappe.new_doc('Customer') | ||||
| 	customer_doc.customer_name = data.get('full_name') or data.get('customer') | ||||
| 	customer_doc.customer_pos_id = data.get('customer_pos_id') | ||||
|  | ||||
| @ -730,7 +730,6 @@ def get_children(doctype, parent, company, is_root=False): | ||||
| 	parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_') | ||||
| 	fields = [ | ||||
| 		'name as value', | ||||
| 		'root_type', | ||||
| 		'is_group as expandable' | ||||
| 	] | ||||
| 	filters = [['docstatus', '<', 2]] | ||||
| @ -738,11 +737,11 @@ def get_children(doctype, parent, company, is_root=False): | ||||
| 	filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent]) | ||||
| 
 | ||||
| 	if is_root: | ||||
| 		fields += ['report_type', 'account_currency'] if doctype == 'Account' else [] | ||||
| 		fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else [] | ||||
| 		filters.append(['company', '=', company]) | ||||
| 
 | ||||
| 	else: | ||||
| 		fields += ['account_currency'] if doctype == 'Account' else [] | ||||
| 		fields += ['root_type', 'account_currency'] if doctype == 'Account' else [] | ||||
| 		fields += [parent_fieldname + ' as parent'] | ||||
| 
 | ||||
| 	acc = frappe.get_list(doctype, fields=fields, filters=filters) | ||||
|  | ||||
| @ -323,7 +323,7 @@ class calculate_taxes_and_totals(object): | ||||
| 		self._set_in_company_currency(self.doc, ["total_taxes_and_charges", "rounding_adjustment"]) | ||||
| 
 | ||||
| 		if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: | ||||
| 			self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \ | ||||
| 			self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate, self.doc.precision("base_grand_total")) \ | ||||
| 				if self.doc.total_taxes_and_charges else self.doc.base_net_total | ||||
| 		else: | ||||
| 			self.doc.taxes_and_charges_added = self.doc.taxes_and_charges_deducted = 0.0 | ||||
|  | ||||
| @ -16,18 +16,47 @@ erpnext.stock.ItemDashboard = Class.extend({ | ||||
| 		this.content = $(frappe.render_template('item_dashboard')).appendTo(this.parent); | ||||
| 		this.result = this.content.find('.result'); | ||||
| 
 | ||||
| 		// move
 | ||||
| 		this.content.on('click', '.btn-move', function() { | ||||
| 			erpnext.stock.move_item(unescape($(this).attr('data-item')), $(this).attr('data-warehouse'), | ||||
| 				null, $(this).attr('data-actual_qty'), null, function() { me.refresh(); }); | ||||
| 			handle_move_add($(this), "Move") | ||||
| 		}); | ||||
| 
 | ||||
| 		this.content.on('click', '.btn-add', function() { | ||||
| 			erpnext.stock.move_item(unescape($(this).attr('data-item')), null, $(this).attr('data-warehouse'), | ||||
| 				$(this).attr('data-actual_qty'), $(this).attr('data-rate'), | ||||
| 				function() { me.refresh(); }); | ||||
| 			handle_move_add($(this), "Add") | ||||
| 		}); | ||||
| 
 | ||||
| 		function handle_move_add(element, action) { | ||||
| 			let item = unescape(element.attr('data-item')); | ||||
| 			let warehouse = unescape(element.attr('data-warehouse')); | ||||
| 			let actual_qty = unescape(element.attr('data-actual_qty')); | ||||
| 			let disable_quick_entry = Number(unescape(element.attr('data-disable_quick_entry'))); | ||||
| 			let entry_type = action === "Move" ? "Material Transfer": null; | ||||
| 
 | ||||
| 			if (disable_quick_entry) { | ||||
| 				open_stock_entry(item, warehouse, entry_type); | ||||
| 			} else { | ||||
| 				if (action === "Add") { | ||||
| 					let rate = unescape($(this).attr('data-rate')); | ||||
| 					erpnext.stock.move_item(item, null, warehouse, actual_qty, rate, function() { me.refresh(); }); | ||||
| 				} | ||||
| 				else { | ||||
| 					erpnext.stock.move_item(item, warehouse, null, actual_qty, null, function() { me.refresh(); }); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		function open_stock_entry(item, warehouse, entry_type) { | ||||
| 			frappe.model.with_doctype('Stock Entry', function() { | ||||
| 				var doc = frappe.model.get_new_doc('Stock Entry'); | ||||
| 				if (entry_type) doc.stock_entry_type = entry_type; | ||||
| 
 | ||||
| 				var row = frappe.model.add_child(doc, 'items'); | ||||
| 				row.item_code = item; | ||||
| 				row.s_warehouse = warehouse; | ||||
| 
 | ||||
| 				frappe.set_route('Form', doc.doctype, doc.name); | ||||
| 			}) | ||||
| 		} | ||||
| 
 | ||||
| 		// more
 | ||||
| 		this.content.find('.btn-more').on('click', function() { | ||||
| 			me.start += 20; | ||||
|  | ||||
| @ -44,7 +44,9 @@ def get_data(item_code=None, warehouse=None, item_group=None, | ||||
| 
 | ||||
| 	for item in items: | ||||
| 		item.update({ | ||||
| 			'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name') | ||||
| 			'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name'), | ||||
| 			'disable_quick_entry': frappe.get_cached_value("Item", item.item_code, 'has_batch_no') | ||||
| 				or frappe.get_cached_value("Item", item.item_code, 'has_serial_no'), | ||||
| 		}) | ||||
| 
 | ||||
| 	return items | ||||
|  | ||||
| @ -43,11 +43,13 @@ | ||||
| 			<div class="col-sm-2 text-right" style="margin-top: 8px;"> | ||||
| 				{% if d.actual_qty %} | ||||
| 				<button class="btn btn-default btn-xs btn-move" | ||||
| 					data-disable_quick_entry="{{ d.disable_quick_entry }}" | ||||
| 					data-warehouse="{{ d.warehouse }}" | ||||
| 					data-actual_qty="{{ d.actual_qty }}" | ||||
| 					data-item="{{ escape(d.item_code) }}">{{ __("Move") }}</a> | ||||
| 				{% endif %} | ||||
| 				<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add" | ||||
| 					data-disable_quick_entry="{{ d.disable_quick_entry }}" | ||||
| 					data-warehouse="{{ d.warehouse }}" | ||||
| 					data-actual_qty="{{ d.actual_qty }}" | ||||
| 					data-item="{{ escape(d.item_code) }}" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user