[fixed conflict]

This commit is contained in:
Nabin Hait 2013-07-08 19:01:41 +05:30
commit a131c0aa5e
34 changed files with 379 additions and 1345 deletions

View File

@ -51,7 +51,38 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
wn.set_route("general-ledger");
});
}
if(doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Purchase Order'),
function() {
wn.model.map_current_doc({
method: "buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_doctype: "Purchase Order",
get_query_filters: {
supplier: cur_frm.doc.supplier || undefined,
docstatus: 1,
status: ["!=", "Stopped"],
per_billed: ["<", 99.99],
company: cur_frm.doc.company
}
})
});
cur_frm.add_custom_button(wn._('From Purchase Receipt'),
function() {
wn.model.map_current_doc({
method: "stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_doctype: "Purchase Receipt",
get_query_filters: {
supplier: cur_frm.doc.supplier || undefined,
docstatus: 1,
company: cur_frm.doc.company
}
})
});
}
this.is_opening(doc);
},
@ -68,22 +99,11 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
this.frm.refresh_fields();
},
get_items: function() {
if(doc.purchase_order_main) {
wn.model.map_current_doc({
method: "buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_name: cur_frm.doc.purchase_order_main,
})
}
else if(doc.purchase_receipt_main) {
wn.model.map_current_doc({
method: "selling.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_name: cur_frm.doc.purchase_receipt_main,
})
}
}
tc_name: function() {
this.get_terms();
},
});
// for backward compatibility: combine new and previous states
@ -149,22 +169,6 @@ cur_frm.fields_dict['credit_to'].get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
}
cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
if (doc.supplier){
return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
} else {
return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`, 0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
}
}
cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) {
if (doc.supplier){
return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
} else {
return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
}
}
// Get Print Heading
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';

View File

@ -43,17 +43,6 @@ class DocType(BuyingController):
'target_ref_field': 'import_amount',
'source_field': 'import_amount',
'percent_join_field': 'purchase_order',
},
{
'source_dt': 'Purchase Invoice Item',
'target_dt': 'Purchase Receipt Item',
'join_field': 'pr_detail',
'target_field': 'billed_amt',
'target_parent_dt': 'Purchase Receipt',
'target_parent_field': 'per_billed',
'target_ref_field': 'import_amount',
'source_field': 'import_amount',
'percent_join_field': 'purchase_receipt',
}]
def validate(self):

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-07-05 14:51:53",
"modified": "2013-07-08 18:03:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -31,6 +31,7 @@
"parent": "Purchase Invoice",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1
},
@ -212,12 +213,6 @@
"options": "Purchase Invoice Item",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "recalculate",
@ -226,44 +221,6 @@
"oldfieldtype": "Button",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"read_only": 0
},
{
"description": "Select Items from Purchase Order",
"doctype": "DocField",
"fieldname": "purchase_order_main",
"fieldtype": "Link",
"label": "Purchase Order",
"oldfieldname": "purchase_order_main",
"oldfieldtype": "Link",
"options": "Purchase Order",
"print_hide": 1,
"read_only": 0
},
{
"description": "Select Items from Purchase Receipt",
"doctype": "DocField",
"fieldname": "purchase_receipt_main",
"fieldtype": "Link",
"label": "Purchase Receipt",
"oldfieldname": "purchase_receipt_main",
"oldfieldtype": "Link",
"options": "Purchase Receipt",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "currency_price_list",
@ -694,12 +651,6 @@
"options": "Terms and Conditions",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions"
},
{
"doctype": "DocField",
"fieldname": "terms",
@ -836,69 +787,50 @@
"read_only": 0,
"reqd": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Accounts Manager",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Accounts Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Accounts User",
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Purchase User",
"submit": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Purchase User",
"submit": 0,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Accounts User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"role": "Purchase User",
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "supplier",
"permlevel": 0,
"role": "Supplier"
"role": "Supplier",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Accounts Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"role": "Auditor",
"submit": 0,
"write": 0
}
]

View File

@ -66,8 +66,44 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(doc.outstanding_amount!=0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
}
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Sales Order'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
source_doctype: "Sales Order",
get_query_filters: {
docstatus: 1,
status: ["!=", "Stopped"],
per_billed: ["<", 99.99],
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
cur_frm.add_custom_button(wn._('From Delivery Note'),
function() {
wn.model.map_current_doc({
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
source_doctype: "Delivery Note",
get_query_filters: {
docstatus: 1,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
}
cur_frm.cscript.hide_fields(doc, dt, dn);
},
tc_name: function() {
this.get_terms();
},
is_pos: function() {
if(cint(this.frm.doc.is_pos)) {
@ -122,9 +158,8 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
// Hide Fields
// ------------
cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
par_flds = ['project_name', 'due_date', 'sales_order_main',
'delivery_note_main', 'get_items', 'is_opening', 'conversion_rate',
'source', 'cancel_reason', 'total_advance', 'gross_profit',
par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate',
'source', 'total_advance', 'gross_profit',
'gross_profit_percent', 'get_advances_received',
'advance_adjustment_details', 'sales_partner', 'commission_rate',
'total_commission', 'advances'];
@ -190,24 +225,6 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
if (doc.is_opening == 'Yes') unhide_field('aging_date');
}
// Get Items based on SO or DN Selected
cur_frm.cscript.get_items = function(doc, dt, dn) {
if(doc.delivery_note_main) {
wn.model.map_current_doc({
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
source_name: cur_frm.doc.delivery_note_main,
})
}
else if(doc.sales_order_main) {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
source_name: cur_frm.doc.sales_order_main,
})
}
}
//Make Delivery Note Button
//-----------------------------
@ -302,37 +319,6 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio
}
}
// Sales Order
// -----------
cur_frm.fields_dict.sales_order_main.get_query = function(doc) {
if (doc.customer)
return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.`customer` = "' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
else
return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
}
// Delivery Note
// --------------
cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
if (doc.customer)
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \
WHERE `tabDelivery Note`.company = "' + doc.company
+ '" and `tabDelivery Note`.`docstatus` = 1 and \
ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \
`tabDelivery Note`.`customer` = "'
+ doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" \
ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
else
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \
WHERE `tabDelivery Note`.company = "' + doc.company
+ '" and `tabDelivery Note`.`docstatus` = 1 and \
ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \
`tabDelivery Note`.%(key)s LIKE "%s" \
ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
}
cur_frm.cscript.income_account = function(doc, cdt, cdn){
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
}

View File

@ -51,20 +51,6 @@ class DocType(SellingController):
'percent_join_field': 'sales_order',
'status_field': 'billing_status',
'keyword': 'Billed'
},
{
'source_dt': 'Sales Invoice Item',
'target_dt': 'Delivery Note Item',
'join_field': 'dn_detail',
'target_field': 'billed_amt',
'target_parent_dt': 'Delivery Note',
'target_parent_field': 'per_billed',
'target_ref_field': 'export_amount',
'source_field': 'export_amount',
'percent_join_field': 'delivery_note',
'status_field': 'billing_status',
'keyword': 'Billed',
'no_tolerance': True,
}]

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:05",
"docstatus": 0,
"modified": "2013-07-05 14:54:19",
"modified": "2013-07-08 17:05:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -350,52 +350,6 @@
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"read_only": 0
},
{
"description": "Select Items from Sales Order",
"doctype": "DocField",
"fieldname": "sales_order_main",
"fieldtype": "Link",
"label": "Sales Order",
"oldfieldname": "sales_order_main",
"oldfieldtype": "Link",
"options": "Sales Order",
"print_hide": 1,
"read_only": 0
},
{
"description": "Select Items from Delivery Note",
"doctype": "DocField",
"fieldname": "delivery_note_main",
"fieldtype": "Link",
"label": "Delivery Note",
"oldfieldname": "delivery_note_main",
"oldfieldtype": "Link",
"options": "Delivery Note",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break25",
"fieldtype": "Column Break",
"read_only": 0,
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
@ -789,25 +743,6 @@
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_71",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_73",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "terms",

View File

@ -27,8 +27,15 @@ wn.require('app/buying/doctype/purchase_common/purchase_common.js');
erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({
refresh: function(doc, cdt, cdn) {
this._super();
this.frm.dashboard.reset();
if(doc.docstatus == 1 && doc.status != 'Stopped'){
cur_frm.dashboard.add_progress(cint(doc.per_received) + wn._("% Received"),
doc.per_received);
cur_frm.dashboard.add_progress(cint(doc.per_billed) + wn._("% Billed"),
doc.per_billed);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
if(flt(doc.per_received, 2) < 100)
cur_frm.add_custom_button('Make Purchase Receipt', this.make_purchase_receipt);
@ -36,20 +43,15 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.add_custom_button('Make Invoice', this.make_purchase_invoice);
if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100)
cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']);
} else if(doc.docstatus===0) {
cur_frm.cscript.add_from_mappers();
}
if(doc.docstatus == 1 && doc.status == 'Stopped')
cur_frm.add_custom_button('Unstop Purchase Order',
cur_frm.cscript['Unstop Purchase Order']);
},
get_items: function() {
wn.model.map_current_doc({
method: "stock.doctype.material_request.material_request.make_purchase_order",
source_name: cur_frm.doc.indent_no,
})
},
make_purchase_receipt: function() {
wn.model.open_mapped_doc({
method: "buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
@ -64,12 +66,40 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
})
},
get_supplier_quotation_items: function() {
wn.model.map_current_doc({
method: "buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
source_name: cur_frm.doc.supplier_quotation,
})
}
add_from_mappers: function() {
cur_frm.add_custom_button(wn._('From Material Request'),
function() {
wn.model.map_current_doc({
method: "stock.doctype.material_request.material_request.make_purchase_order",
source_doctype: "Material Request",
get_query_filters: {
material_request_type: "Purchase",
docstatus: 1,
status: ["!=", "Stopped"],
per_ordered: ["<", 99.99],
company: cur_frm.doc.company
}
})
});
cur_frm.add_custom_button(wn._('From Supplier Quotation'),
function() {
wn.model.map_current_doc({
method: "buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
source_doctype: "Supplier Quotation",
get_query_filters: {
docstatus: 1,
status: ["!=", "Stopped"],
company: cur_frm.doc.company
}
})
});
},
tc_name: function() {
this.get_terms();
},
});
// for backward compatibility: combine new and previous states
@ -93,14 +123,6 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {
return 'SELECT DISTINCT `name` FROM `tabMaterial Request` \
WHERE material_request_type="Purchase" and company = "' + doc.company
+ '" and `docstatus` = 1 and `status` != "Stopped" \
and ifnull(`per_ordered`,0) < 99.99 and %(key)s LIKE "%s" \
ORDER BY `name` DESC LIMIT 50';
}
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
$c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) {
refresh_field(cur_frm.cscript.fname);

View File

@ -252,7 +252,8 @@ def make_purchase_invoice(source_name, target_doclist=None):
target.conversion_factor = 1
target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
target.amount = target.import_amount / flt(source_parent.conversion_rate)
target.qty = target.amount / flt(obj.purchase_rate)
if flt(obj.purchase_rate):
target.qty = target.amount / flt(obj.purchase_rate)
doclist = get_mapped_doclist("Purchase Order", source_name, {
"Purchase Order": {

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-07-05 14:51:59",
"modified": "2013-07-08 17:49:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -183,59 +183,6 @@
"label": "Re-Calculate Values",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break"
},
{
"description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.",
"doctype": "DocField",
"fieldname": "indent_no",
"fieldtype": "Link",
"hidden": 0,
"label": "Select Material Request",
"no_copy": 1,
"oldfieldname": "indent_no",
"oldfieldtype": "Link",
"options": "Material Request",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"hidden": 0,
"label": "Get Items",
"no_copy": 0,
"oldfieldtype": "Button",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
"print_width": "50%",
"width": "50%"
},
{
"description": "You can make a purchase order from multiple Supplier Quotations. Select Supplier Quotations one by one and click on the button below.",
"doctype": "DocField",
"fieldname": "supplier_quotation",
"fieldtype": "Link",
"label": "Select Supplier Quotation",
"no_copy": 1,
"options": "Supplier Quotation",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_supplier_quotation_items",
"fieldtype": "Button",
"label": "Get Items",
"options": "get_supplier_quotation_items",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "price_list_and_currency",
@ -269,7 +216,7 @@
"fieldtype": "Float",
"hidden": 0,
"label": "Exchange Rate",
"no_copy": 0,
"no_copy": 1,
"oldfieldname": "conversion_rate",
"oldfieldtype": "Currency",
"print_hide": 1,
@ -541,13 +488,6 @@
"options": "Terms and Conditions",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "terms",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:06",
"docstatus": 0,
"modified": "2013-05-31 14:26:22",
"modified": "2013-07-08 13:51:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -32,7 +32,7 @@
"hidden": 0,
"in_filter": 1,
"label": "Reqd By Date",
"no_copy": 1,
"no_copy": 0,
"oldfieldname": "schedule_date",
"oldfieldtype": "Date",
"print_hide": 1,
@ -121,7 +121,7 @@
"doctype": "DocField",
"fieldname": "import_ref_rate",
"fieldtype": "Currency",
"label": "Ref Rate ",
"label": "Price List Rate",
"options": "currency",
"print_hide": 1,
"read_only": 0

View File

@ -29,16 +29,25 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
if (this.frm.doc.docstatus === 1) {
cur_frm.add_custom_button("Make Purchase Order", this.make_purchase_order);
}
else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Material Request'),
function() {
wn.model.map_current_doc({
method: "stock.doctype.material_request.material_request.make_supplier_quotation",
source_doctype: "Material Request",
get_query_filters: {
material_request_type: "Purchase",
docstatus: 1,
status: ["!=", "Stopped"],
per_ordered: ["<", 99.99],
company: cur_frm.doc.company
}
})
});
}
},
get_items: function() {
wn.model.map_current_doc({
method: "stock.doctype.material_request.material_request.make_supplier_quotation",
source_name: cur_frm.doc.indent_no,
})
},
make_purchase_order: function() {
wn.model.open_mapped_doc({
method: "buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
@ -62,14 +71,6 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query
order by `tabProject`.name ASC LIMIT 50";
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {
return "select distinct `name` from `tabMaterial Request` \
where material_request_type='Purchase' and company = \"" + doc.company +
"\" and `docstatus` = 1 and `status` != \"Stopped\" and \
ifnull(`per_ordered`,0) < 99.99 and \
%(key)s LIKE \"%s\" order by `name` desc limit 50";
}
cur_frm.cscript.supplier_address = function(doc, dt, dn) {
if (doc.supplier) {
get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:45",
"docstatus": 0,
"modified": "2013-07-05 14:57:12",
"modified": "2013-07-08 15:14:48",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -168,32 +168,6 @@
"label": "Re-Calculate Values",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "section_break_14",
"fieldtype": "Section Break"
},
{
"description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.",
"doctype": "DocField",
"fieldname": "indent_no",
"fieldtype": "Link",
"hidden": 0,
"label": "Select Material Request",
"no_copy": 1,
"oldfieldname": "indent_no",
"oldfieldtype": "Link",
"options": "Material Request",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"hidden": 0,
"label": "Get Items",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "currency_price_list",

View File

@ -85,7 +85,8 @@ def _get_basic_details(args, item_bean):
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
item_bean.doclist.get({"parentfield": "item_tax"})))),
"batch_no": None,
"expense_head": item.purchase_account,
"expense_head": item.purchase_account \
or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
"cost_center": item.cost_center
})

View File

@ -28,8 +28,8 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.docstatus===0 && !doc.__islocal) {
cur_frm.set_intro("Submit this Production Order for further processing.");
} else if(doc.docstatus===1) {
var percent = flt(doc.produced_qty) / doc.qty * 100;
cur_frm.dashboard.add_progress(cint(percent) + "% " + wn._("Complete"));
var percent = flt(doc.produced_qty) / flt(doc.qty) * 100;
cur_frm.dashboard.add_progress(cint(percent) + "% " + wn._("Complete"), percent);
if(doc.status === "Stopped") {
cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");

View File

@ -76,9 +76,9 @@ class DocType:
(self.doc.sales_order, self.doc.production_item))[0][0]
# total qty in SO
so_qty = flt(so_item_qty) + flt(dnpi_qty)
if ordered_qty_against_so > so_qty:
msgprint("""Total production order qty for item: %s against sales order: %s \
webnotes.msgprint("""Total production order qty for item: %s against sales order: %s \
will be %s, which is greater than sales order qty (%s).
Please reduce qty or remove the item.""" %
(self.doc.production_item, self.doc.sales_order,

View File

@ -53,6 +53,25 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
}
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Opportunity'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.opportunity.opportunity.make_quotation",
source_doctype: "Opportunity",
get_query_filters: {
docstatus: 1,
status: "Submitted",
enquiry_type: cur_frm.doc.order_type,
customer: cur_frm.doc.customer || undefined,
lead: cur_frm.doc.lead || undefined,
company: cur_frm.doc.company
}
})
});
}
if (!doc.__islocal) {
cur_frm.communication_view = new wn.views.CommunicationList({
@ -70,6 +89,10 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
this.frm.toggle_reqd("lead", this.frm.doc.quotation_to == "Lead");
this.frm.toggle_reqd("customer", this.frm.doc.quotation_to == "Customer");
},
tc_name: function() {
this.get_terms();
},
validate_company_and_party: function(party_field) {
if(this.frm.doc.quotation_to == "Lead") {
@ -113,17 +136,6 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
}
// =====================================================================================
cur_frm.fields_dict['enq_no'].get_query = function(doc,cdt,cdn){
var cond='';
var cond1='';
if(doc.order_type) cond = 'ifnull(`tabOpportunity`.enquiry_type, "") = "'+doc.order_type+'" AND';
if(doc.customer) cond1 = '`tabOpportunity`.customer = "'+doc.customer+'" AND';
else if(doc.lead) cond1 = '`tabOpportunity`.lead = "'+doc.lead+'" AND';
return repl('SELECT `tabOpportunity`.`name` FROM `tabOpportunity` WHERE `tabOpportunity`.`docstatus` = 1 AND `tabOpportunity`.status = "Submitted" AND %(cond)s %(cond1)s `tabOpportunity`.`name` LIKE "%s" ORDER BY `tabOpportunity`.`name` ASC LIMIT 50', {cond:cond, cond1:cond1});
}
// Make Sales Order
// =====================================================================================
cur_frm.cscript['Make Sales Order'] = function() {
@ -133,14 +145,6 @@ cur_frm.cscript['Make Sales Order'] = function() {
})
}
//pull enquiry details
cur_frm.cscript.pull_enquiry_detail = function(doc,cdt,cdn){
wn.model.map_current_doc({
method: "selling.doctype.opportunity.opportunity.make_quotation",
source_name: cur_frm.doc.enq_no,
})
}
// declare order lost
//-------------------------
cur_frm.cscript['Declare Order Lost'] = function(){

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-07-05 14:52:37",
"modified": "2013-07-08 15:51:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -344,42 +344,6 @@
"fieldtype": "Section Break",
"read_only": 0
},
{
"description": "To create Quotation against Opportunity, Select Opportunity No. and click on 'Pull Opportunity Details' ",
"doctype": "DocField",
"fieldname": "enq_no",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Opportunity No",
"no_copy": 0,
"oldfieldname": "enq_no",
"oldfieldtype": "Link",
"options": "Opportunity",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"search_index": 0
},
{
"doctype": "DocField",
"fieldname": "pull_enquiry_detail",
"fieldtype": "Button",
"hidden": 0,
"label": "Pull Opportunity Detail",
"no_copy": 0,
"oldfieldtype": "Button",
"print_hide": 0,
"read_only": 0,
"report_hide": 0
},
{
"doctype": "DocField",
"fieldname": "col_break34",
"fieldtype": "Column Break",
"read_only": 0,
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
@ -634,24 +598,6 @@
"read_only": 0,
"report_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_54",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_56",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "terms",

View File

@ -325,21 +325,18 @@ class DocType(TransactionBase):
if so_status == 'Stopped':
msgprint("You cannot do any transaction against Sales Order : '%s' as it is Stopped." %(ref_doc_name))
raise Exception
# ****** Check for Item.is_sales_item = 'Yes' and Item.docstatus != 2 *******
def check_active_sales_items(self,obj):
for d in getlist(obj.doclist, obj.fname):
if d.item_code: # extra condn coz item_code is not mandatory in RV
valid_item = webnotes.conn.sql("select docstatus,is_sales_item, is_service_item from tabItem where name = %s",d.item_code)
if valid_item and valid_item[0][0] == 2:
msgprint("Item : '%s' does not exist in system." %(d.item_code))
raise Exception
sales_item = valid_item and valid_item[0][1] or 'No'
service_item = valid_item and valid_item[0][2] or 'No'
if sales_item == 'No' and service_item == 'No':
msgprint("Item : '%s' is neither Sales nor Service Item"%(d.item_code))
if d.item_code:
item = webnotes.conn.sql("""select docstatus, is_sales_item,
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 item.default_income_account:
webnotes.conn.set_value("Item", d.item_code, "default_income_account", d.income_account)
# **************************************************************************************************************************************************
@ -368,291 +365,3 @@ class DocType(TransactionBase):
dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
d.prevdoc_date = (dt and dt[0][0]) and dt[0][0].strftime('%Y-%m-%d') or ''
def update_prevdoc_detail(self, is_submit, obj):
StatusUpdater(obj, is_submit).update()
#
# make item code readonly if (detail no is set)
#
class StatusUpdater:
"""
Updates the status of the calling records
From Delivery Note
- Update Delivered Qty
- Update Percent
- Validate over delivery
From Sales Invoice
- Update Billed Amt
- Update Percent
- Validate over billing
From Installation Note
- Update Installed Qty
- Update Percent Qty
- Validate over installation
"""
def __init__(self, obj, is_submit):
self.obj = obj # caller object
self.is_submit = is_submit
self.tolerance = {}
self.global_tolerance = None
def update(self):
self.update_all_qty()
self.validate_all_qty()
def validate_all_qty(self):
"""
Validates over-billing / delivery / installation in Delivery Note, Sales Invoice, Installation Note
To called after update_all_qty
"""
if self.obj.doc.doctype=='Delivery Note':
self.validate_qty({
'source_dt' :'Delivery Note Item',
'compare_field' :'delivered_qty',
'compare_ref_field' :'qty',
'target_dt' :'Sales Order Item',
'join_field' :'prevdoc_detail_docname'
})
elif self.obj.doc.doctype=='Sales Invoice':
self.validate_qty({
'source_dt' :'Sales Invoice Item',
'compare_field' :'billed_amt',
'compare_ref_field' :'export_amount',
'target_dt' :'Sales Order Item',
'join_field' :'so_detail'
})
self.validate_qty({
'source_dt' :'Sales Invoice Item',
'compare_field' :'billed_amt',
'compare_ref_field' :'export_amount',
'target_dt' :'Delivery Note Item',
'join_field' :'dn_detail'
}, no_tolerance =1)
elif self.obj.doc.doctype=='Installation Note':
self.validate_qty({
'source_dt' :'Installation Item Details',
'compare_field' :'installed_qty',
'compare_ref_field' :'qty',
'target_dt' :'Delivery Note Item',
'join_field' :'dn_detail'
}, no_tolerance =1)
def get_tolerance_for(self, item_code):
"""
Returns the tolerance for the item, if not set, returns global tolerance
"""
if self.tolerance.get(item_code):
return self.tolerance[item_code]
tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0)
if not tolerance:
if self.global_tolerance == None:
self.global_tolerance = flt(webnotes.conn.get_value('Stock Settings',None,'tolerance') or 0)
tolerance = self.global_tolerance
self.tolerance[item_code] = tolerance
return tolerance
def check_overflow_with_tolerance(self, item, args):
"""
Checks if there is overflow condering a relaxation tolerance
"""
# check if overflow is within tolerance
tolerance = self.get_tolerance_for(item['item_code'])
overflow_percent = ((item[args['compare_field']] - item[args['compare_ref_field']]) / item[args['compare_ref_field']]) * 100
if overflow_percent - tolerance > 0.01:
item['max_allowed'] = flt(item[args['compare_ref_field']] * (100+tolerance)/100)
item['reduce_by'] = item[args['compare_field']] - item['max_allowed']
msgprint("""
Row #%(idx)s: Max %(compare_ref_field)s allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>.
If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master.
Or, you must reduce the %(compare_ref_field)s by %(reduce_by)s
Also, please check if the order item has already been billed in the Sales Order""" % item, raise_exception=1)
def validate_qty(self, args, no_tolerance=None):
"""
Validates qty at row level
"""
# get unique transactions to update
for d in self.obj.doclist:
if d.doctype == args['source_dt'] and d.fields.get(args["join_field"]):
args['name'] = d.fields[args['join_field']]
# get all qty where qty > compare_field
item = webnotes.conn.sql("""select item_code, `%(compare_ref_field)s`,
`%(compare_field)s`, parenttype, parent from `tab%(target_dt)s`
where `%(compare_ref_field)s` < `%(compare_field)s`
and name="%(name)s" and docstatus=1
""" % args, as_dict=1)
if item:
item = item[0]
item['idx'] = d.idx
item['compare_ref_field'] = args['compare_ref_field'].replace('_', ' ')
if not item[args['compare_ref_field']]:
msgprint("As %(compare_ref_field)s for item: %(item_code)s in %(parenttype)s: %(parent)s is zero, system will not check over-delivery or over-billed" % item)
elif no_tolerance:
item['reduce_by'] = item[args['compare_field']] - item[args['compare_ref_field']]
if item['reduce_by'] > .01:
msgprint("""
Row #%(idx)s: Max %(compare_ref_field)s allowed for <b>Item %(item_code)s</b> against
<b>%(parenttype)s %(parent)s</b> is <b>""" % item
+ cstr(item[args['compare_ref_field']]) + """</b>.
You must reduce the %(compare_ref_field)s by %(reduce_by)s""" % item, raise_exception=1)
else:
self.check_overflow_with_tolerance(item, args)
def update_all_qty(self):
"""
Updates delivered / billed / installed qty in Sales Order & Delivery Note
"""
if self.obj.doc.doctype=='Delivery Note':
self.update_qty({
'target_field' :'delivered_qty',
'target_dt' :'Sales Order Item',
'target_parent_dt' :'Sales Order',
'target_parent_field' :'per_delivered',
'target_ref_field' :'qty',
'source_dt' :'Delivery Note Item',
'source_field' :'qty',
'join_field' :'prevdoc_detail_docname',
'percent_join_field' :'prevdoc_docname',
'status_field' :'delivery_status',
'keyword' :'Delivered'
})
elif self.obj.doc.doctype=='Sales Invoice':
self.update_qty({
'target_field' :'billed_amt',
'target_dt' :'Sales Order Item',
'target_parent_dt' :'Sales Order',
'target_parent_field' :'per_billed',
'target_ref_field' :'export_amount',
'source_dt' :'Sales Invoice Item',
'source_field' :'export_amount',
'join_field' :'so_detail',
'percent_join_field' :'sales_order',
'status_field' :'billing_status',
'keyword' :'Billed'
})
self.update_qty({
'target_field' :'billed_amt',
'target_dt' :'Delivery Note Item',
'target_parent_dt' :'Delivery Note',
'target_parent_field' :'per_billed',
'target_ref_field' :'export_amount',
'source_dt' :'Sales Invoice Item',
'source_field' :'export_amount',
'join_field' :'dn_detail',
'percent_join_field' :'delivery_note',
'status_field' :'billing_status',
'keyword' :'Billed'
})
if cint(self.obj.doc.is_pos) == 1:
self.update_qty({
'target_field' :'delivered_qty',
'target_dt' :'Sales Order Item',
'target_parent_dt' :'Sales Order',
'target_parent_field' :'per_delivered',
'target_ref_field' :'qty',
'source_dt' :'Sales Invoice Item',
'source_field' :'qty',
'join_field' :'so_detail',
'percent_join_field' :'sales_order',
'status_field' :'delivery_status',
'keyword' :'Delivered'
})
if self.obj.doc.doctype=='Installation Note':
self.update_qty({
'target_field' :'installed_qty',
'target_dt' :'Delivery Note Item',
'target_parent_dt' :'Delivery Note',
'target_parent_field' :'per_installed',
'target_ref_field' :'qty',
'source_dt' :'Installation Note Item',
'source_field' :'qty',
'join_field' :'prevdoc_detail_docname',
'percent_join_field' :'prevdoc_docname',
'status_field' :'installation_status',
'keyword' :'Installed'
})
def update_qty(self, args):
"""
Updates qty at row level
"""
# condition to include current record (if submit or no if cancel)
if self.is_submit:
args['cond'] = ' or parent="%s"' % self.obj.doc.name
else:
args['cond'] = ' and parent!="%s"' % self.obj.doc.name
# update quantities in child table
for d in self.obj.doclist:
if d.doctype == args['source_dt']:
# updates qty in the child table
args['detail_id'] = d.fields.get(args['join_field'])
if args['detail_id']:
webnotes.conn.sql("""
update
`tab%(target_dt)s`
set
%(target_field)s = (select sum(%(source_field)s) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s))
where
name="%(detail_id)s"
""" % args)
# get unique transactions to update
for name in set([d.fields.get(args['percent_join_field']) for d in self.obj.doclist if d.doctype == args['source_dt']]):
if name:
args['name'] = name
# update percent complete in the parent table
webnotes.conn.sql("""
update
`tab%(target_parent_dt)s`
set
%(target_parent_field)s =
(select sum(if(%(target_ref_field)s > ifnull(%(target_field)s, 0), %(target_field)s, %(target_ref_field)s))/sum(%(target_ref_field)s)*100 from `tab%(target_dt)s` where parent="%(name)s"),
modified = now()
where
name="%(name)s"
""" % args)
# update field
if args['status_field']:
webnotes.conn.sql("""
update
`tab%(target_parent_dt)s`
set
%(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001, 'Not %(keyword)s',
if(%(target_parent_field)s>=99.99, 'Fully %(keyword)s', 'Partly %(keyword)s')
)
where
name="%(name)s"
""" % args)

View File

@ -69,14 +69,35 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
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 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
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 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
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;

View File

@ -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",
@ -364,55 +364,6 @@
"print_hide": 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",
"fieldname": "net_total_export",
@ -647,24 +598,6 @@
"print_hide": 1,
"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",
"fieldname": "terms",
@ -974,23 +907,13 @@
"options": "Sales Team",
"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
}
]

View File

@ -113,8 +113,10 @@ def _get_basic_details(args, item_bean):
"description": item.description_html or item.description,
"reserved_warehouse": item.default_warehouse or args.warehouse or args.reserved_warehouse,
"warehouse": item.default_warehouse or args.warehouse,
"income_account": item.default_income_account or args.income_account,
"expense_account": item.purchase_account or args.expense_account,
"income_account": item.default_income_account or args.income_account \
or webnotes.conn.get_value("Company", args.company, "default_income_account"),
"expense_account": item.purchase_account or args.expense_account \
or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
"cost_center": item.default_sales_cost_center or args.cost_center,
"qty": 1.0,
"adj_rate": 0.0,

View File

@ -191,6 +191,8 @@ class DocType:
def set_default_accounts(self):
accounts = {
"default_income_account": "Sales",
"default_expense_account": "Cost of Goods Sold",
"receivables_group": "Accounts Receivable",
"payables_group": "Accounts Payable",
"stock_received_but_not_billed": "Stock Received But Not Billed",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-10 08:35:39",
"docstatus": 0,
"modified": "2013-07-05 14:32:14",
"modified": "2013-07-08 17:34:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -89,15 +89,6 @@
"oldfieldtype": "Section Break",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_currency",
"fieldtype": "Link",
"label": "Default Currency",
"options": "Currency",
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
@ -142,6 +133,28 @@
"options": "Account",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_expense_account",
"fieldtype": "Link",
"label": "Default Expense Account",
"options": "Account"
},
{
"doctype": "DocField",
"fieldname": "default_income_account",
"fieldtype": "Link",
"label": "Default Income Account",
"options": "Account"
},
{
"doctype": "DocField",
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"read_only": 0,
"width": "50%"
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
@ -153,11 +166,12 @@
},
{
"doctype": "DocField",
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"fieldname": "default_currency",
"fieldtype": "Link",
"label": "Default Currency",
"options": "Currency",
"read_only": 0,
"width": "50%"
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal",

View File

@ -46,15 +46,27 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
var aii_enabled = cint(sys_defaults.auto_inventory_accounting)
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("expense_account", aii_enabled);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("cost_center", aii_enabled);
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Sales Order'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_delivery_note",
source_doctype: "Sales Order",
get_query_filters: {
docstatus: 1,
status: ["!=", "Stopped"],
per_delivered: ["<", 99.99],
project_name: cur_frm.doc.project_name || undefined,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
}
},
get_items: function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_delivery_note",
source_name: cur_frm.doc.sales_order_no,
})
},
make_sales_invoice: function() {
wn.model.open_mapped_doc({
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
@ -67,7 +79,11 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
method: "stock.doctype.delivery_note.delivery_note.make_installation_note",
source_name: cur_frm.doc.name
});
}
},
tc_name: function() {
this.get_terms();
},
});
@ -96,22 +112,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
// *************** Customized link query for SALES ORDER based on customer and currency*****************************
cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabSales Order`.customer = "'+doc.customer+'" and';
}
if(doc.project_name){
cond += '`tabSales Order`.project_name ="'+doc.project_name+'"';
}
return repl('SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "%(company)s" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_delivered,0) < 99.99 and %(cond)s `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50', {company:doc.company,cond:cond})
}
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.serial_no) {

View File

@ -384,7 +384,7 @@ class DocType(SellingController):
@webnotes.whitelist()
def make_sales_invoice(source_name, target_doclist=None):
def update_item(obj, target, source_parent):
target.export_amount = flt(obj.amount) - flt(obj.billed_amt)
target.export_amount = flt(obj.amount)
target.amount = target.export_amount / flt(source_parent.conversion_rate)
target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
@ -408,8 +408,7 @@ def make_sales_invoice(source_name, target_doclist=None):
"prevdoc_docname": "sales_order",
"serial_no": "serial_no"
},
"postprocess": update_item,
"condition": lambda doc: doc.amount==0 or doc.billed_amt < doc.export_amount
"postprocess": update_item
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-07-08 13:17:51",
"modified": "2013-07-08 17:46:45",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -34,6 +34,7 @@
"parent": "Delivery Note",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1
},
@ -389,42 +390,6 @@
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"read_only": 0
},
{
"description": "You can make a delivery note from multiple sales orders. Select sales orders one by one and click on the button below.",
"doctype": "DocField",
"fieldname": "sales_order_no",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Order No",
"no_copy": 0,
"oldfieldname": "sales_order_no",
"oldfieldtype": "Link",
"options": "Sales Order",
"print_hide": 0,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"hidden": 0,
"label": "Get Items",
"oldfieldtype": "Button",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break24",
"fieldtype": "Column Break",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
@ -680,25 +645,6 @@
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_59",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_61",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "terms",
@ -969,33 +915,6 @@
"search_index": 1,
"width": "150px"
},
{
"depends_on": "eval:!doc.__islocal",
"description": "% of materials billed against this Delivery Note",
"doctype": "DocField",
"fieldname": "per_billed",
"fieldtype": "Percent",
"in_filter": 1,
"in_list_view": 1,
"label": "% Amount Billed",
"no_copy": 1,
"oldfieldname": "per_billed",
"oldfieldtype": "Currency",
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "billing_status",
"fieldtype": "Select",
"hidden": 1,
"label": "Billing Status",
"no_copy": 1,
"options": "\nNot Billed\nPartly Billed\nFully Billed",
"print_hide": 1,
"read_only": 0
},
{
"depends_on": "eval:!doc.__islocal",
"description": "% of materials delivered against this Delivery Note",
@ -1141,83 +1060,39 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material User",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material Manager",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Sales User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Sales User",
"submit": 0,
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Accounts User",
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Accounts User",
"submit": 0
},
{
"doctype": "DocPerm",
"match": "customer_name",
"permlevel": 0,
"role": "Customer"
}
]

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"modified": "2013-05-22 12:15:32",
"modified": "2013-07-08 17:46:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -308,18 +308,6 @@
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "billed_amt",
"fieldtype": "Currency",
"label": "Billed Amt",
"no_copy": 1,
"options": "currency",
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "installed_qty",

View File

@ -52,16 +52,32 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
}
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Sales Order'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_material_request",
source_doctype: "Sales Order",
get_query_filters: {
docstatus: 1,
status: ["!=", "Stopped"],
per_delivered: ["<", 99.99],
company: cur_frm.doc.company
}
})
});
}
if(doc.docstatus == 1 && doc.status == 'Stopped')
cur_frm.add_custom_button('Unstop Material Request',
cur_frm.cscript['Unstop Material Request']);
if(doc.material_request_type === "Transfer") {
cur_frm.toggle_display("sales_order_no", false);
cur_frm.fields_dict.indent_details.grid.set_column_disp("sales_order_no", false);
}
},
tc_name: function() {
this.get_terms();
},
validate_company_and_party: function(party_field) {
@ -71,14 +87,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
calculate_taxes_and_totals: function() {
return;
},
pull_sales_order_details: function(doc) {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_material_request",
source_name: cur_frm.doc.sales_order_no,
});
},
make_purchase_order: function() {
wn.model.open_mapped_doc({
method: "stock.doctype.material_request.material_request.make_purchase_order",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-07-08 11:02:12",
"modified": "2013-07-08 15:40:01",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -98,44 +98,6 @@
"oldfieldtype": "Table",
"options": "Material Request Item"
},
{
"doctype": "DocField",
"fieldname": "section_break1",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "column_break4",
"fieldtype": "Column Break",
"print_width": "50%",
"width": "50%"
},
{
"description": "One or multiple Sales Order no which generated this Material Request",
"doctype": "DocField",
"fieldname": "sales_order_no",
"fieldtype": "Link",
"label": "Sales Order No",
"no_copy": 1,
"oldfieldname": "sales_order_no",
"oldfieldtype": "Data",
"options": "Sales Order",
"print_width": "100px",
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "column_break5",
"fieldtype": "Column Break",
"print_width": "50%",
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "pull_sales_order_details",
"fieldtype": "Button",
"label": "Pull Sales Order Items"
},
{
"default": "Give additional details about the indent.",
"doctype": "DocField",
@ -308,13 +270,6 @@
"print_hide": 1,
"report_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "terms",

View File

@ -35,6 +35,22 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
}
cur_frm.add_custom_button(wn._('From Purchase Order'),
function() {
wn.model.map_current_doc({
method: "buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
source_doctype: "Purchase Order",
get_query_filters: {
supplier: cur_frm.doc.supplier || undefined,
docstatus: 1,
status: ["!=", "Stopped"],
per_received: ["<", 99.99],
company: cur_frm.doc.company
}
})
});
if(wn.boot.control_panel.country == 'India') {
unhide_field(['challan_no', 'challan_date']);
}
@ -85,14 +101,11 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
source_name: cur_frm.doc.name
})
},
pull_purchase_order_details: function() {
wn.model.map_current_doc({
method: "buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
source_name: cur_frm.doc.purchase_order_no,
})
}
tc_name: function() {
this.get_terms();
},
});
// for backward compatibility: combine new and previous states
@ -146,57 +159,10 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
}
cur_frm.fields_dict['purchase_order_no'].get_query = function(doc) {
if (doc.supplier)
return 'SELECT DISTINCT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`supplier` = "' +doc.supplier + '" and`tabPurchase Order`.`docstatus` = 1 and `tabPurchase Order`.`status` != "Stopped" and ifnull(`tabPurchase Order`.`per_received`, 0) < 99.99 and `tabPurchase Order`.`currency` = ifnull("' +doc.currency+ '","") and `tabPurchase Order`.company = "'+ doc.company +'" and `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50';
else
return 'SELECT DISTINCT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 and `tabPurchase Order`.`company` = "'+ doc.company +'" and `tabPurchase Order`.`status` != "Stopped" and ifnull(`tabPurchase Order`.`per_received`, 0) < 99.99 and `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50';
}
cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = function(doc) {
return 'SELECT `tabQuality Inspection`.name FROM `tabQuality Inspection` WHERE `tabQuality Inspection`.docstatus = 1 AND `tabQuality Inspection`.%(key)s LIKE "%s"';
}
cur_frm.pformat.purchase_order_no = function(doc, cdt, cdn){
//function to make row of table
var make_row = function(title,val1, val2, bold){
var bstart = '<b>'; var bend = '</b>';
return '<tr><td style="width:39%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+'<td style="width:61%;text-align:left;">'+val1+(val2?' ('+dateutil.str_to_user(val2)+')':'')+'</td>'
+'</tr>'
}
out ='';
var cl = getchildren('Purchase Receipt Item',doc.name,'purchase_receipt_details');
// outer table
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
// main table
out +='<table class="noborder" style="width:100%">';
// add rows
if(cl.length){
prevdoc_list = new Array();
for(var i=0;i<cl.length;i++){
if(cl[i].prevdoc_doctype == 'Purchase Order' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
prevdoc_list.push(cl[i].prevdoc_docname);
if(prevdoc_list.length ==1)
out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
else
out += make_row('', cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
}
}
}
out +='</table></td></tr></table></div>';
return out;
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cint(wn.boot.notification_settings.purchase_receipt)) {
cur_frm.email_doc(wn.boot.notification_settings.purchase_receipt_message);

View File

@ -68,7 +68,10 @@ class DocType(BuyingController):
msgprint("Rejected Warehouse is necessary if there are rejections.")
raise Exception
if not flt(d.qty) and flt(d.rejected_qty):
if not flt(d.received_qty) and flt(d.qty):
d.received_qty = flt(d.qty) - flt(d.rejected_qty)
elif not flt(d.qty) and flt(d.rejected_qty):
d.qty = flt(d.received_qty) - flt(d.rejected_qty)
elif not flt(d.rejected_qty):
@ -359,9 +362,10 @@ def make_purchase_invoice(source_name, target_doclist=None):
def update_item(obj, target, source_parent):
target.conversion_factor = 1
target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
target.import_amount = flt(obj.import_amount)
target.amount = target.import_amount / flt(source_parent.conversion_rate)
target.qty = target.amount / flt(obj.purchase_rate)
if flt(obj.purchase_rate):
target.qty = target.amount / flt(obj.purchase_rate)
doclist = get_mapped_doclist("Purchase Receipt", source_name, {
"Purchase Receipt": {
@ -379,8 +383,7 @@ def make_purchase_invoice(source_name, target_doclist=None):
"prevdoc_docname": "purchase_order",
"purchase_rate": "rate"
},
"postprocess": update_item,
"condition": lambda doc: doc.amount==0 or doc.billed_amt < doc.import_amount
"postprocess": update_item
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-07-05 14:52:08",
"modified": "2013-07-08 17:46:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -32,6 +32,7 @@
"parent": "Purchase Receipt",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1
},
@ -241,32 +242,6 @@
"label": "Re-Calculate Values",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "section_break_20",
"fieldtype": "Section Break"
},
{
"description": "You can make a purchase receipt from multiple purchase orders. Select purchase orders one by one and click on the button below.",
"doctype": "DocField",
"fieldname": "purchase_order_no",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Purchase Order",
"no_copy": 1,
"oldfieldname": "purchase_order_no",
"oldfieldtype": "Link",
"options": "Purchase Order",
"print_hide": 0
},
{
"doctype": "DocField",
"fieldname": "pull_purchase_order_details",
"fieldtype": "Button",
"label": "Pull Purchase Order Details",
"oldfieldtype": "Button",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "currency_price_list",
@ -556,13 +531,6 @@
"options": "Terms and Conditions",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "terms",
@ -626,20 +594,6 @@
"search_index": 1,
"width": "150px"
},
{
"depends_on": "eval:!doc.__islocal",
"description": "% of materials billed against this Purchase Receipt",
"doctype": "DocField",
"fieldname": "per_billed",
"fieldtype": "Percent",
"in_list_view": 1,
"label": "% Billed",
"no_copy": 1,
"oldfieldname": "per_billed",
"oldfieldtype": "Currency",
"print_hide": 1,
"read_only": 1
},
{
"default": "No",
"description": "Select \"Yes\" for sub - contracting items",
@ -878,42 +832,20 @@
"print_hide": 1,
"read_only": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material Manager",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material User",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material User",
"submit": 1,
"write": 1
@ -923,24 +855,13 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Purchase User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Purchase User",
"submit": 0
},
{
"doctype": "DocPerm",
"match": "supplier",
"permlevel": 0,
"role": "Supplier"
}
]

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"modified": "2013-05-31 14:26:41",
"modified": "2013-07-08 17:46:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -165,7 +165,7 @@
"doctype": "DocField",
"fieldname": "purchase_ref_rate",
"fieldtype": "Currency",
"label": "Ref Rate*",
"label": "Price List Rate*",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0
@ -452,16 +452,6 @@
"search_index": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "billed_amt",
"fieldtype": "Currency",
"label": "Billed Amt",
"no_copy": 1,
"options": "currency",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "valuation_rate",

View File

@ -464,16 +464,23 @@ class DocType(StockController):
item_dict = self.get_pending_raw_materials(pro_obj)
else:
item_dict = self.get_bom_raw_materials(self.doc.fg_completed_qty)
for item in item_dict.values():
item["from_warehouse"] = pro_obj.doc.wip_warehouse
item["to_warehouse"] = ""
# add raw materials to Stock Entry Detail table
self.add_to_stock_entry_detail(item_dict)
# add finished good item to Stock Entry Detail table -- along with bom_no
if self.doc.production_order and self.doc.purpose == "Manufacture/Repack":
self.doc.to_warehouse = pro_obj.doc.fg_warehouse
self.add_to_stock_entry_detail({
cstr(pro_obj.doc.production_item):
[self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]
cstr(pro_obj.doc.production_item): {
"to_warehouse": pro_obj.doc.fg_warehouse,
"from_warehouse": "",
"qty": self.doc.fg_completed_qty,
"description": pro_obj.doc.description,
"stock_uom": pro_obj.doc.stock_uom
}
}, bom_no=pro_obj.doc.bom_no)
elif self.doc.purpose in ["Material Receipt", "Manufacture/Repack"]: