Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive

This commit is contained in:
Nabin Hait 2013-07-04 16:03:24 +05:30
commit 9010f92eab
30 changed files with 572 additions and 347 deletions

View File

@ -1,122 +1,122 @@
[ [
{ {
"owner": "Administrator",
"docstatus": 0,
"creation": "2010-08-08 17:09:35", "creation": "2010-08-08 17:09:35",
"docstatus": 0,
"modified": "2013-07-03 18:00:40",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-04-03 12:49:50" "owner": "Administrator"
}, },
{ {
"name": "__common__",
"parent": "Purchase Order-Purchase Invoice",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"parenttype": "DocType Mapper",
"parentfield": "table_mapper_details"
},
{
"name": "__common__", "name": "__common__",
"parent": "Purchase Order-Purchase Invoice", "parent": "Purchase Order-Purchase Invoice",
"doctype": "Field Mapper Detail", "parentfield": "table_mapper_details",
"parenttype": "DocType Mapper", "parenttype": "DocType Mapper"
"parentfield": "field_mapper_details"
}, },
{ {
"doctype": "Field Mapper Detail",
"name": "__common__", "name": "__common__",
"to_doctype": "Purchase Invoice", "parent": "Purchase Order-Purchase Invoice",
"module": "Accounts", "parentfield": "field_mapper_details",
"parenttype": "DocType Mapper"
},
{
"doctype": "DocType Mapper", "doctype": "DocType Mapper",
"from_doctype": "Purchase Order",
"module": "Accounts",
"name": "__common__",
"ref_doc_submitted": 1, "ref_doc_submitted": 1,
"from_doctype": "Purchase Order" "to_doctype": "Purchase Invoice"
}, },
{ {
"name": "Purchase Order-Purchase Invoice", "doctype": "DocType Mapper",
"doctype": "DocType Mapper" "name": "Purchase Order-Purchase Invoice"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt)) / obj.purchase_rate",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "qty", "to_field": "qty"
"doctype": "Field Mapper Detail",
"from_field": "eval: flt(obj.qty) - flt(obj.billed_qty)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "purchase_rate",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "rate", "to_field": "rate"
"doctype": "Field Mapper Detail",
"from_field": "purchase_rate"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: flt(obj.amount) - flt(obj.billed_amt)",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "amount", "to_field": "amount"
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt)) / flt(obj.conversion_rate)",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "import_amount", "to_field": "import_amount"
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "parent",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "purchase_order", "to_field": "purchase_order"
"doctype": "Field Mapper Detail",
"from_field": "parent"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "name",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "po_detail", "to_field": "po_detail"
"doctype": "Field Mapper Detail",
"from_field": "name"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "naming_series",
"map": "No", "map": "No",
"match_id": 0, "match_id": 0,
"to_field": "naming_series", "to_field": "naming_series"
"doctype": "Field Mapper Detail",
"from_field": "naming_series"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "total_tax",
"map": "Yes", "map": "Yes",
"match_id": 0, "match_id": 0,
"to_field": "total_tax", "to_field": "total_tax"
"doctype": "Field Mapper Detail",
"from_field": "total_tax"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "conversion_rate",
"map": "Yes", "map": "Yes",
"match_id": 0, "match_id": 0,
"to_field": "conversion_rate", "to_field": "conversion_rate"
"doctype": "Field Mapper Detail",
"from_field": "conversion_rate"
}, },
{ {
"match_id": 0,
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_table": "Purchase Order", "from_table": "Purchase Order",
"match_id": 0,
"to_table": "Purchase Invoice", "to_table": "Purchase Invoice",
"validation_logic": "docstatus =1" "validation_logic": "docstatus =1"
}, },
{ {
"match_id": 1,
"to_field": "entries",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_field": "po_details", "from_field": "po_details",
"from_table": "Purchase Order Item", "from_table": "Purchase Order Item",
"match_id": 1,
"to_field": "entries",
"to_table": "Purchase Invoice Item", "to_table": "Purchase Invoice Item",
"validation_logic": "ifnull(billed_qty,0) < qty and docstatus = 1" "validation_logic": "ifnull(billed_amt,0) < amount and docstatus = 1"
}, },
{ {
"match_id": 2,
"to_field": "purchase_tax_details",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_field": "purchase_tax_details", "from_field": "purchase_tax_details",
"from_table": "Purchase Taxes and Charges", "from_table": "Purchase Taxes and Charges",
"match_id": 2,
"to_field": "purchase_tax_details",
"to_table": "Purchase Taxes and Charges", "to_table": "Purchase Taxes and Charges",
"validation_logic": "docstatus =1" "validation_logic": "docstatus =1"
} }

View File

@ -1,143 +1,143 @@
[ [
{ {
"owner": "Administrator",
"docstatus": 0,
"creation": "2010-08-08 17:09:35", "creation": "2010-08-08 17:09:35",
"docstatus": 0,
"modified": "2013-07-03 17:56:30",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-04-03 12:49:50" "owner": "Administrator"
}, },
{ {
"name": "__common__",
"parent": "Purchase Receipt-Purchase Invoice",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"parenttype": "DocType Mapper",
"parentfield": "table_mapper_details"
},
{
"name": "__common__", "name": "__common__",
"parent": "Purchase Receipt-Purchase Invoice", "parent": "Purchase Receipt-Purchase Invoice",
"doctype": "Field Mapper Detail", "parentfield": "table_mapper_details",
"parenttype": "DocType Mapper", "parenttype": "DocType Mapper"
"parentfield": "field_mapper_details"
}, },
{ {
"doctype": "Field Mapper Detail",
"name": "__common__", "name": "__common__",
"to_doctype": "Purchase Invoice", "parent": "Purchase Receipt-Purchase Invoice",
"module": "Accounts", "parentfield": "field_mapper_details",
"parenttype": "DocType Mapper"
},
{
"doctype": "DocType Mapper", "doctype": "DocType Mapper",
"from_doctype": "Purchase Receipt",
"module": "Accounts",
"name": "__common__",
"ref_doc_submitted": 1, "ref_doc_submitted": 1,
"from_doctype": "Purchase Receipt" "to_doctype": "Purchase Invoice"
}, },
{ {
"name": "Purchase Receipt-Purchase Invoice", "doctype": "DocType Mapper",
"doctype": "DocType Mapper" "name": "Purchase Receipt-Purchase Invoice"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt)) / obj.purchase_rate",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "qty", "to_field": "qty"
"doctype": "Field Mapper Detail",
"from_field": "eval: flt(obj.qty) - flt(obj.billed_qty)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "purchase_rate",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "rate", "to_field": "rate"
"doctype": "Field Mapper Detail",
"from_field": "purchase_rate"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: flt(obj.amount) - flt(obj.billed_amt)",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "amount", "to_field": "amount"
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt)) / flt(obj.conversion_rate)",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "import_amount", "to_field": "import_amount"
"doctype": "Field Mapper Detail",
"from_field": "eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "parent",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "purchase_receipt", "to_field": "purchase_receipt"
"doctype": "Field Mapper Detail",
"from_field": "parent"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "prevdoc_docname",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "purchase_order", "to_field": "purchase_order"
"doctype": "Field Mapper Detail",
"from_field": "prevdoc_docname"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "name",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "pr_detail", "to_field": "pr_detail"
"doctype": "Field Mapper Detail",
"from_field": "name"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "prevdoc_detail_docname",
"map": "Yes", "map": "Yes",
"match_id": 1, "match_id": 1,
"to_field": "po_detail", "to_field": "po_detail"
"doctype": "Field Mapper Detail",
"from_field": "prevdoc_detail_docname"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "naming_series",
"map": "No", "map": "No",
"match_id": 0, "match_id": 0,
"to_field": "naming_series", "to_field": "naming_series"
"doctype": "Field Mapper Detail",
"from_field": "naming_series"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "net_total",
"map": "Yes", "map": "Yes",
"match_id": 0, "match_id": 0,
"to_field": "net_total", "to_field": "net_total"
"doctype": "Field Mapper Detail",
"from_field": "net_total"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "grand_total",
"map": "Yes", "map": "Yes",
"match_id": 0, "match_id": 0,
"to_field": "grand_total", "to_field": "grand_total"
"doctype": "Field Mapper Detail",
"from_field": "grand_total"
}, },
{ {
"doctype": "Field Mapper Detail",
"from_field": "total_tax",
"map": "Yes", "map": "Yes",
"match_id": 0, "match_id": 0,
"to_field": "total_tax", "to_field": "total_tax"
"doctype": "Field Mapper Detail",
"from_field": "total_tax"
}, },
{ {
"match_id": 1,
"to_field": "entries",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_field": "purchase_receipt_details", "from_field": "purchase_receipt_details",
"from_table": "Purchase Receipt Item", "from_table": "Purchase Receipt Item",
"match_id": 1,
"to_field": "entries",
"to_table": "Purchase Invoice Item", "to_table": "Purchase Invoice Item",
"validation_logic": "ifnull(billed_qty,0) < qty" "validation_logic": "ifnull(billed_amt,0) < amount"
}, },
{ {
"match_id": 0,
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_table": "Purchase Receipt", "from_table": "Purchase Receipt",
"match_id": 0,
"to_table": "Purchase Invoice", "to_table": "Purchase Invoice",
"validation_logic": "docstatus=1" "validation_logic": "docstatus=1"
}, },
{ {
"match_id": 2,
"to_field": "purchase_tax_details",
"doctype": "Table Mapper Detail", "doctype": "Table Mapper Detail",
"from_field": "purchase_tax_details", "from_field": "purchase_tax_details",
"from_table": "Purchase Taxes and Charges", "from_table": "Purchase Taxes and Charges",
"match_id": 2,
"to_field": "purchase_tax_details",
"to_table": "Purchase Taxes and Charges", "to_table": "Purchase Taxes and Charges",
"validation_logic": "docstatus=1" "validation_logic": "docstatus=1"
} }

View File

@ -53,6 +53,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}); });
}, },
refresh: function(doc) {
this.frm.toggle_display("supplier_name",
(this.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));
this._super();
},
supplier: function() { supplier: function() {
if(this.frm.doc.supplier || this.frm.doc.credit_to) { if(this.frm.doc.supplier || this.frm.doc.credit_to) {
if(!this.frm.doc.company) { if(!this.frm.doc.company) {

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-21 16:16:39", "creation": "2013-05-21 16:16:39",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-11 16:05:08", "modified": "2013-07-04 10:48:54",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -39,6 +39,13 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Purchase Order" "name": "Purchase Order"
}, },
{
"doctype": "DocField",
"fieldname": "supplier_section",
"fieldtype": "Section Break",
"label": "Supplier",
"options": "icon-user"
},
{ {
"description": "To manage multiple series please go to Setup > Manage Series", "description": "To manage multiple series please go to Setup > Manage Series",
"doctype": "DocField", "doctype": "DocField",
@ -67,7 +74,6 @@
"search_index": 1 "search_index": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -77,38 +83,34 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Address", "label": "Address",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Contact", "label": "Contact",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Mobile No", "label": "Mobile No",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Contact Email", "label": "Contact Email",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
@ -139,7 +141,8 @@
"fieldname": "items", "fieldname": "items",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items", "label": "Items",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
@ -155,8 +158,7 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sb_last_purchase", "fieldname": "sb_last_purchase",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"options": "Simple"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -238,7 +240,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "price_list_and_currency", "fieldname": "price_list_and_currency",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Currency & Price List" "label": "Currency & Price List",
"options": "icon-tag"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -309,6 +312,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Taxes", "label": "Taxes",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-money",
"print_hide": 0 "print_hide": 0
}, },
{ {
@ -364,7 +368,8 @@
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Totals", "label": "Totals",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-money"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -523,7 +528,8 @@
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Terms and Conditions", "label": "Terms and Conditions",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-legal"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -555,7 +561,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_section", "fieldname": "contact_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Contact Info" "label": "Contact Info",
"options": "icon-bullhorn"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -759,8 +766,9 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "raw_material_details", "fieldname": "raw_material_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Raw Material Details", "label": "Raw Materials Supplied",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-truck",
"print_hide": 1 "print_hide": 1
}, },
{ {

View File

@ -45,7 +45,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
} }
cur_frm.cscript.make_dashboard = function(doc) { cur_frm.cscript.make_dashboard = function(doc) {
cur_frm.dashboard.wrapper.empty().toggle(doc.__islocal ? false : true); cur_frm.dashboard.reset();
if(doc.__islocal) if(doc.__islocal)
return; return;
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>') cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:11", "creation": "2013-01-10 16:34:11",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-29 14:35:42", "modified": "2013-07-04 10:13:19",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -46,7 +46,8 @@
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Basic Info", "label": "Basic Info",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-user"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -91,7 +92,8 @@
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Address & Contacts", "label": "Address & Contacts",
"oldfieldtype": "Column Break" "oldfieldtype": "Column Break",
"options": "icon-map-marker"
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
@ -132,7 +134,9 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "communication_history", "fieldname": "communication_history",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -145,7 +149,8 @@
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-file-text"
}, },
{ {
"description": "Enter the company name under which Account Head will be created for this Supplier", "description": "Enter the company name under which Account Head will be created for this Supplier",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-21 16:16:45", "creation": "2013-05-21 16:16:45",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-11 16:05:53", "modified": "2013-07-04 10:51:05",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -39,6 +39,13 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Supplier Quotation" "name": "Supplier Quotation"
}, },
{
"doctype": "DocField",
"fieldname": "supplier_section",
"fieldtype": "Section Break",
"label": "Supplier",
"options": "icon-user"
},
{ {
"description": "To manage multiple series please go to Setup > Manage Series", "description": "To manage multiple series please go to Setup > Manage Series",
"doctype": "DocField", "doctype": "DocField",
@ -67,7 +74,6 @@
"search_index": 1 "search_index": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "supplier_name", "fieldname": "supplier_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -77,38 +83,34 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Address", "label": "Address",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Contact", "label": "Contact",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Mobile No", "label": "Mobile No",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "supplier",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Contact Email", "label": "Contact Email",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
@ -139,7 +141,8 @@
"fieldname": "items", "fieldname": "items",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items", "label": "Items",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
@ -155,8 +158,7 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "section_break0", "fieldname": "section_break0",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"options": "Simple"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -168,8 +170,7 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "section_break_14", "fieldname": "section_break_14",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"options": "Simple"
}, },
{ {
"description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.", "description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.",
@ -197,7 +198,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "currency_price_list", "fieldname": "currency_price_list",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Currency & Price List" "label": "Currency & Price List",
"options": "icon-tag"
}, },
{ {
"description": "Supplier's currency", "description": "Supplier's currency",
@ -264,7 +266,8 @@
"fieldname": "taxes", "fieldname": "taxes",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Taxes", "label": "Taxes",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-money"
}, },
{ {
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
@ -319,7 +322,8 @@
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Totals", "label": "Totals",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-money"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -478,7 +482,8 @@
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Terms and Conditions", "label": "Terms and Conditions",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-legal"
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
@ -512,7 +517,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "terms", "fieldname": "terms",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"label": "Terms and Conditions1", "label": "Terms and Conditions",
"oldfieldname": "terms", "oldfieldname": "terms",
"oldfieldtype": "Text Editor" "oldfieldtype": "Text Editor"
}, },
@ -521,7 +526,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_section", "fieldname": "contact_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Contact Info" "label": "Contact Info",
"options": "icon-bullhorn"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -546,7 +552,8 @@
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-file-text"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -585,6 +592,11 @@
"read_only": 1, "read_only": 1,
"report_hide": 0 "report_hide": 0
}, },
{
"doctype": "DocField",
"fieldname": "column_break_57",
"fieldtype": "Column Break"
},
{ {
"description": "Select the relevant company name if you have multiple companies", "description": "Select the relevant company name if you have multiple companies",
"doctype": "DocField", "doctype": "DocField",

View File

@ -262,7 +262,9 @@ class SellingController(StockController):
def validate_order_type(self): def validate_order_type(self):
valid_types = ["Sales", "Maintenance", "Shopping Cart"] valid_types = ["Sales", "Maintenance", "Shopping Cart"]
if self.doc.order_type not in valid_types: if not self.doc.order_type:
self.doc.order_type = "Sales"
elif self.doc.order_type not in valid_types:
msgprint(_(self.meta.get_label("order_type")) + " " + msgprint(_(self.meta.get_label("order_type")) + " " +
_("must be one of") + ": " + comma_or(valid_types), _("must be one of") + ": " + comma_or(valid_types),
raise_exception=True) raise_exception=True)

View File

@ -20,20 +20,19 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
} }
cur_frm.cscript.refresh = function(doc, dt, dn) { cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.dashboard.reset();
erpnext.hide_naming_series(); erpnext.hide_naming_series();
cur_frm.set_intro(""); cur_frm.set_intro("");
cfn_set_fields(doc, dt, dn); cfn_set_fields(doc, dt, dn);
if(doc.docstatus===0 && !doc.__islocal) { if(doc.docstatus===0 && !doc.__islocal) {
cur_frm.set_intro("Submit this Production Order for further processing."); cur_frm.set_intro("Submit this Production Order for further processing.");
} else if(doc.docstatus===1) { } else if(doc.docstatus===1) {
var percent = flt(doc.produced_qty) / doc.qty * 100;
cur_frm.dashboard.add_progress(cint(percent) + "% " + wn._("Complete"));
if(doc.status === "Stopped") { if(doc.status === "Stopped") {
cur_frm.set_intro("This Production Order is Stopped."); cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");
} else {
if(doc.produced_qty == doc.qty) {
cur_frm.set_intro("This Production Order is Completed.");
} else {
cur_frm.set_intro("This Production Order is in progress.");
}
} }
} }
} }
@ -88,6 +87,12 @@ cur_frm.cscript.make_se = function(doc, purpose) {
var se = wn.model.get_new_doc("Stock Entry"); var se = wn.model.get_new_doc("Stock Entry");
se.purpose = purpose; se.purpose = purpose;
se.production_order = doc.name; se.production_order = doc.name;
if(purpose==="Material Transfer") {
se.to_warehouse = doc.wip_warehouse;
} else {
se.from_warehouse = doc.wip_warehouse;
se.to_warehouse = doc.fg_warehouse;
}
se.company = doc.company; se.company = doc.company;
se.fg_completed_qty = doc.qty - doc.produced_qty; se.fg_completed_qty = doc.qty - doc.produced_qty;
se.bom_no = doc.bom_no; se.bom_no = doc.bom_no;

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:16", "creation": "2013-01-10 16:34:16",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-02 11:56:54", "modified": "2013-07-03 17:00:29",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -42,6 +42,13 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Production Order" "name": "Production Order"
}, },
{
"doctype": "DocField",
"fieldname": "item",
"fieldtype": "Section Break",
"label": "Item",
"options": "icon-gift"
},
{ {
"default": "PRO", "default": "PRO",
"doctype": "DocField", "doctype": "DocField",
@ -51,22 +58,6 @@
"options": "\nPRO", "options": "\nPRO",
"reqd": 1 "reqd": 1
}, },
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "status",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"read_only": 1,
"reqd": 1,
"search_index": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "production_item", "fieldname": "production_item",
@ -95,24 +86,12 @@
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "production_item", "default": "1",
"description": "Manufactured quantity will be updated in this warehouse", "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "fg_warehouse", "fieldname": "use_multi_level_bom",
"fieldtype": "Link", "fieldtype": "Check",
"in_list_view": 1, "label": "Use Multi-Level BOM"
"label": "For Warehouse",
"options": "Warehouse",
"read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"reqd": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -122,6 +101,15 @@
"read_only": 0, "read_only": 0,
"width": "50%" "width": "50%"
}, },
{
"description": "Manufacture against Sales Order",
"doctype": "DocField",
"fieldname": "sales_order",
"fieldtype": "Link",
"label": "Sales Order",
"options": "Sales Order",
"read_only": 0
},
{ {
"depends_on": "production_item", "depends_on": "production_item",
"doctype": "DocField", "doctype": "DocField",
@ -147,38 +135,60 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "production_item",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "stock_uom", "fieldname": "warehouses",
"fieldtype": "Data", "fieldtype": "Section Break",
"label": "Stock UOM", "label": "Warehouses",
"oldfieldname": "stock_uom", "options": "icon-building"
"oldfieldtype": "Data",
"read_only": 1
}, },
{ {
"default": "1", "depends_on": "production_item",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", "description": "Manufactured quantity will be updated in this warehouse",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "use_multi_level_bom", "fieldname": "fg_warehouse",
"fieldtype": "Check", "fieldtype": "Link",
"label": "Use Multi-Level BOM" "in_list_view": 1,
"label": "For Warehouse",
"options": "Warehouse",
"read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"reqd": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"options": "icon-file-text",
"read_only": 0 "read_only": 0
}, },
{ {
"description": "Manufacture against Sales Order", "depends_on": "eval:!doc.__islocal",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sales_order", "fieldname": "status",
"fieldtype": "Link", "fieldtype": "Select",
"label": "Sales Order", "in_filter": 1,
"options": "Sales Order", "in_list_view": 1,
"read_only": 0 "label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"read_only": 1,
"reqd": 1,
"search_index": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -205,6 +215,16 @@
"read_only": 0, "read_only": 0,
"width": "50%" "width": "50%"
}, },
{
"depends_on": "production_item",
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"label": "Stock UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
"read_only": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "company", "fieldname": "company",

View File

@ -63,7 +63,8 @@ class DocType:
def on_update(self): def on_update(self):
"""update percent complete in project""" """update percent complete in project"""
if self.doc.project: if self.doc.project:
webnotes.bean("Project", self.doc.project).controller.update_percent_complete() project = webnotes.bean("Project", self.doc.project)
project.run_method("update_percent_complete")
@webnotes.whitelist() @webnotes.whitelist()
def get_events(start, end, filters=None): def get_events(start, end, filters=None):

View File

@ -99,38 +99,10 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm}));
cur_frm.cscript['Create Customer'] = function(){ cur_frm.cscript['Create Customer'] = function(){
var doc = cur_frm.doc; wn.model.open_mapped_doc({
$c('runserverobj',args={ 'method':'check_status', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))}, method: "selling.doctype.lead.lead.make_customer",
function(r,rt){ source_name: cur_frm.doc.name
if(r.message == 'Converted'){ })
msgprint("This lead is already converted to customer");
}
else{
n = wn.model.make_new_doc_and_get_name("Customer");
$c('dt_map', args={
'docs':wn.model.compress([locals["Customer"][n]]),
'from_doctype':'Lead',
'to_doctype':'Customer',
'from_docname':doc.name,
'from_to_list':"[['Lead', 'Customer']]"
},
function(r,rt) {
wn.model.with_doctype("Customer", function() {
var customer = wn.model.get_doc("Customer", n);
var customer_copy = $.extend({}, customer);
var updated = wn.model.set_default_values(customer_copy);
$.each(updated, function(i, f) {
if(!customer[f]) customer[f] = customer_copy[f];
});
loaddoc("Customer", n);
});
}
);
}
}
);
} }
// Create New Opportunity // Create New Opportunity

View File

@ -95,4 +95,24 @@ class DocType(SellingController):
webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""", webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""",
self.doc.name) self.doc.name)
self.delete_events() self.delete_events()
@webnotes.whitelist()
def make_customer(source_name, target_doclist=None):
from webnotes.model.mapper import get_mapped_doclist
if target_doclist:
target_doclist = json.loads(target_doclist)
doclist = get_mapped_doclist("Lead", source_name,
{"Lead": {
"doctype": "Customer",
"field_map": {
"name": "lead_name",
"company_name": "customer_name",
"contact_no": "phone_1",
"fax": "fax_1"
}
}}, target_doclist)
return [d.fields for d in doclist]

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
test_records = [ test_records = [
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open", [{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
"email_id":"test_lead@example.com"}], "email_id":"test_lead@example.com"}],
@ -8,3 +10,17 @@ test_records = [
[{"doctype":"Lead", "lead_name": "_Test Lead 3", "status":"Converted", [{"doctype":"Lead", "lead_name": "_Test Lead 3", "status":"Converted",
"email_id":"test_lead3@example.com"}], "email_id":"test_lead3@example.com"}],
] ]
import webnotes
import unittest
class TestLead(unittest.TestCase):
def test_make_customer(self):
from selling.doctype.lead.lead import make_customer
customer = make_customer("_T-Lead-00001")
self.assertEquals(customer[0]["doctype"], "Customer")
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
webnotes.bean(customer).insert()

View File

@ -25,8 +25,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign"); cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
} else if(doc.status=="Opportunity Lost") { } else if(doc.status=="Opportunity Lost") {
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign"); cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
} else {
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
} }
} }

View File

@ -43,8 +43,6 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign"); cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
} else if(doc.status==="Order Lost") { } else if(doc.status==="Order Lost") {
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign"); cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
} else {
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
} }
} }
@ -121,20 +119,10 @@ cur_frm.fields_dict['enq_no'].get_query = function(doc,cdt,cdn){
// Make Sales Order // Make Sales Order
// ===================================================================================== // =====================================================================================
cur_frm.cscript['Make Sales Order'] = function() { cur_frm.cscript['Make Sales Order'] = function() {
var doc = cur_frm.doc; wn.model.open_mapped_doc({
method: "selling.doctype.quotation.quotation.make_sales_order",
if (doc.docstatus == 1) { source_name: cur_frm.doc.name
var n = wn.model.make_new_doc_and_get_name("Sales Order"); })
$c('dt_map', args={
'docs':wn.model.compress([locals["Sales Order"][n]]),
'from_doctype':'Quotation',
'to_doctype':'Sales Order',
'from_docname':doc.name,
'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Item', 'Sales Order Item'],['Sales Taxes and Charges','Sales Taxes and Charges'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"
}, function(r,rt) {
loaddoc("Sales Order", n);
});
}
} }
//pull enquiry details //pull enquiry details

View File

@ -154,8 +154,11 @@ class DocType(SellingController):
super(DocType, self).validate() super(DocType, self).validate()
import utilities import utilities
utilities.validate_status(self.doc.status, ["Draft", "Submitted", if not self.doc.status:
"Order Confirmed", "Order Lost", "Cancelled"]) self.doc.status = "Draft"
else:
utilities.validate_status(self.doc.status, ["Draft", "Submitted",
"Order Confirmed", "Order Lost", "Cancelled"])
self.validate_fiscal_year() self.validate_fiscal_year()
self.set_last_contact_date() self.set_last_contact_date()
@ -247,3 +250,37 @@ class DocType(SellingController):
sql("delete from `tabCommunication Log` where parent = '%s'"%self.doc.name) sql("delete from `tabCommunication Log` where parent = '%s'"%self.doc.name)
for d in getlist(self.doclist, 'follow_up'): for d in getlist(self.doclist, 'follow_up'):
d.save() d.save()
@webnotes.whitelist()
def make_sales_order(source_name, target_doclist=None):
from webnotes.model.mapper import get_mapped_doclist
if target_doclist:
target_doclist = json.loads(target_doclist)
doclist = get_mapped_doclist("Quotation", source_name, {
"Quotation": {
"doctype": "Sales Order",
"field_map": {
"name": "quotation_no",
"transaction_date": "quotation_date"
},
"validation": {
"docstatus": ["=", 1]
}
},
"Quotation Item": {
"doctype": "Sales Order Item",
"field_map": {
"parent": "prevdoc_docname"
}
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
},
"Sales Team": {
"doctype": "Sales Team",
}
}, target_doclist)
return [d.fields for d in doclist]

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-24 19:29:08", "creation": "2013-05-24 19:29:08",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-03 11:54:11", "modified": "2013-07-04 10:56:10",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -114,7 +114,6 @@
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "customer_name", "fieldname": "customer_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -237,7 +236,7 @@
"fieldname": "section_break0", "fieldname": "section_break0",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Price List and Currency", "label": "Price List and Currency",
"options": "icon-globe", "options": "icon-tag",
"read_only": 0 "read_only": 0
}, },
{ {

View File

@ -0,0 +1,63 @@
import webnotes, json
from webnotes.utils import flt
import unittest
test_dependencies = ["Sales BOM"]
class TestQuotation(unittest.TestCase):
def test_make_sales_order(self):
from selling.doctype.quotation.quotation import make_sales_order
self.assertRaises(webnotes.ValidationError, make_sales_order, "_T-Quotation-00001")
quotation = webnotes.bean("Quotation","_T-Quotation-00001")
quotation.submit()
sales_order = make_sales_order("_T-Quotation-00001")
self.assertEquals(sales_order[0]["doctype"], "Sales Order")
self.assertEquals(len(sales_order), 2)
self.assertEquals(sales_order[1]["doctype"], "Sales Order Item")
self.assertEquals(sales_order[1]["prevdoc_docname"], "_T-Quotation-00001")
self.assertEquals(sales_order[0]["customer"], "_Test Customer")
sales_order[0]["delivery_date"] = "2014-01-01"
webnotes.print_messages = True
webnotes.bean(sales_order).insert()
test_records = [
[
{
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"customer_group": "_Test Customer Group",
"doctype": "Quotation",
"fiscal_year": "_Test Fiscal Year 2013",
"order_type": "Sales",
"plc_conversion_rate": 1.0,
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"territory": "_Test Territory",
"transaction_date": "2013-02-21",
"grand_total": 1000.0,
"grand_total_export": 1000.0,
},
{
"description": "CPU",
"doctype": "Quotation Item",
"item_code": "_Test Item Home Desktop 100",
"item_name": "CPU",
"parentfield": "quotation_details",
"qty": 10.0,
"basic_rate": 100.0,
"export_rate": 100.0,
"amount": 1000.0,
}
],
]

View File

@ -37,6 +37,12 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
this.toggle_rounded_total(); this.toggle_rounded_total();
}, },
refresh: function(doc) {
this.frm.toggle_display("customer_name",
(this.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
this._super();
},
customer: function() { customer: function() {
var me = this; var me = this;
if(this.frm.doc.customer || this.frm.doc.debit_to) { if(this.frm.doc.customer || this.frm.doc.debit_to) {

View File

@ -29,9 +29,16 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend({ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) { refresh: function(doc, dt, dn) {
this._super(); this._super();
this.frm.dashboard.reset();
if(doc.docstatus==1) { if(doc.docstatus==1) {
if(doc.status != 'Stopped') { if(doc.status != 'Stopped') {
cur_frm.dashboard.add_progress(cint(doc.per_delivered) + wn._("% Delivered"),
doc.per_delivered);
cur_frm.dashboard.add_progress(cint(doc.per_delivered) + wn._("% Billed"),
doc.per_billed);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
// delivery note // delivery note
if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales') if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales')
@ -56,6 +63,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']); cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
} else { } else {
// un-stop // un-stop
cur_frm.dashboard.set_headline_alert("Stopped", "alert-danger", "icon-stop");
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']); cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
} }
} }

View File

@ -167,7 +167,7 @@ class DocType(SellingController):
def validate_order_type(self): def validate_order_type(self):
super(DocType, self).validate_order_type() super(DocType, self).validate_order_type()
#validate delivery date def validate_delivery_date(self):
if self.doc.order_type == 'Sales' and not self.doc.delivery_date: if self.doc.order_type == 'Sales' and not self.doc.delivery_date:
msgprint("Please enter 'Expected Delivery Date'") msgprint("Please enter 'Expected Delivery Date'")
raise Exception raise Exception
@ -186,6 +186,7 @@ class DocType(SellingController):
self.validate_fiscal_year() self.validate_fiscal_year()
self.validate_order_type() self.validate_order_type()
self.validate_delivery_date()
self.validate_mandatory() self.validate_mandatory()
self.validate_proj_cust() self.validate_proj_cust()
self.validate_po() self.validate_po()

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-06-18 12:39:59", "creation": "2013-06-18 12:39:59",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-27 11:31:02", "modified": "2013-07-04 10:56:35",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -39,6 +39,13 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Sales Order" "name": "Sales Order"
}, },
{
"doctype": "DocField",
"fieldname": "customer_section",
"fieldtype": "Section Break",
"label": "Customer",
"options": "icon-user"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break0", "fieldname": "column_break0",
@ -77,7 +84,6 @@
"search_index": 1 "search_index": 1
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "customer_name", "fieldname": "customer_name",
"fieldtype": "Data", "fieldtype": "Data",
@ -86,38 +92,34 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Address", "label": "Address",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 1,
"label": "Contact", "label": "Contact",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Mobile No", "label": "Mobile No",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "customer",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 1,
"label": "Contact Email", "label": "Contact Email",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
@ -252,7 +254,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sec_break45", "fieldname": "sec_break45",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Price List and Currency" "label": "Price List and Currency",
"options": "icon-tag"
}, },
{ {
"description": "Customer's currency", "description": "Customer's currency",
@ -323,7 +326,8 @@
"fieldname": "items", "fieldname": "items",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items", "label": "Items",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
@ -345,6 +349,7 @@
"hidden": 0, "hidden": 0,
"label": "Packing List", "label": "Packing List",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-suitcase",
"print_hide": 1 "print_hide": 1
}, },
{ {
@ -444,6 +449,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Taxes", "label": "Taxes",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-money",
"print_hide": 0 "print_hide": 0
}, },
{ {
@ -537,6 +543,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Totals", "label": "Totals",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-money",
"print_hide": 1 "print_hide": 1
}, },
{ {
@ -626,6 +633,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Terms and Conditions", "label": "Terms and Conditions",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-legal",
"print_hide": 0 "print_hide": 0
}, },
{ {
@ -671,7 +679,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_info", "fieldname": "contact_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Contact Info" "label": "Contact Info",
"options": "icon-bullhorn"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -734,6 +743,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-file-text",
"print_hide": 1 "print_hide": 1
}, },
{ {
@ -904,6 +914,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Sales Team", "label": "Sales Team",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-group",
"print_hide": 1 "print_hide": 1
}, },
{ {
@ -951,7 +962,6 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "section_break1", "fieldname": "section_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"options": "Simple",
"print_hide": 1 "print_hide": 1
}, },
{ {

View File

@ -21,6 +21,8 @@ cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method) // make sensitive fields(has_serial_no, is_stock_item, valuation_method)
// read only if any stock ledger entry exists // read only if any stock ledger entry exists
cur_frm.cscript.make_dashboard()
cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series" cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series"
&& doc.__islocal) && doc.__islocal)
cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series" cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
@ -36,6 +38,12 @@ cur_frm.cscript.refresh = function(doc) {
} }
} }
cur_frm.cscript.make_dashboard = function() {
cur_frm.dashboard.reset();
if(doc.__islocal)
return;
}
cur_frm.cscript.item_code = function(doc) { cur_frm.cscript.item_code = function(doc) {
if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code); if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code);
if(!doc.description) cur_frm.set_value("description", doc.item_code); if(!doc.description) cur_frm.set_value("description", doc.item_code);

View File

@ -204,7 +204,7 @@ class DocType(DocListController):
if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or
vals.has_serial_no != self.doc.has_serial_no or vals.has_serial_no != self.doc.has_serial_no or
vals.valuation_method != self.doc.valuation_method): cstr(vals.valuation_method) != cstr(self.doc.valuation_method)):
if self.check_if_sle_exists() == "exists": if self.check_if_sle_exists() == "exists":
webnotes.msgprint(_("As there are existing stock transactions for this \ webnotes.msgprint(_("As there are existing stock transactions for this \
item, you can not change the values of 'Has Serial No', \ item, you can not change the values of 'Has Serial No', \

View File

@ -24,6 +24,16 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
refresh: function(doc) { refresh: function(doc) {
this._super(); this._super();
// dashboard
cur_frm.dashboard.reset();
if(doc.docstatus===1) {
if(doc.status==="Stopped") {
cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop")
}
cur_frm.dashboard.add_progress(cint(doc.per_ordered) + "% "
+ wn._("Fulfilled"), cint(doc.per_ordered));
}
if(doc.docstatus == 1 && doc.status != 'Stopped'){ if(doc.docstatus == 1 && doc.status != 'Stopped'){
if(doc.material_request_type === "Purchase") if(doc.material_request_type === "Purchase")
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation); cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-03-07 14:48:38", "creation": "2013-03-07 14:48:38",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-11 16:16:36", "modified": "2013-07-04 10:24:53",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -44,6 +44,13 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Material Request" "name": "Material Request"
}, },
{
"doctype": "DocField",
"fieldname": "type_section",
"fieldtype": "Section Break",
"label": "Type",
"options": "icon-pushpin"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "material_request_type", "fieldname": "material_request_type",
@ -76,7 +83,8 @@
"fieldname": "items", "fieldname": "items",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items", "label": "Items",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
@ -92,8 +100,7 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "section_break1", "fieldname": "section_break1",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"options": "Simple"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -131,12 +138,12 @@
}, },
{ {
"default": "Give additional details about the indent.", "default": "Give additional details about the indent.",
"description": "Filing in Additional Information about the Material Request will help you analyze your data better.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-file-text"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -287,7 +294,8 @@
"fieldname": "terms_section_break", "fieldname": "terms_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Terms and Conditions", "label": "Terms and Conditions",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-legal"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",

View File

@ -466,20 +466,23 @@ class DocType(StockController):
item_dict = self.get_bom_raw_materials(self.doc.fg_completed_qty) item_dict = self.get_bom_raw_materials(self.doc.fg_completed_qty)
# add raw materials to Stock Entry Detail table # add raw materials to Stock Entry Detail table
self.add_to_stock_entry_detail(self.doc.from_warehouse, self.doc.to_warehouse, self.add_to_stock_entry_detail(item_dict)
item_dict)
# add finished good item to Stock Entry Detail table -- along with bom_no # add finished good item to Stock Entry Detail table -- along with bom_no
if self.doc.production_order and self.doc.purpose == "Manufacture/Repack": if self.doc.production_order and self.doc.purpose == "Manufacture/Repack":
self.add_to_stock_entry_detail(None, pro_obj.doc.fg_warehouse, { self.doc.to_warehouse = pro_obj.doc.fg_warehouse
self.add_to_stock_entry_detail({
cstr(pro_obj.doc.production_item): cstr(pro_obj.doc.production_item):
[self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom] [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]
}, bom_no=pro_obj.doc.bom_no) }, bom_no=pro_obj.doc.bom_no)
elif self.doc.purpose in ["Material Receipt", "Manufacture/Repack"]: elif self.doc.purpose in ["Material Receipt", "Manufacture/Repack"]:
if self.doc.purpose=="Material Receipt":
self.doc.from_warehouse = ""
item = webnotes.conn.sql("""select item, description, uom from `tabBOM` item = webnotes.conn.sql("""select item, description, uom from `tabBOM`
where name=%s""", (self.doc.bom_no,), as_dict=1) where name=%s""", (self.doc.bom_no,), as_dict=1)
self.add_to_stock_entry_detail(None, self.doc.to_warehouse, { self.add_to_stock_entry_detail({
item[0]["item"] : item[0]["item"] :
[self.doc.fg_completed_qty, item[0]["description"], item[0]["uom"]] [self.doc.fg_completed_qty, item[0]["description"], item[0]["uom"]]
}, bom_no=self.doc.bom_no) }, bom_no=self.doc.bom_no)
@ -492,36 +495,56 @@ class DocType(StockController):
child items of sub-contracted and sub assembly items child items of sub-contracted and sub assembly items
and sub assembly items itself. and sub assembly items itself.
""" """
# item dict = { item_code: [qty, description, stock_uom] } # item dict = { item_code: {qty, description, stock_uom} }
item_dict = {} item_dict = {}
def _make_items_dict(items_list): def _make_items_dict(items_list):
"""makes dict of unique items with it's qty""" """makes dict of unique items with it's qty"""
for item in items_list: for item in items_list:
if item_dict.has_key(item.item_code): if item_dict.has_key(item.item_code):
item_dict[item.item_code][0] += flt(item.qty) item_dict[item.item_code]["qty"] += flt(item.qty)
else: else:
item_dict[item.item_code] = [flt(item.qty), item.description, item.stock_uom] item_dict[item.item_code] = {
"qty": flt(item.qty),
"description": item.description,
"stock_uom": item.stock_uom,
"from_warehouse": item.default_warehouse
}
if self.doc.use_multi_level_bom: if self.doc.use_multi_level_bom:
# get all raw materials with sub assembly childs # get all raw materials with sub assembly childs
fl_bom_sa_child_item = sql("""select fb.item_code, fl_bom_sa_child_item = sql("""select
ifnull(sum(fb.qty_consumed_per_unit),0)*%s as qty, fb.description, fb.stock_uom fb.item_code,
from `tabBOM Explosion Item` fb,`tabItem` it ifnull(sum(fb.qty_consumed_per_unit),0)*%s as qty,
where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No' fb.description,
and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus < 2 fb.stock_uom,
and fb.parent=%s group by item_code, stock_uom""", it.default_warehouse
from
`tabBOM Explosion Item` fb,`tabItem` it
where
it.name = fb.item_code
and ifnull(it.is_pro_applicable, 'No') = 'No'
and ifnull(it.is_sub_contracted_item, 'No') = 'No'
and fb.docstatus < 2
and fb.parent=%s group by item_code, stock_uom""",
(qty, self.doc.bom_no), as_dict=1) (qty, self.doc.bom_no), as_dict=1)
if fl_bom_sa_child_item: if fl_bom_sa_child_item:
_make_items_dict(fl_bom_sa_child_item) _make_items_dict(fl_bom_sa_child_item)
else: else:
# Get all raw materials considering multi level BOM, # get only BOM items
# if multi level bom consider childs of Sub-Assembly items fl_bom_sa_items = sql("""select
fl_bom_sa_items = sql("""select item_code, `tabItem`.item_code,
ifnull(sum(qty_consumed_per_unit), 0) *%s as qty, ifnull(sum(`tabBOM Item`.qty_consumed_per_unit), 0) *%s as qty,
description, stock_uom from `tabBOM Item` `tabItem`.description,
where parent = %s and docstatus < 2 `tabItem`.stock_uom,
`tabItem`.default_warehouse
from
`tabBOM Item`, `tabItem`
where
`tabBOM Item`.parent = %s and
`tabBOM Item`.item_code = tabItem.name
`tabBOM Item`.docstatus < 2
group by item_code""", (qty, self.doc.bom_no), as_dict=1) group by item_code""", (qty, self.doc.bom_no), as_dict=1)
if fl_bom_sa_items: if fl_bom_sa_items:
@ -534,30 +557,30 @@ class DocType(StockController):
issue (item quantity) that is pending to issue or desire to transfer, issue (item quantity) that is pending to issue or desire to transfer,
whichever is less whichever is less
""" """
item_qty = self.get_bom_raw_materials(1) item_dict = self.get_bom_raw_materials(1)
issued_item_qty = self.get_issued_qty() issued_item_qty = self.get_issued_qty()
max_qty = flt(pro_obj.doc.qty) max_qty = flt(pro_obj.doc.qty)
only_pending_fetched = [] only_pending_fetched = []
for item in item_qty: for item in item_dict:
pending_to_issue = (max_qty * item_qty[item][0]) - issued_item_qty.get(item, 0) pending_to_issue = (max_qty * item_dict[item]["qty"]) - issued_item_qty.get(item, 0)
desire_to_transfer = flt(self.doc.fg_completed_qty) * item_qty[item][0] desire_to_transfer = flt(self.doc.fg_completed_qty) * item_dict[item]["qty"]
if desire_to_transfer <= pending_to_issue: if desire_to_transfer <= pending_to_issue:
item_qty[item][0] = desire_to_transfer item_dict[item]["qty"] = desire_to_transfer
else: else:
item_qty[item][0] = pending_to_issue item_dict[item]["qty"] = pending_to_issue
if pending_to_issue: if pending_to_issue:
only_pending_fetched.append(item) only_pending_fetched.append(item)
# delete items with 0 qty # delete items with 0 qty
for item in item_qty.keys(): for item in item_dict.keys():
if not item_qty[item][0]: if not item_dict[item]["qty"]:
del item_qty[item] del item_dict[item]
# show some message # show some message
if not len(item_qty): if not len(item_dict):
webnotes.msgprint(_("""All items have already been transferred \ webnotes.msgprint(_("""All items have already been transferred \
for this Production Order.""")) for this Production Order."""))
@ -565,7 +588,7 @@ class DocType(StockController):
webnotes.msgprint(_("""Only quantities pending to be transferred \ webnotes.msgprint(_("""Only quantities pending to be transferred \
were fetched for the following items:\n""" + "\n".join(only_pending_fetched))) were fetched for the following items:\n""" + "\n".join(only_pending_fetched)))
return item_qty return item_dict
def get_issued_qty(self): def get_issued_qty(self):
issued_item_qty = {} issued_item_qty = {}
@ -579,18 +602,20 @@ class DocType(StockController):
return issued_item_qty return issued_item_qty
def add_to_stock_entry_detail(self, source_wh, target_wh, item_dict, bom_no=None): def add_to_stock_entry_detail(self, item_dict, bom_no=None):
for d in item_dict: for d in item_dict:
se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail',
self.doclist) self.doclist)
se_child.s_warehouse = source_wh se_child.s_warehouse = item_dict[d].get("from_warehouse", self.doc.from_warehouse)
se_child.t_warehouse = target_wh se_child.t_warehouse = item_dict[d].get("to_warehouse", self.doc.to_warehouse)
se_child.item_code = cstr(d) se_child.item_code = cstr(d)
se_child.description = item_dict[d][1] se_child.description = item_dict[d]["description"]
se_child.uom = item_dict[d][2] se_child.uom = item_dict[d]["stock_uom"]
se_child.stock_uom = item_dict[d][2] se_child.stock_uom = item_dict[d]["stock_uom"]
se_child.qty = flt(item_dict[d][0]) se_child.qty = flt(item_dict[d]["qty"])
se_child.transfer_qty = flt(item_dict[d][0])
# in stock uom
se_child.transfer_qty = flt(item_dict[d]["qty"])
se_child.conversion_factor = 1.00 se_child.conversion_factor = 1.00
# to be assigned for finished item # to be assigned for finished item

View File

@ -6,6 +6,11 @@ import webnotes, unittest
from webnotes.utils import flt from webnotes.utils import flt
class TestStockEntry(unittest.TestCase): class TestStockEntry(unittest.TestCase):
def tearDown(self):
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
if hasattr(self, "old_default_company"):
webnotes.conn.set_default("company", self.old_default_company)
def test_auto_material_request(self): def test_auto_material_request(self):
webnotes.conn.sql("""delete from `tabMaterial Request Item`""") webnotes.conn.sql("""delete from `tabMaterial Request Item`""")
webnotes.conn.sql("""delete from `tabMaterial Request`""") webnotes.conn.sql("""delete from `tabMaterial Request`""")
@ -72,8 +77,6 @@ class TestStockEntry(unittest.TestCase):
["Stock Adjustment - _TC", 5000.0, 0.0] ["Stock Adjustment - _TC", 5000.0, 0.0]
]) ])
) )
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
def test_material_issue_gl_entry(self): def test_material_issue_gl_entry(self):
self._clear_stock() self._clear_stock()
@ -115,9 +118,6 @@ class TestStockEntry(unittest.TestCase):
]) ])
) )
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
webnotes.conn.set_default("company", self.old_default_company)
def test_material_transfer_gl_entry(self): def test_material_transfer_gl_entry(self):
self._clear_stock() self._clear_stock()
webnotes.defaults.set_global_default("auto_inventory_accounting", 1) webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
@ -149,10 +149,7 @@ class TestStockEntry(unittest.TestCase):
gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
where voucher_type = 'Stock Entry' and voucher_no=%s""", mtn.doc.name) where voucher_type = 'Stock Entry' and voucher_no=%s""", mtn.doc.name)
self.assertFalse(gl_entries) self.assertFalse(gl_entries)
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
webnotes.conn.set_default("company", self.old_default_company)
def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle): def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle):
# check stock ledger entries # check stock ledger entries
sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry` where voucher_type = %s sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry` where voucher_type = %s

View File

@ -7,6 +7,11 @@ wn.module_page["Stock"] = [
top: true, top: true,
icon: "icon-copy", icon: "icon-copy",
items: [ items: [
{
label: wn._("Item"),
description: wn._("All Products or Services."),
doctype:"Item"
},
{ {
label: wn._("Material Request"), label: wn._("Material Request"),
description: wn._("Requests for items."), description: wn._("Requests for items."),
@ -33,11 +38,6 @@ wn.module_page["Stock"] = [
title: wn._("Masters"), title: wn._("Masters"),
icon: "icon-book", icon: "icon-book",
items: [ items: [
{
label: wn._("Item"),
description: wn._("All Products or Services."),
doctype:"Item"
},
{ {
label: wn._("Serial No"), label: wn._("Serial No"),
description: wn._("Single unit of an Item."), description: wn._("Single unit of an Item."),