stock entry incoming rate fixes and batch no get_query
This commit is contained in:
parent
d61e4fd317
commit
dd4c679899
@ -304,6 +304,29 @@ cur_frm.cscript.barcode = function(doc, cdt, cdn) {
|
|||||||
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname, doc, cdt, cdn, 1, callback);
|
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname, doc, cdt, cdn, 1, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query =
|
||||||
|
function(doc, cdt, cdn) {
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
if(d.item_code) {
|
||||||
|
if (d.warehouse) {
|
||||||
|
return "select batch_no from `tabStock Ledger Entry` sle \
|
||||||
|
where item_code = '" + d.item_code + "' and warehouse = '" + d.warehouse +
|
||||||
|
"' and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%s' \
|
||||||
|
and exists(select * from `tabBatch` where \
|
||||||
|
name = sle.batch_no and expiry_date >= '" + doc.posting_date +
|
||||||
|
"' and docstatus != 2) group by batch_no having sum(actual_qty) > 0 \
|
||||||
|
order by batch_no desc limit 50";
|
||||||
|
} else {
|
||||||
|
return "SELECT name FROM tabBatch WHERE docstatus != 2 AND item = '" +
|
||||||
|
d.item_code + "' and expiry_date >= '" + doc.posting_date +
|
||||||
|
"' AND name like '%s' ORDER BY name DESC LIMIT 50";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
msgprint("Please enter Item Code to get batch no");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *********************** QUANTITY ***************************
|
// *********************** QUANTITY ***************************
|
||||||
cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
|
cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
|
||||||
|
@ -134,16 +134,6 @@ cur_frm.cscript.new_contact = function(){
|
|||||||
loaddoc('Contact', tn);
|
loaddoc('Contact', tn);
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================= Overloaded query for link batch_no =============================================================
|
|
||||||
cur_frm.fields_dict['delivery_note_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) {
|
|
||||||
var d = locals[cdt][cdn];
|
|
||||||
if(d.item_code){
|
|
||||||
return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
alert("Please enter Item Code.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************** Get project name *****************
|
// ***************** Get project name *****************
|
||||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||||
|
@ -23,18 +23,24 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
|
|
||||||
var cfn_set_fields = function(doc, cdt, cdn) {
|
var cfn_set_fields = function(doc, cdt, cdn) {
|
||||||
lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address'];
|
lst = ['supplier', 'supplier_name', 'supplier_address',
|
||||||
if (in_list(['Material Issue', 'Material Transfer', 'Material Receipt', 'Sales Return', 'Purchase Return', 'Production Order', 'Subcontracting', 'Other'], doc.purpose)) {
|
'customer', 'customer_name', 'customer_address'];
|
||||||
|
if (in_list(['Material Issue', 'Material Transfer', 'Material Receipt', 'Sales Return',
|
||||||
|
'Purchase Return', 'Production Order', 'Subcontracting', 'Other'], doc.purpose)) {
|
||||||
hide_field(lst);
|
hide_field(lst);
|
||||||
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
|
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
|
||||||
} else unhide_field(lst);
|
} else unhide_field(lst);
|
||||||
|
|
||||||
|
|
||||||
if (doc.purpose == 'Production Order' || doc.purpose == 'Other') {
|
if (doc.purpose == 'Production Order' || doc.purpose == 'Other') {
|
||||||
unhide_field('get_items');
|
unhide_field('get_items');
|
||||||
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','warehouse_html', 'transporter', 'is_excisable_goods', 'excisable_goods']);
|
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no',
|
||||||
|
'delivery_note_no', 'sales_invoice_no','warehouse_html',
|
||||||
|
'transporter', 'is_excisable_goods', 'excisable_goods']);
|
||||||
if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']);
|
if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']);
|
||||||
else hide_field(['production_order', 'process']);
|
else {
|
||||||
|
doc.production_order = doc.process = '';
|
||||||
|
hide_field(['production_order', 'process']);
|
||||||
|
}
|
||||||
|
|
||||||
doc.from_warehouse = '';
|
doc.from_warehouse = '';
|
||||||
doc.to_warehouse = '';
|
doc.to_warehouse = '';
|
||||||
@ -46,10 +52,10 @@ var cfn_set_fields = function(doc, cdt, cdn) {
|
|||||||
hide_field('fg_completed_qty');
|
hide_field('fg_completed_qty');
|
||||||
doc.fg_completed_qty = 0;
|
doc.fg_completed_qty = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
unhide_field(['from_warehouse', 'to_warehouse']);
|
unhide_field(['from_warehouse', 'to_warehouse']);
|
||||||
hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
|
hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty',
|
||||||
|
'purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
|
||||||
doc.production_order = '';
|
doc.production_order = '';
|
||||||
doc.process = '';
|
doc.process = '';
|
||||||
doc.fg_completed_qty = 0;
|
doc.fg_completed_qty = 0;
|
||||||
@ -57,17 +63,20 @@ var cfn_set_fields = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
|
|
||||||
if(doc.purpose == 'Purchase Return') {
|
if(doc.purpose == 'Purchase Return') {
|
||||||
doc.customer=doc.customer_name = doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no='';
|
doc.customer = doc.customer_name = doc.customer_address =
|
||||||
|
doc.delivery_note_no = doc.sales_invoice_no = '';
|
||||||
unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
|
unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
|
||||||
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
||||||
}
|
}
|
||||||
else if(doc.purpose == 'Sales Return'){
|
else if(doc.purpose == 'Sales Return'){
|
||||||
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
|
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
|
||||||
unhide_field(['customer','customer_name','customer_address','delivery_note_no', 'sales_invoice_no']);
|
unhide_field(['customer', 'customer_name', 'customer_address',
|
||||||
|
'delivery_note_no', 'sales_invoice_no']);
|
||||||
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
||||||
} else{
|
} else{
|
||||||
doc.customer=doc.customer_name=doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no='';
|
doc.customer = doc.customer_name = doc.customer_address =
|
||||||
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
|
doc.delivery_note_no = doc.sales_invoice_no = doc.supplier =
|
||||||
|
doc.supplier_name = doc.supplier_address = doc.purchase_receipt_no = '';
|
||||||
}
|
}
|
||||||
refresh_many(lst);
|
refresh_many(lst);
|
||||||
}
|
}
|
||||||
@ -77,12 +86,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
|
|
||||||
//India related
|
//India related
|
||||||
excise_flds = ['is_excisable_goods', 'excisable_goods', 'under_rule']
|
excise_flds = ['is_excisable_goods', 'excisable_goods', 'under_rule'];
|
||||||
if(wn.control_panel.country == 'India') unhide_field(excise_flds);
|
if(wn.control_panel.country == 'India') unhide_field(excise_flds);
|
||||||
else hide_field(excise_flds);
|
else hide_field(excise_flds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
||||||
if(doc.delivery_note_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.delivery_note_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
@ -112,12 +120,10 @@ cur_frm.cscript.purpose = function(doc, cdt, cdn) {
|
|||||||
cfn_set_fields(doc, cdt, cdn);
|
cfn_set_fields(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.process = function(doc, cdt, cdn) {
|
cur_frm.cscript.process = function(doc, cdt, cdn) {
|
||||||
cfn_set_fields(doc, cdt, cdn);
|
cfn_set_fields(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// item code - only if quantity present in source warehosue
|
// item code - only if quantity present in source warehosue
|
||||||
//
|
//
|
||||||
var fld = cur_frm.fields_dict['mtn_details'].grid.get_field('item_code');
|
var fld = cur_frm.fields_dict['mtn_details'].grid.get_field('item_code');
|
||||||
@ -147,9 +153,7 @@ fld.get_query = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// copy over source and target warehouses
|
// copy over source and target warehouses
|
||||||
//
|
|
||||||
cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
|
cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(!d.s_warehouse && doc.from_warehouse) {
|
if(!d.s_warehouse && doc.from_warehouse) {
|
||||||
@ -162,32 +166,56 @@ cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================= Overloaded query for link batch_no =============================================================
|
// Overloaded query for link batch_no
|
||||||
cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.item_code) {
|
if(d.item_code) {
|
||||||
return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
|
if (d.s_warehouse) {
|
||||||
|
return "select batch_no from `tabStock Ledger Entry` sle \
|
||||||
|
where item_code = '" + d.item_code + "' and warehouse = '" + d.s_warehouse +
|
||||||
|
"' and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%s' \
|
||||||
|
and exists(select * from `tabBatch` where \
|
||||||
|
name = sle.batch_no and expiry_date >= '" + doc.posting_date +
|
||||||
|
"' and docstatus != 2) group by batch_no having sum(actual_qty) > 0 \
|
||||||
|
order by batch_no desc limit 50";
|
||||||
|
} else {
|
||||||
|
return "SELECT name FROM tabBatch WHERE docstatus != 2 AND item = '" +
|
||||||
|
d.item_code + "' and expiry_date >= '" + doc.posting_date +
|
||||||
|
"' AND name like '%s' ORDER BY name DESC LIMIT 50";
|
||||||
}
|
}
|
||||||
else{
|
} else {
|
||||||
alert("Please enter Item Code.");
|
msgprint("Please enter Item Code to get batch no");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================================
|
|
||||||
|
|
||||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
// get values
|
|
||||||
args = {
|
args = {
|
||||||
'item_code' : d.item_code,
|
'item_code' : d.item_code,
|
||||||
'warehouse' : cstr(d.s_warehouse),
|
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
||||||
'transfer_qty' : d.transfer_qty,
|
'transfer_qty' : d.transfer_qty,
|
||||||
'serial_no' : d.serial_no
|
'serial_no' : d.serial_no,
|
||||||
|
'fg_item' : d.fg_item,
|
||||||
|
'bom_no' : d.bom_no
|
||||||
};
|
};
|
||||||
get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================================
|
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
args = {
|
||||||
|
'item_code' : d.item_code,
|
||||||
|
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
||||||
|
'transfer_qty' : d.transfer_qty,
|
||||||
|
'serial_no' : d.serial_no,
|
||||||
|
'fg_item' : d.fg_item,
|
||||||
|
'bom_no' : d.bom_no
|
||||||
|
}
|
||||||
|
get_server_fields('get_warehouse_details', JSON.stringify(args),
|
||||||
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.t_warehouse = cur_frm.cscript.s_warehouse;
|
||||||
|
|
||||||
cur_frm.cscript.transfer_qty = function(doc,cdt,cdn) {
|
cur_frm.cscript.transfer_qty = function(doc,cdt,cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
@ -196,17 +224,12 @@ cur_frm.cscript.transfer_qty = function(doc,cdt,cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================================
|
|
||||||
|
|
||||||
cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
set_multiple('Stock Entry Detail', d.name, {'transfer_qty': flt(d.qty) * flt(d.conversion_factor)}, 'mtn_details');
|
set_multiple('Stock Entry Detail', d.name, {'transfer_qty': flt(d.qty) * flt(d.conversion_factor)}, 'mtn_details');
|
||||||
refresh_field('mtn_details');
|
refresh_field('mtn_details');
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================================
|
|
||||||
|
|
||||||
cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.uom && d.item_code){
|
if(d.uom && d.item_code){
|
||||||
@ -215,14 +238,10 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================================
|
|
||||||
//validate
|
|
||||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||||
cur_frm.cscript.validate_items(doc);
|
cur_frm.cscript.validate_items(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================================
|
|
||||||
//validate items
|
|
||||||
cur_frm.cscript.validate_items = function(doc) {
|
cur_frm.cscript.validate_items = function(doc) {
|
||||||
cl = getchildren('Stock Entry Detail',doc.name,'mtn_details');
|
cl = getchildren('Stock Entry Detail',doc.name,'mtn_details');
|
||||||
if (!cl.length) {
|
if (!cl.length) {
|
||||||
|
@ -35,8 +35,6 @@ class DocType(TransactionBase):
|
|||||||
self.item_dict = {}
|
self.item_dict = {}
|
||||||
self.fname = 'mtn_details'
|
self.fname = 'mtn_details'
|
||||||
|
|
||||||
# get item details
|
|
||||||
# ----------------
|
|
||||||
def get_item_details(self, arg):
|
def get_item_details(self, arg):
|
||||||
import json
|
import json
|
||||||
arg, actual_qty, in_rate = json.loads(arg), 0, 0
|
arg, actual_qty, in_rate = json.loads(arg), 0, 0
|
||||||
@ -45,27 +43,23 @@ class DocType(TransactionBase):
|
|||||||
if not item:
|
if not item:
|
||||||
msgprint("Item is not active", raise_exception=1)
|
msgprint("Item is not active", raise_exception=1)
|
||||||
|
|
||||||
if arg.get('warehouse'):
|
|
||||||
actual_qty = self.get_as_on_stock(arg.get('item_code'), arg.get('warehouse'), self.doc.posting_date, self.doc.posting_time)
|
|
||||||
in_rate = self.get_incoming_rate(arg.get('item_code'), arg.get('warehouse'), self.doc.posting_date, self.doc.posting_time, arg.get('transfer_qty'), arg.get('serial_no')) or 0
|
|
||||||
|
|
||||||
ret = {
|
ret = {
|
||||||
'uom' : item and item[0]['stock_uom'] or '',
|
'uom' : item and item[0]['stock_uom'] or '',
|
||||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||||
'description' : item and item[0]['description'] or '',
|
'description' : item and item[0]['description'] or '',
|
||||||
'item_name' : item and item[0]['item_name'] or '',
|
'item_name' : item and item[0]['item_name'] or '',
|
||||||
'actual_qty' : actual_qty,
|
|
||||||
'qty' : 0,
|
'qty' : 0,
|
||||||
'transfer_qty' : 0,
|
'transfer_qty' : 0,
|
||||||
'incoming_rate' : in_rate,
|
|
||||||
'conversion_factor' : 1,
|
'conversion_factor' : 1,
|
||||||
'batch_no' : ''
|
'batch_no' : '',
|
||||||
|
'actual_qty' : 0,
|
||||||
|
'incoming_rate' : 0
|
||||||
}
|
}
|
||||||
|
stock_and_rate = arg.get('warehouse') and self.get_warehouse_details(json.dumps(arg)) or {}
|
||||||
|
ret.update(stock_and_rate)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Get UOM Details
|
|
||||||
# ----------------
|
|
||||||
def get_uom_details(self, arg = ''):
|
def get_uom_details(self, arg = ''):
|
||||||
arg, ret = eval(arg), {}
|
arg, ret = eval(arg), {}
|
||||||
uom = sql("select conversion_factor from `tabUOM Conversion Detail` where parent = %s and uom = %s", (arg['item_code'],arg['uom']), as_dict = 1)
|
uom = sql("select conversion_factor from `tabUOM Conversion Detail` where parent = %s and uom = %s", (arg['item_code'],arg['uom']), as_dict = 1)
|
||||||
@ -79,27 +73,43 @@ class DocType(TransactionBase):
|
|||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def get_warehouse_details(self, arg):
|
||||||
|
import json
|
||||||
|
arg, actual_qty, in_rate = json.loads(arg), 0, 0
|
||||||
|
ret = {
|
||||||
|
"actual_qty" : self.get_as_on_stock(arg.get('item_code'), arg.get('warehouse'),
|
||||||
|
self.doc.posting_date, self.doc.posting_time),
|
||||||
|
"incoming_rate" : self.get_incoming_rate(arg.get('item_code'),
|
||||||
|
arg.get('warehouse'), self.doc.posting_date, self.doc.posting_time,
|
||||||
|
arg.get('transfer_qty'), arg.get('serial_no'), arg.get('fg_item'),
|
||||||
|
arg.get('bom_no')) or 0
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# get stock and incoming rate on posting date
|
|
||||||
# ---------------------------------------------
|
|
||||||
def get_stock_and_rate(self, bom_no = ''):
|
def get_stock_and_rate(self, bom_no = ''):
|
||||||
|
""" get stock and incoming rate on posting date"""
|
||||||
for d in getlist(self.doclist, 'mtn_details'):
|
for d in getlist(self.doclist, 'mtn_details'):
|
||||||
# assign parent warehouse
|
# assign parent warehouse
|
||||||
d.s_warehouse = cstr(d.s_warehouse) or self.doc.purpose != 'Production Order' and self.doc.from_warehouse or ''
|
d.s_warehouse = cstr(d.s_warehouse) or self.doc.purpose != 'Production Order' \
|
||||||
d.t_warehouse = cstr(d.t_warehouse) or self.doc.purpose != 'Production Order' and self.doc.to_warehouse or ''
|
and self.doc.from_warehouse or ''
|
||||||
|
d.t_warehouse = cstr(d.t_warehouse) or self.doc.purpose != 'Production Order' \
|
||||||
|
and self.doc.to_warehouse or ''
|
||||||
|
|
||||||
# get current stock at source warehouse
|
# get current stock at source warehouse
|
||||||
d.actual_qty = d.s_warehouse and self.get_as_on_stock(d.item_code, d.s_warehouse, self.doc.posting_date, self.doc.posting_time) or 0
|
d.actual_qty = self.get_as_on_stock(d.item_code, d.s_warehouse or d.t_warehouse,
|
||||||
|
self.doc.posting_date, self.doc.posting_time) or 0
|
||||||
|
|
||||||
# get incoming rate
|
# get incoming rate
|
||||||
if not flt(d.incoming_rate):
|
if not flt(d.incoming_rate):
|
||||||
d.incoming_rate = self.get_incoming_rate(d.item_code, d.s_warehouse, self.doc.posting_date, self.doc.posting_time, d.transfer_qty, d.serial_no, d.fg_item, d.bom_no or bom_no)
|
d.incoming_rate = self.get_incoming_rate(d.item_code,
|
||||||
|
d.s_warehouse or d.t_warehouse, self.doc.posting_date,
|
||||||
|
self.doc.posting_time, d.transfer_qty, d.serial_no,
|
||||||
|
d.fg_item, d.bom_no or bom_no)
|
||||||
|
|
||||||
|
|
||||||
# Get stock qty on any date
|
|
||||||
# ---------------------------
|
|
||||||
def get_as_on_stock(self, item, wh, dt, tm):
|
def get_as_on_stock(self, item, wh, dt, tm):
|
||||||
|
"""Get stock qty on any date"""
|
||||||
bin = sql("select name from tabBin where item_code = %s and warehouse = %s", (item, wh))
|
bin = sql("select name from tabBin where item_code = %s and warehouse = %s", (item, wh))
|
||||||
bin_id = bin and bin[0][0] or ''
|
bin_id = bin and bin[0][0] or ''
|
||||||
prev_sle = bin_id and get_obj('Bin', bin_id).get_prev_sle(dt, tm) or {}
|
prev_sle = bin_id and get_obj('Bin', bin_id).get_prev_sle(dt, tm) or {}
|
||||||
@ -107,17 +117,15 @@ class DocType(TransactionBase):
|
|||||||
return qty
|
return qty
|
||||||
|
|
||||||
|
|
||||||
# Get incoming rate
|
|
||||||
# -------------------
|
|
||||||
def get_incoming_rate(self, item, wh, dt, tm, qty=0, serial_no='', fg_item=0, bom_no=''):
|
def get_incoming_rate(self, item, wh, dt, tm, qty=0, serial_no='', fg_item=0, bom_no=''):
|
||||||
in_rate = 0
|
in_rate = 0
|
||||||
if fg_item and bom_no:
|
if fg_item and bom_no:
|
||||||
# re-calculate cost for production item from bom
|
in_rate = webnotes.conn.sql("""select ifnull(total_cost, 0) / ifnull(quantity, 1)
|
||||||
get_obj('BOM Control').calculate_cost(bom_no)
|
from `tabBOM` where name = %s and docstatus=1""", bom_no, debug=1)
|
||||||
bom_obj = get_obj('BOM', bom_no)
|
in_rate = in_rate and in_rate[0][0] or 0
|
||||||
in_rate = flt(bom_obj.doc.total_cost) / (flt(bom_obj.doc.quantity) or 1)
|
|
||||||
elif wh:
|
elif wh:
|
||||||
in_rate = get_obj('Valuation Control').get_incoming_rate(dt, tm, item, wh, qty, serial_no)
|
in_rate = get_obj('Valuation Control').get_incoming_rate(dt, tm,
|
||||||
|
item, wh, qty, serial_no)
|
||||||
|
|
||||||
return in_rate
|
return in_rate
|
||||||
|
|
||||||
@ -205,6 +213,10 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
def validate_bom_no(self):
|
def validate_bom_no(self):
|
||||||
if self.doc.bom_no:
|
if self.doc.bom_no:
|
||||||
|
if not webnotes.conn.sql("""select name from tabBOM where name = %s and docstatus = 1
|
||||||
|
and ifnull(is_active, 'No') = 'Yes'""", self.doc.bom_no):
|
||||||
|
msgprint("""BOM: %s not found, may be it has been cancelled or inactivated""" %
|
||||||
|
self.doc.bom_no, raise_exception=1)
|
||||||
if not self.doc.fg_completed_qty:
|
if not self.doc.fg_completed_qty:
|
||||||
msgprint("Please enter FG Completed Qty", raise_exception=1)
|
msgprint("Please enter FG Completed Qty", raise_exception=1)
|
||||||
|
|
||||||
@ -215,7 +227,8 @@ class DocType(TransactionBase):
|
|||||||
self.validate_for_production_order(pro_obj)
|
self.validate_for_production_order(pro_obj)
|
||||||
|
|
||||||
bom_no = pro_obj.doc.bom_no
|
bom_no = pro_obj.doc.bom_no
|
||||||
fg_qty = (self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty)
|
fg_qty = (self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \
|
||||||
|
or flt(pro_obj.doc.qty)
|
||||||
use_multi_level_bom = pro_obj.doc.use_multi_level_bom
|
use_multi_level_bom = pro_obj.doc.use_multi_level_bom
|
||||||
elif self.doc.purpose == 'Other':
|
elif self.doc.purpose == 'Other':
|
||||||
self.validate_bom_no()
|
self.validate_bom_no()
|
||||||
@ -234,22 +247,30 @@ class DocType(TransactionBase):
|
|||||||
if self.doc.process == 'Backflush':
|
if self.doc.process == 'Backflush':
|
||||||
sw = ''
|
sw = ''
|
||||||
tw = cstr(pro_obj.doc.fg_warehouse)
|
tw = cstr(pro_obj.doc.fg_warehouse)
|
||||||
fg_item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]}
|
fg_item_dict = {
|
||||||
|
cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty,
|
||||||
|
pro_obj.doc.description, pro_obj.doc.stock_uom]
|
||||||
|
}
|
||||||
elif self.doc.purpose == 'Other' and self.doc.bom_no:
|
elif self.doc.purpose == 'Other' and self.doc.bom_no:
|
||||||
sw, tw = '', ''
|
sw, tw = '', ''
|
||||||
item = sql("select item, description, uom from `tabBOM` where name = %s", self.doc.bom_no, as_dict=1)
|
item = sql("select item, description, uom from `tabBOM` where name = %s", self.doc.bom_no, as_dict=1)
|
||||||
fg_item_dict = {item[0]['item'] : [self.doc.fg_completed_qty, item[0]['description'], item[0]['uom']]}
|
fg_item_dict = {
|
||||||
|
item[0]['item'] : [self.doc.fg_completed_qty,
|
||||||
|
item[0]['description'], item[0]['uom']]
|
||||||
|
}
|
||||||
|
|
||||||
if fg_item_dict:
|
if fg_item_dict:
|
||||||
self.add_to_stock_entry_detail(sw, tw, fg_item_dict, fg_item = 1, bom_no = bom_no)
|
self.add_to_stock_entry_detail(sw, tw, fg_item_dict, fg_item = 1, bom_no = bom_no)
|
||||||
|
|
||||||
|
self.get_stock_and_rate()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def validate_transfer_qty(self):
|
def validate_transfer_qty(self):
|
||||||
for d in getlist(self.doclist, 'mtn_details'):
|
for d in getlist(self.doclist, 'mtn_details'):
|
||||||
if flt(d.transfer_qty) <= 0:
|
if flt(d.transfer_qty) <= 0:
|
||||||
msgprint("Transfer Quantity can not be less than or equal to zero at Row No " + cstr(d.idx))
|
msgprint("Transfer Quantity can not be less than or equal to zero \
|
||||||
raise Exception
|
at Row No " + cstr(d.idx), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
def calc_amount(self):
|
def calc_amount(self):
|
||||||
@ -326,8 +347,10 @@ class DocType(TransactionBase):
|
|||||||
self.validate_incoming_rate()
|
self.validate_incoming_rate()
|
||||||
self.validate_bom_belongs_to_item()
|
self.validate_bom_belongs_to_item()
|
||||||
self.calc_amount()
|
self.calc_amount()
|
||||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,
|
||||||
|
self.doc.posting_date, 'Posting Date')
|
||||||
|
if self.doc.purpose == 'Other':
|
||||||
|
self.validate_bom_no()
|
||||||
|
|
||||||
# If target warehouse exists, incoming rate is mandatory
|
# If target warehouse exists, incoming rate is mandatory
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-11-28 11:26:22",
|
"creation": "2012-11-28 11:26:22",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-11-30 14:10:02"
|
"modified": "2012-12-03 12:00:59"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
@ -414,7 +414,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
|
"description": "Get valuation rate and available stock at source/target warehouse on mentioned posting date-time. If serialized item, please press this button after entering serial nos.",
|
||||||
"oldfieldtype": "Button",
|
"oldfieldtype": "Button",
|
||||||
|
"colour": "White:FFF",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Get Stock and Rate",
|
"label": "Get Stock and Rate",
|
||||||
"options": "get_stock_and_rate",
|
"options": "get_stock_and_rate",
|
||||||
|
@ -1,266 +1,218 @@
|
|||||||
# DocType, Stock Entry Detail
|
|
||||||
[
|
[
|
||||||
|
|
||||||
# These values are common in all dictionaries
|
|
||||||
{
|
{
|
||||||
'creation': '2012-04-13 11:56:38',
|
"owner": "Administrator",
|
||||||
'docstatus': 0,
|
"docstatus": 0,
|
||||||
'modified': '2012-05-01 16:16:20',
|
"creation": "2012-07-03 13:29:47",
|
||||||
'modified_by': u'Administrator',
|
"modified_by": "Administrator",
|
||||||
'owner': u'Administrator'
|
"modified": "2012-12-03 11:37:17"
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
|
||||||
{
|
{
|
||||||
'autoname': u'MTND/.######',
|
"istable": 1,
|
||||||
'colour': u'White:FFF',
|
"autoname": "MTND/.######",
|
||||||
'default_print_format': u'Standard',
|
"name": "__common__",
|
||||||
'doctype': 'DocType',
|
"default_print_format": "Standard",
|
||||||
'istable': 1,
|
"doctype": "DocType",
|
||||||
'module': u'Stock',
|
"module": "Stock"
|
||||||
'name': '__common__',
|
|
||||||
'section_style': u'Tray',
|
|
||||||
'server_code_error': u' ',
|
|
||||||
'show_in_menu': 0,
|
|
||||||
'version': 1
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"name": "__common__",
|
||||||
'name': '__common__',
|
"parent": "Stock Entry Detail",
|
||||||
'parent': u'Stock Entry Detail',
|
"doctype": "DocField",
|
||||||
'parentfield': u'fields',
|
"parenttype": "DocType",
|
||||||
'parenttype': u'DocType'
|
"parentfield": "fields"
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocType, Stock Entry Detail
|
|
||||||
{
|
{
|
||||||
'doctype': 'DocType',
|
"name": "Stock Entry Detail",
|
||||||
'name': u'Stock Entry Detail'
|
"doctype": "DocType"
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Link",
|
||||||
'fieldname': u's_warehouse',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Link',
|
"label": "Source Warehouse",
|
||||||
'in_filter': 1,
|
"oldfieldname": "s_warehouse",
|
||||||
'label': u'Source Warehouse',
|
"options": "Warehouse",
|
||||||
'oldfieldname': u's_warehouse',
|
"fieldname": "s_warehouse",
|
||||||
'oldfieldtype': u'Link',
|
"fieldtype": "Link",
|
||||||
'options': u'Warehouse',
|
"permlevel": 0,
|
||||||
'permlevel': 0
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Link",
|
||||||
'fieldname': u't_warehouse',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Link',
|
"label": "Target Warehouse",
|
||||||
'in_filter': 1,
|
"oldfieldname": "t_warehouse",
|
||||||
'label': u'Target Warehouse',
|
"options": "Warehouse",
|
||||||
'oldfieldname': u't_warehouse',
|
"fieldname": "t_warehouse",
|
||||||
'oldfieldtype': u'Link',
|
"fieldtype": "Link",
|
||||||
'options': u'Warehouse',
|
"permlevel": 0,
|
||||||
'permlevel': 0
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Link",
|
||||||
'fieldname': u'item_code',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Link',
|
"label": "Item Code",
|
||||||
'in_filter': 1,
|
"oldfieldname": "item_code",
|
||||||
'label': u'Item Code',
|
"permlevel": 0,
|
||||||
'oldfieldname': u'item_code',
|
"trigger": "Client",
|
||||||
'oldfieldtype': u'Link',
|
"fieldname": "item_code",
|
||||||
'options': u'Item',
|
"fieldtype": "Link",
|
||||||
'permlevel': 0,
|
"search_index": 1,
|
||||||
'reqd': 1,
|
"reqd": 1,
|
||||||
'search_index': 1,
|
"options": "Item",
|
||||||
'trigger': u'Client'
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Text",
|
||||||
'fieldname': u'description',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Text',
|
"label": "Description",
|
||||||
'label': u'Description',
|
"oldfieldname": "description",
|
||||||
'oldfieldname': u'description',
|
"width": "300px",
|
||||||
'oldfieldtype': u'Text',
|
"fieldname": "description",
|
||||||
'permlevel': 0,
|
"fieldtype": "Text",
|
||||||
'width': u'300px'
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Currency",
|
||||||
'fieldname': u'qty',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Currency',
|
"label": "Qty",
|
||||||
'label': u'Qty',
|
"oldfieldname": "qty",
|
||||||
'oldfieldname': u'qty',
|
"trigger": "Client",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldname": "qty",
|
||||||
'permlevel': 0,
|
"fieldtype": "Currency",
|
||||||
'reqd': 1,
|
"reqd": 1,
|
||||||
'trigger': u'Client'
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'colour': u'White:FFF',
|
"oldfieldtype": "Link",
|
||||||
'doctype': u'DocField',
|
"colour": "White:FFF",
|
||||||
'fieldname': u'uom',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Link',
|
"label": "UOM",
|
||||||
'label': u'UOM',
|
"oldfieldname": "uom",
|
||||||
'oldfieldname': u'uom',
|
"trigger": "Client",
|
||||||
'oldfieldtype': u'Link',
|
"fieldname": "uom",
|
||||||
'options': u'UOM',
|
"fieldtype": "Link",
|
||||||
'permlevel': 0,
|
"reqd": 1,
|
||||||
'reqd': 1,
|
"options": "UOM",
|
||||||
'trigger': u'Client'
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Currency",
|
||||||
'fieldname': u'incoming_rate',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Currency',
|
"label": "Valuation Rate",
|
||||||
'label': u'Incoming Rate',
|
"oldfieldname": "incoming_rate",
|
||||||
'oldfieldname': u'incoming_rate',
|
"fieldname": "incoming_rate",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldtype": "Currency",
|
||||||
'permlevel': 0,
|
"reqd": 0,
|
||||||
'reqd': 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Currency",
|
||||||
'fieldname': u'amount',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Currency',
|
"label": "Amount",
|
||||||
'label': u'Amount',
|
"oldfieldname": "amount",
|
||||||
'oldfieldname': u'amount',
|
"fieldname": "amount",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldtype": "Currency",
|
||||||
'permlevel': 1
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"no_copy": 1,
|
||||||
'fieldname': u'serial_no',
|
"oldfieldtype": "Text",
|
||||||
'fieldtype': u'Text',
|
"doctype": "DocField",
|
||||||
'label': u'Serial No',
|
"label": "Serial No",
|
||||||
'no_copy': 1,
|
"oldfieldname": "serial_no",
|
||||||
'oldfieldname': u'serial_no',
|
"fieldname": "serial_no",
|
||||||
'oldfieldtype': u'Text',
|
"fieldtype": "Text",
|
||||||
'permlevel': 0,
|
"reqd": 0,
|
||||||
'reqd': 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"print_hide": 1,
|
||||||
'fieldname': u'batch_no',
|
"oldfieldtype": "Link",
|
||||||
'fieldtype': u'Link',
|
"doctype": "DocField",
|
||||||
'label': u'Batch No',
|
"label": "Batch No",
|
||||||
'oldfieldname': u'batch_no',
|
"oldfieldname": "batch_no",
|
||||||
'oldfieldtype': u'Link',
|
"trigger": "Client",
|
||||||
'options': u'Batch',
|
"fieldname": "batch_no",
|
||||||
'permlevel': 0,
|
"fieldtype": "Link",
|
||||||
'print_hide': 1,
|
"options": "Batch",
|
||||||
'trigger': u'Client'
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"print_hide": 1,
|
||||||
'fieldname': u'reqd_qty',
|
"oldfieldtype": "Currency",
|
||||||
'fieldtype': u'Currency',
|
"doctype": "DocField",
|
||||||
'in_filter': 0,
|
"label": "Reqd Qty",
|
||||||
'label': u'Reqd Qty',
|
"oldfieldname": "reqd_qty",
|
||||||
'oldfieldname': u'reqd_qty',
|
"fieldname": "reqd_qty",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldtype": "Currency",
|
||||||
'permlevel': 3,
|
"permlevel": 3,
|
||||||
'print_hide': 1
|
"in_filter": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"print_hide": 1,
|
||||||
'fieldname': u'actual_qty',
|
"no_copy": 1,
|
||||||
'fieldtype': u'Read Only',
|
"oldfieldtype": "Read Only",
|
||||||
'in_filter': 1,
|
"doctype": "DocField",
|
||||||
'label': u'Actual Qty (at source)',
|
"label": "Actual Qty (at source/target)",
|
||||||
'no_copy': 1,
|
"oldfieldname": "actual_qty",
|
||||||
'oldfieldname': u'actual_qty',
|
"fieldname": "actual_qty",
|
||||||
'oldfieldtype': u'Read Only',
|
"fieldtype": "Read Only",
|
||||||
'permlevel': 1,
|
"search_index": 1,
|
||||||
'print_hide': 1,
|
"reqd": 0,
|
||||||
'reqd': 0,
|
"permlevel": 1,
|
||||||
'search_index': 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Currency",
|
||||||
'fieldname': u'conversion_factor',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Currency',
|
"label": "Conversion Factor",
|
||||||
'label': u'Conversion Factor',
|
"oldfieldname": "conversion_factor",
|
||||||
'oldfieldname': u'conversion_factor',
|
"fieldname": "conversion_factor",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldtype": "Currency",
|
||||||
'permlevel': 1,
|
"reqd": 1,
|
||||||
'reqd': 1
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Currency",
|
||||||
'fieldname': u'transfer_qty',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Currency',
|
"label": "Stock Qty",
|
||||||
'label': u'Stock Qty',
|
"oldfieldname": "transfer_qty",
|
||||||
'oldfieldname': u'transfer_qty',
|
"fieldname": "transfer_qty",
|
||||||
'oldfieldtype': u'Currency',
|
"fieldtype": "Currency",
|
||||||
'permlevel': 1,
|
"reqd": 1,
|
||||||
'reqd': 1
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"oldfieldtype": "Link",
|
||||||
'fieldname': u'stock_uom',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Link',
|
"label": "Stock UOM",
|
||||||
'in_filter': 0,
|
"oldfieldname": "stock_uom",
|
||||||
'label': u'Stock UOM',
|
"options": "UOM",
|
||||||
'oldfieldname': u'stock_uom',
|
"fieldname": "stock_uom",
|
||||||
'oldfieldtype': u'Link',
|
"fieldtype": "Link",
|
||||||
'options': u'UOM',
|
"search_index": 0,
|
||||||
'permlevel': 1,
|
"reqd": 1,
|
||||||
'reqd': 1,
|
"permlevel": 1,
|
||||||
'search_index': 0
|
"in_filter": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'description': u'BOM No. for a Finished Good Item',
|
"description": "BOM No. for a Finished Good Item",
|
||||||
'doctype': u'DocField',
|
"doctype": "DocField",
|
||||||
'fieldname': u'bom_no',
|
"label": "BOM No",
|
||||||
'fieldtype': u'Link',
|
"options": "BOM",
|
||||||
'label': u'BOM No.',
|
"fieldname": "bom_no",
|
||||||
'options': u'BOM',
|
"fieldtype": "Link",
|
||||||
'permlevel': 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
"print_hide": 1,
|
||||||
'fieldname': u'fg_item',
|
"oldfieldtype": "Check",
|
||||||
'fieldtype': u'Check',
|
"doctype": "DocField",
|
||||||
'in_filter': 1,
|
"label": "FG Item",
|
||||||
'label': u'FG Item',
|
"oldfieldname": "fg_item",
|
||||||
'oldfieldname': u'fg_item',
|
"fieldname": "fg_item",
|
||||||
'oldfieldtype': u'Check',
|
"fieldtype": "Check",
|
||||||
'permlevel': 0,
|
"permlevel": 0,
|
||||||
'print_hide': 1
|
"in_filter": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -43,9 +43,6 @@ class DocType:
|
|||||||
self.doc.fields.pop('batch_bal')
|
self.doc.fields.pop('batch_bal')
|
||||||
|
|
||||||
|
|
||||||
# mandatory
|
|
||||||
# ---------
|
|
||||||
|
|
||||||
def validate_mandatory(self):
|
def validate_mandatory(self):
|
||||||
mandatory = ['warehouse','transaction_date','posting_date','voucher_type','voucher_no','actual_qty','company','fiscal_year']
|
mandatory = ['warehouse','transaction_date','posting_date','voucher_type','voucher_no','actual_qty','company','fiscal_year']
|
||||||
for k in mandatory:
|
for k in mandatory:
|
||||||
@ -55,9 +52,6 @@ class DocType:
|
|||||||
if not sql("select name from tabWarehouse where name = '%s'" % self.doc.fields.get(k)):
|
if not sql("select name from tabWarehouse where name = '%s'" % self.doc.fields.get(k)):
|
||||||
msgprint("Warehouse: '%s' does not exist in the system. Please check." % self.doc.fields.get(k), raise_exception = 1)
|
msgprint("Warehouse: '%s' does not exist in the system. Please check." % self.doc.fields.get(k), raise_exception = 1)
|
||||||
|
|
||||||
# validate for item
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
def validate_item(self):
|
def validate_item(self):
|
||||||
item_det = sql("select name, has_batch_no, docstatus from tabItem where name = '%s'" % self.doc.item_code)
|
item_det = sql("select name, has_batch_no, docstatus from tabItem where name = '%s'" % self.doc.item_code)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user