fix patch after test, fix variant based on manufacturer, add json for item_manufacturer
This commit is contained in:
		
							parent
							
								
									3938c61996
								
							
						
					
					
						commit
						6eb202ef3a
					
				| @ -42,8 +42,10 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part | |||||||
| 
 | 
 | ||||||
| 	copy_attributes_to_variant(template, variant) | 	copy_attributes_to_variant(template, variant) | ||||||
| 
 | 
 | ||||||
| 	variant.manufacturer = manufacturer | 	variant.append("manufacturers", { | ||||||
| 	variant.manufacturer_part_no = manufacturer_part_no | 		"manufacturer": manufacturer, | ||||||
|  | 		"manufacturer_part_no": manufacturer_part_no | ||||||
|  | 	}) | ||||||
| 
 | 
 | ||||||
| 	variant.item_code = append_number_if_name_exists('Item', template.name) | 	variant.item_code = append_number_if_name_exists('Item', template.name) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,17 +1,25 @@ | |||||||
| # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | # Copyright (c) 2017, Frappe and Contributors | ||||||
| # License: GNU General Public License v3. See license.txt | # License: GNU General Public License v3. See license.txt | ||||||
| 
 | 
 | ||||||
| from __future__ import unicode_literals | from __future__ import unicode_literals | ||||||
| import frappe | import frappe | ||||||
| 
 | 
 | ||||||
| def execute(): | def execute(): | ||||||
|  | 
 | ||||||
|  |     # reading from json and writing it to mariadb | ||||||
|  |     # reload_doc needed here with information because new table introduced | ||||||
|  |     frappe.reload_doc('stock', 'doctype', 'item_manufacturer') | ||||||
|  |     # reload_doctype is a simpler concept of reload_doc | ||||||
|  |     frappe.reload_doctype('Item') | ||||||
|  | 
 | ||||||
|     item_manufacturers = frappe.get_all("Item", fields=["name", "manufacturer", "manufacturer_part_no"]) |     item_manufacturers = frappe.get_all("Item", fields=["name", "manufacturer", "manufacturer_part_no"]) | ||||||
|     for item in item_manufacturers: |     for item in item_manufacturers: | ||||||
|         item_doc = frappe.get_doc("Item", item.name) |         if item.manufacturer or item.manufacturer_part_no: | ||||||
|         item_doc.append("manufacturers", { |             item_doc = frappe.get_doc("Item", item.name) | ||||||
|             "manufacturer": item.manufacturer, |             item_doc.append("manufacturers", { | ||||||
|             "manufacturer_part_no": item.manufacturer_part_no |                 "manufacturer": item.manufacturer, | ||||||
|         }) |                 "manufacturer_part_no": item.manufacturer_part_no | ||||||
|         item_doc.flags.ignore_validate = True |             }) | ||||||
|         item_doc.flags.ignore_mandatory = True |             item_doc.flags.ignore_validate = True | ||||||
|         item_doc.save() |             item_doc.flags.ignore_mandatory = True | ||||||
|  |             item_doc.save() | ||||||
|  | |||||||
| @ -1533,7 +1533,7 @@ | |||||||
|    "bold": 0,  |    "bold": 0,  | ||||||
|    "collapsible": 1,  |    "collapsible": 1,  | ||||||
|    "columns": 0,  |    "columns": 0,  | ||||||
|    "fieldname": "manufacturer_details",  |    "fieldname": "manufacturer_part_numbers",  | ||||||
|    "fieldtype": "Section Break",  |    "fieldtype": "Section Break",  | ||||||
|    "hidden": 0,  |    "hidden": 0,  | ||||||
|    "ignore_user_permissions": 0,  |    "ignore_user_permissions": 0,  | ||||||
| @ -1542,7 +1542,7 @@ | |||||||
|    "in_global_search": 0,  |    "in_global_search": 0,  | ||||||
|    "in_list_view": 0,  |    "in_list_view": 0,  | ||||||
|    "in_standard_filter": 0,  |    "in_standard_filter": 0,  | ||||||
|    "label": "Manufacturer Details",  |    "label": "Manufacturer Part Numbers",  | ||||||
|    "length": 0,  |    "length": 0,  | ||||||
|    "no_copy": 0,  |    "no_copy": 0,  | ||||||
|    "permlevel": 0,  |    "permlevel": 0,  | ||||||
| @ -2837,7 +2837,7 @@ | |||||||
|  "issingle": 0,  |  "issingle": 0,  | ||||||
|  "istable": 0,  |  "istable": 0,  | ||||||
|  "max_attachments": 1,  |  "max_attachments": 1,  | ||||||
|  "modified": "2017-03-24 14:07:02.172008",  |  "modified": "2017-03-24 14:41:03.395811",  | ||||||
|  "modified_by": "d.ottenbreit@eso-electronic.de",  |  "modified_by": "d.ottenbreit@eso-electronic.de",  | ||||||
|  "module": "Stock",  |  "module": "Stock",  | ||||||
|  "name": "Item",  |  "name": "Item",  | ||||||
|  | |||||||
							
								
								
									
										0
									
								
								erpnext/stock/doctype/item_manufacturer/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								erpnext/stock/doctype/item_manufacturer/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										100
									
								
								erpnext/stock/doctype/item_manufacturer/item_manufacturer.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								erpnext/stock/doctype/item_manufacturer/item_manufacturer.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,100 @@ | |||||||
|  | { | ||||||
|  |  "allow_copy": 0,  | ||||||
|  |  "allow_guest_to_view": 0,  | ||||||
|  |  "allow_import": 0,  | ||||||
|  |  "allow_rename": 0,  | ||||||
|  |  "beta": 0,  | ||||||
|  |  "creation": "2017-03-24 14:05:42.026237",  | ||||||
|  |  "custom": 0,  | ||||||
|  |  "docstatus": 0,  | ||||||
|  |  "doctype": "DocType",  | ||||||
|  |  "document_type": "",  | ||||||
|  |  "editable_grid": 1,  | ||||||
|  |  "engine": "InnoDB",  | ||||||
|  |  "fields": [ | ||||||
|  |   { | ||||||
|  |    "allow_on_submit": 0,  | ||||||
|  |    "bold": 0,  | ||||||
|  |    "collapsible": 0,  | ||||||
|  |    "columns": 0,  | ||||||
|  |    "fieldname": "manufacturer",  | ||||||
|  |    "fieldtype": "Link",  | ||||||
|  |    "hidden": 0,  | ||||||
|  |    "ignore_user_permissions": 0,  | ||||||
|  |    "ignore_xss_filter": 0,  | ||||||
|  |    "in_filter": 0,  | ||||||
|  |    "in_global_search": 0,  | ||||||
|  |    "in_list_view": 1,  | ||||||
|  |    "in_standard_filter": 0,  | ||||||
|  |    "label": "Manufacturer",  | ||||||
|  |    "length": 0,  | ||||||
|  |    "no_copy": 0,  | ||||||
|  |    "options": "Manufacturer",  | ||||||
|  |    "permlevel": 0,  | ||||||
|  |    "precision": "",  | ||||||
|  |    "print_hide": 0,  | ||||||
|  |    "print_hide_if_no_value": 0,  | ||||||
|  |    "read_only": 0,  | ||||||
|  |    "remember_last_selected_value": 0,  | ||||||
|  |    "report_hide": 0,  | ||||||
|  |    "reqd": 1,  | ||||||
|  |    "search_index": 0,  | ||||||
|  |    "set_only_once": 0,  | ||||||
|  |    "unique": 0 | ||||||
|  |   },  | ||||||
|  |   { | ||||||
|  |    "allow_on_submit": 0,  | ||||||
|  |    "bold": 0,  | ||||||
|  |    "collapsible": 0,  | ||||||
|  |    "columns": 0,  | ||||||
|  |    "fieldname": "manufacturer_part_no",  | ||||||
|  |    "fieldtype": "Data",  | ||||||
|  |    "hidden": 0,  | ||||||
|  |    "ignore_user_permissions": 0,  | ||||||
|  |    "ignore_xss_filter": 0,  | ||||||
|  |    "in_filter": 0,  | ||||||
|  |    "in_global_search": 0,  | ||||||
|  |    "in_list_view": 1,  | ||||||
|  |    "in_standard_filter": 0,  | ||||||
|  |    "label": "Manufacturer Part Number",  | ||||||
|  |    "length": 0,  | ||||||
|  |    "no_copy": 0,  | ||||||
|  |    "permlevel": 0,  | ||||||
|  |    "precision": "",  | ||||||
|  |    "print_hide": 0,  | ||||||
|  |    "print_hide_if_no_value": 0,  | ||||||
|  |    "read_only": 0,  | ||||||
|  |    "remember_last_selected_value": 0,  | ||||||
|  |    "report_hide": 0,  | ||||||
|  |    "reqd": 0,  | ||||||
|  |    "search_index": 0,  | ||||||
|  |    "set_only_once": 0,  | ||||||
|  |    "unique": 0 | ||||||
|  |   } | ||||||
|  |  ],  | ||||||
|  |  "has_web_view": 0,  | ||||||
|  |  "hide_heading": 0,  | ||||||
|  |  "hide_toolbar": 0,  | ||||||
|  |  "idx": 0,  | ||||||
|  |  "image_view": 0,  | ||||||
|  |  "in_create": 0,  | ||||||
|  |  "is_submittable": 0,  | ||||||
|  |  "issingle": 0,  | ||||||
|  |  "istable": 1,  | ||||||
|  |  "max_attachments": 0,  | ||||||
|  |  "modified": "2017-03-24 14:33:56.726460",  | ||||||
|  |  "modified_by": "d.ottenbreit@eso-electronic.de",  | ||||||
|  |  "module": "Stock",  | ||||||
|  |  "name": "Item Manufacturer",  | ||||||
|  |  "name_case": "",  | ||||||
|  |  "owner": "d.ottenbreit@eso-electronic.de",  | ||||||
|  |  "permissions": [],  | ||||||
|  |  "quick_entry": 1,  | ||||||
|  |  "read_only": 0,  | ||||||
|  |  "read_only_onload": 0,  | ||||||
|  |  "show_name_in_global_search": 0,  | ||||||
|  |  "sort_field": "modified",  | ||||||
|  |  "sort_order": "DESC",  | ||||||
|  |  "track_changes": 1,  | ||||||
|  |  "track_seen": 0 | ||||||
|  | } | ||||||
							
								
								
									
										10
									
								
								erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | # -*- coding: utf-8 -*- | ||||||
|  | # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors | ||||||
|  | # For license information, please see license.txt | ||||||
|  | 
 | ||||||
|  | from __future__ import unicode_literals | ||||||
|  | import frappe | ||||||
|  | from frappe.model.document import Document | ||||||
|  | 
 | ||||||
|  | class ItemManufacturer(Document): | ||||||
|  | 	pass | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user