[pull-mappers] sales order
This commit is contained in:
parent
862a02b8d2
commit
b4c68531ea
@ -330,9 +330,9 @@ class DocType(TransactionBase):
|
|||||||
for d in getlist(obj.doclist, obj.fname):
|
for d in getlist(obj.doclist, obj.fname):
|
||||||
if d.item_code:
|
if d.item_code:
|
||||||
item = webnotes.conn.sql("""select docstatus, is_sales_item,
|
item = webnotes.conn.sql("""select docstatus, is_sales_item,
|
||||||
is_service_item, default_income_account, default_expense_account from tabItem where name = %s""",
|
is_service_item, default_income_account from tabItem where name = %s""",
|
||||||
d.item_code, as_dict=True)
|
d.item_code, as_dict=True)[0]
|
||||||
if item.sales_item == 'No' and item.service_item == 'No':
|
if item.is_sales_item == 'No' and item.is_service_item == 'No':
|
||||||
msgprint("Item : '%s' is neither Sales nor Service Item" % (d.item_code))
|
msgprint("Item : '%s' is neither Sales nor Service Item" % (d.item_code))
|
||||||
raise Exception
|
raise Exception
|
||||||
if d.income_account and not default_income_account:
|
if d.income_account and not default_income_account:
|
||||||
|
@ -69,14 +69,35 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
|
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);
|
this.order_type(doc);
|
||||||
},
|
},
|
||||||
|
|
||||||
order_type: function() {
|
order_type: function() {
|
||||||
this.frm.toggle_reqd("delivery_date", this.frm.doc.order_type == "Sales");
|
this.frm.toggle_reqd("delivery_date", this.frm.doc.order_type == "Sales");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
tc_name: function() {
|
||||||
|
this.get_terms();
|
||||||
|
},
|
||||||
|
|
||||||
reserved_warehouse: function(doc, cdt, cdn) {
|
reserved_warehouse: function(doc, cdt, cdn) {
|
||||||
this.warehouse(doc, cdt, cdn);
|
this.warehouse(doc, cdt, cdn);
|
||||||
},
|
},
|
||||||
@ -115,16 +136,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
source_name: cur_frm.doc.name
|
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
|
// for backward compatibility: combine new and previous states
|
||||||
@ -151,22 +162,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
|||||||
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
|
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() {
|
cur_frm.cscript['Stop Sales Order'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-18 12:39:59",
|
"creation": "2013-06-18 12:39:59",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-06 18:38:37",
|
"modified": "2013-07-08 15:54:25",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -33,8 +33,8 @@
|
|||||||
"parent": "Sales Order",
|
"parent": "Sales Order",
|
||||||
"parentfield": "permissions",
|
"parentfield": "permissions",
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"read": 1,
|
"permlevel": 0,
|
||||||
"report": 1
|
"read": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -364,55 +364,6 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"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",
|
"doctype": "DocField",
|
||||||
"fieldname": "net_total_export",
|
"fieldname": "net_total_export",
|
||||||
@ -647,24 +598,6 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"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",
|
"doctype": "DocField",
|
||||||
"fieldname": "terms",
|
"fieldname": "terms",
|
||||||
@ -974,23 +907,13 @@
|
|||||||
"options": "Sales Team",
|
"options": "Sales Team",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 0,
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"permlevel": 1,
|
|
||||||
"role": "Sales Manager",
|
|
||||||
"submit": 0,
|
|
||||||
"write": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"permlevel": 0,
|
"report": 1,
|
||||||
"role": "Sales Manager",
|
"role": "Sales User",
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
@ -999,63 +922,18 @@
|
|||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"permlevel": 0,
|
"report": 1,
|
||||||
"role": "Sales User",
|
"role": "Maintenance User",
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 0,
|
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"permlevel": 1,
|
"role": "Accounts User"
|
||||||
"role": "Sales User",
|
|
||||||
"submit": 0,
|
|
||||||
"write": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"match": "customer_name",
|
"match": "customer",
|
||||||
"permlevel": 0,
|
|
||||||
"role": "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
|
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user