[pull-mappers] sales order
diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py
index 700a61a..ea46d2a 100644
--- a/selling/doctype/sales_common/sales_common.py
+++ b/selling/doctype/sales_common/sales_common.py
@@ -330,9 +330,9 @@
for d in getlist(obj.doclist, obj.fname):
if d.item_code:
item = webnotes.conn.sql("""select docstatus, is_sales_item,
- is_service_item, default_income_account, default_expense_account from tabItem where name = %s""",
- d.item_code, as_dict=True)
- if item.sales_item == 'No' and item.service_item == 'No':
+ is_service_item, default_income_account from tabItem where name = %s""",
+ d.item_code, as_dict=True)[0]
+ if item.is_sales_item == 'No' and item.is_service_item == 'No':
msgprint("Item : '%s' is neither Sales nor Service Item" % (d.item_code))
raise Exception
if d.income_account and not default_income_account:
diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js
index 54f3b7f..27db426 100644
--- a/selling/doctype/sales_order/sales_order.js
+++ b/selling/doctype/sales_order/sales_order.js
@@ -69,14 +69,35 @@
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
}
}
-
+
+ if (this.frm.doc.docstatus===0) {
+ cur_frm.add_custom_button(wn._('From Quotation'),
+ function() {
+ wn.model.map_current_doc({
+ method: "selling.doctype.quotation.quotation.make_sales_order",
+ source_doctype: "Quotation",
+ get_query_filters: {
+ docstatus: 1,
+ status: ["!=", "Order Lost"],
+ order_type: cur_frm.doc.order_type,
+ customer: cur_frm.doc.customer || undefined,
+ company: cur_frm.doc.company
+ }
+ })
+ });
+ }
+
this.order_type(doc);
},
order_type: function() {
this.frm.toggle_reqd("delivery_date", this.frm.doc.order_type == "Sales");
},
-
+
+ tc_name: function() {
+ this.get_terms();
+ },
+
reserved_warehouse: function(doc, cdt, cdn) {
this.warehouse(doc, cdt, cdn);
},
@@ -115,16 +136,6 @@
source_name: cur_frm.doc.name
})
},
-
- pull_quotation_details: function() {
- wn.model.map_current_doc({
- method: "selling.doctype.quotation.quotation.make_sales_order",
- source_name: cur_frm.doc.quotation_no,
- });
- unhide_field(['quotation_date', 'customer_address',
- 'contact_person', 'territory', 'customer_group']);
- }
-
});
// for backward compatibility: combine new and previous states
@@ -151,22 +162,6 @@
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
-
-cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
- var cond='';
- if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'
- +doc.order_type+'" and';
- if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'
- +doc.customer+'" and';
-
- return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` \
- WHERE `tabQuotation`.company = "'
- + doc.company + '" and `tabQuotation`.`docstatus` = 1 \
- and `tabQuotation`.status != "Order Lost" \
- and %(cond)s `tabQuotation`.%(key)s LIKE "%s" \
- ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond});
-}
-
cur_frm.cscript['Stop Sales Order'] = function() {
var doc = cur_frm.doc;
diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt
index c0b812c..572164a 100644
--- a/selling/doctype/sales_order/sales_order.txt
+++ b/selling/doctype/sales_order/sales_order.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-06-18 12:39:59",
"docstatus": 0,
- "modified": "2013-07-06 18:38:37",
+ "modified": "2013-07-08 15:54:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,8 +33,8 @@
"parent": "Sales Order",
"parentfield": "permissions",
"parenttype": "DocType",
- "read": 1,
- "report": 1
+ "permlevel": 0,
+ "read": 1
},
{
"doctype": "DocType",
@@ -366,55 +366,6 @@
},
{
"doctype": "DocField",
- "fieldname": "section_break0",
- "fieldtype": "Section Break"
- },
- {
- "description": "Quotation no against which this Sales Order is made ",
- "doctype": "DocField",
- "fieldname": "quotation_no",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Quotation No",
- "no_copy": 0,
- "oldfieldname": "quotation_no",
- "oldfieldtype": "Link",
- "options": "Quotation",
- "print_hide": 1,
- "search_index": 1,
- "width": "150px"
- },
- {
- "depends_on": "eval:doc.quotation_no",
- "doctype": "DocField",
- "fieldname": "quotation_date",
- "fieldtype": "Date",
- "hidden": 1,
- "label": "Quotation Date",
- "no_copy": 0,
- "oldfieldname": "quotation_date",
- "oldfieldtype": "Date",
- "print_hide": 1,
- "read_only": 1,
- "reqd": 0,
- "width": "100px"
- },
- {
- "doctype": "DocField",
- "fieldname": "pull_quotation_details",
- "fieldtype": "Button",
- "label": "Pull Quotation Items",
- "oldfieldtype": "Button",
- "print_hide": 1
- },
- {
- "doctype": "DocField",
- "fieldname": "col_break20",
- "fieldtype": "Column Break",
- "width": "50%"
- },
- {
- "doctype": "DocField",
"fieldname": "net_total_export",
"fieldtype": "Currency",
"label": "Net Total (Export)",
@@ -649,24 +600,6 @@
},
{
"doctype": "DocField",
- "fieldname": "column_break_58",
- "fieldtype": "Column Break"
- },
- {
- "doctype": "DocField",
- "fieldname": "get_terms",
- "fieldtype": "Button",
- "label": "Get Terms and Conditions",
- "oldfieldtype": "Button",
- "print_hide": 1
- },
- {
- "doctype": "DocField",
- "fieldname": "section_break_60",
- "fieldtype": "Section Break"
- },
- {
- "doctype": "DocField",
"fieldname": "terms",
"fieldtype": "Text Editor",
"label": "Terms and Conditions Details",
@@ -975,22 +908,12 @@
"print_hide": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Sales Manager",
- "submit": 0,
- "write": 0
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "permlevel": 0,
- "role": "Sales Manager",
+ "report": 1,
+ "role": "Sales User",
"submit": 1,
"write": 1
},
@@ -999,63 +922,18 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "permlevel": 0,
- "role": "Sales User",
+ "report": 1,
+ "role": "Maintenance User",
"submit": 1,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
"doctype": "DocPerm",
- "permlevel": 1,
- "role": "Sales User",
- "submit": 0,
- "write": 0
+ "role": "Accounts User"
},
{
"doctype": "DocPerm",
- "match": "customer_name",
- "permlevel": 0,
+ "match": "customer",
"role": "Customer"
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "Maintenance Manager",
- "submit": 1,
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Maintenance Manager",
- "submit": 0
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "role": "Maintenance User",
- "submit": 1,
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Maintenance User",
- "submit": 0
}
]
\ No newline at end of file