production cleanup
This commit is contained in:
parent
d3e04c3185
commit
c52edd1e59
@ -8,88 +8,118 @@
|
|||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||||
if (!doc.posting_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
if (!doc.status) doc.status = 'Draft';
|
||||||
if (!doc.status) doc.status = 'Draft';
|
cfn_set_fields(doc, dt, dn);
|
||||||
cfn_set_fields(doc, dt, dn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================== Refresh ==========================================
|
// ================================== Refresh ==========================================
|
||||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||||
cfn_set_fields(doc, dt, dn);
|
cur_frm.set_intro("");
|
||||||
|
cfn_set_fields(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) {
|
||||||
|
if(doc.status === "Stopped") {
|
||||||
|
cur_frm.set_intro("This Production Order is Stopped.");
|
||||||
|
} else {
|
||||||
|
if(doc.produced_qty == doc.qty) {
|
||||||
|
cur_frm.set_intro("This Production Order is Completed.");
|
||||||
|
} else {
|
||||||
|
cur_frm.set_intro("This Production Order is in progress.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.update_status_html(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.update_status_html = function(doc) {
|
||||||
|
$(cur_frm.get_field("status_html").wrapper).empty();
|
||||||
|
|
||||||
|
if(doc.issued_qty) {
|
||||||
|
$(repl("<div class='progress'>\
|
||||||
|
<div class='bar bar-success' style='width: %(manufactured)s%' \
|
||||||
|
title='%(manufactured_qty)s %(uom)s manufactured'></div> \
|
||||||
|
</div>"), {
|
||||||
|
manufactured_qty: doc.produced_qty,
|
||||||
|
manufactured: Math.round((doc.produced_qty / doc.qty) * 100),
|
||||||
|
uom: doc.stock_uom,
|
||||||
|
}).appendTo(cur_frm.get_field("status_html").wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfn_set_fields = function(doc, dt, dn) {
|
var cfn_set_fields = function(doc, dt, dn) {
|
||||||
if (doc.docstatus == 1) {
|
if (doc.docstatus == 1) {
|
||||||
if (doc.status != 'Stopped' && doc.status != 'Completed')
|
if (doc.status != 'Stopped' && doc.status != 'Completed')
|
||||||
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Production Order']);
|
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Production Order']);
|
||||||
else if (doc.status == 'Stopped')
|
else if (doc.status == 'Stopped')
|
||||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Production Order']);
|
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Production Order']);
|
||||||
|
|
||||||
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
|
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
|
||||||
cur_frm.add_custom_button('Transfer Material', cur_frm.cscript['Transfer Material']);
|
cur_frm.add_custom_button('Issue Raw Materials', cur_frm.cscript['Issue Raw Materials']);
|
||||||
cur_frm.add_custom_button('Backflush', cur_frm.cscript['Backflush']);
|
cur_frm.add_custom_button('Update Finished Goods', cur_frm.cscript['Update Finished Goods']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.production_item = function(doc, dt, dn) {
|
cur_frm.cscript.production_item = function(doc) {
|
||||||
get_server_fields('get_item_detail',doc.production_item,'',doc,dt,dn,1);
|
cur_frm.call({
|
||||||
|
method: "get_item_details",
|
||||||
|
args: { item: doc.production_item }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Stop Production Order'] = function() {
|
cur_frm.cscript['Stop Production Order'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
var check = confirm("Do you really want to stop production order: " + doc.name);
|
var check = confirm("Do you really want to stop production order: " + doc.name);
|
||||||
if (check) {
|
if (check) {
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Unstop Production Order'] = function() {
|
cur_frm.cscript['Unstop Production Order'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
var check = confirm("Do really want to unstop production order: " + doc.name);
|
var check = confirm("Do really want to unstop production order: " + doc.name);
|
||||||
if (check)
|
if (check)
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Transfer Material'] = function() {
|
cur_frm.cscript['Issue Raw Materials'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
cur_frm.cscript.make_se(doc, process = 'Material Transfer');
|
cur_frm.cscript.make_se(doc, process = 'Material Transfer');
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Backflush'] = function() {
|
cur_frm.cscript['Update Finished Goods'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
cur_frm.cscript.make_se(doc, process = 'Backflush');
|
cur_frm.cscript.make_se(doc, process = 'Backflush');
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_se = function(doc, process) {
|
cur_frm.cscript.make_se = function(doc, process) {
|
||||||
var se = LocalDB.create('Stock Entry');
|
var se = LocalDB.create('Stock Entry');
|
||||||
se = locals['Stock Entry'][se];
|
se = locals['Stock Entry'][se];
|
||||||
se.purpose = 'Production Order';
|
se.purpose = 'Production Order';
|
||||||
se.process = process;
|
se.process = process;
|
||||||
se.posting_date = doc.posting_date;
|
se.production_order = doc.name;
|
||||||
se.production_order = doc.name;
|
se.company = doc.company;
|
||||||
se.fiscal_year = doc.fiscal_year;
|
|
||||||
se.company = doc.company;
|
loaddoc('Stock Entry', se.name);
|
||||||
|
|
||||||
loaddoc('Stock Entry', se.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
||||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,20 +35,8 @@ class DocType:
|
|||||||
|
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
p = self.doc.fiscal_year
|
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5] +
|
||||||
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5]+self.doc.fiscal_year[7:9] + '/.######')
|
self.doc.fiscal_year[7:9] + '/.######')
|
||||||
|
|
||||||
|
|
||||||
def get_item_detail(self, prod_item):
|
|
||||||
item = sql("""select description, stock_uom, default_bom from `tabItem`
|
|
||||||
where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and name = %s""", prod_item, as_dict = 1 )
|
|
||||||
ret = {
|
|
||||||
'description' : item and item[0]['description'] or '',
|
|
||||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
|
||||||
'default_bom' : item and item[0]['default_bom'] or ''
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.doc.production_item :
|
if self.doc.production_item :
|
||||||
@ -144,4 +132,21 @@ class DocType:
|
|||||||
"posting_date": nowdate(),
|
"posting_date": nowdate(),
|
||||||
"planned_qty": flt(qty)
|
"planned_qty": flt(qty)
|
||||||
}
|
}
|
||||||
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(args)
|
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(args)
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_item_details(item):
|
||||||
|
res = webnotes.conn.sql("""select stock_uom
|
||||||
|
from `tabItem` where (ifnull(end_of_life, "")="" or end_of_life > now())
|
||||||
|
and name=%s""", (item,), as_dict=1)
|
||||||
|
|
||||||
|
if not res:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
res = res[0]
|
||||||
|
bom = webnotes.conn.sql("""select name from `tabBOM` where item=%s
|
||||||
|
and ifnull(is_default, 0)=1""", (item,))
|
||||||
|
if bom:
|
||||||
|
res.bom_no = bom[0][0]
|
||||||
|
|
||||||
|
return res
|
@ -2,9 +2,9 @@
|
|||||||
{
|
{
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-07-03 13:30:03",
|
"creation": "2012-12-11 15:15:05",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-12-10 18:30:00"
|
"modified": "2012-12-11 18:30:35"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
@ -18,14 +18,22 @@
|
|||||||
"parent": "Production Order",
|
"parent": "Production Order",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
|
"permlevel": 0,
|
||||||
"parentfield": "fields"
|
"parentfield": "fields"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "__common__",
|
|
||||||
"parent": "Production Order",
|
"parent": "Production Order",
|
||||||
"read": 1,
|
"read": 1,
|
||||||
|
"cancel": 1,
|
||||||
|
"name": "__common__",
|
||||||
|
"amend": 1,
|
||||||
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
"submit": 1,
|
||||||
|
"write": 1,
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
|
"role": "Manufacturing User",
|
||||||
|
"permlevel": 0,
|
||||||
"parentfield": "permissions"
|
"parentfield": "permissions"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -33,291 +41,183 @@
|
|||||||
"doctype": "DocType"
|
"doctype": "DocType"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"read_only": 1,
|
||||||
"width": "50%",
|
"depends_on": "eval:!doc.__islocal",
|
||||||
"fieldname": "column_break0",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Item for which this Production Order is raised.",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Production Item",
|
|
||||||
"oldfieldname": "production_item",
|
|
||||||
"permlevel": 0,
|
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "production_item",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"reqd": 1,
|
|
||||||
"in_filter": 1,
|
|
||||||
"options": "Item"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Bill of Material which was considered for manufacturing the production item.",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "BOM No",
|
|
||||||
"oldfieldname": "bom_no",
|
|
||||||
"permlevel": 0,
|
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "bom_no",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"reqd": 1,
|
|
||||||
"options": "BOM"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Quantity of item for which Production Order is raised.",
|
|
||||||
"oldfieldtype": "Currency",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Qty",
|
|
||||||
"oldfieldname": "qty",
|
|
||||||
"fieldname": "qty",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"reqd": 1,
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "The date on which current entry will get or has actually executed.",
|
|
||||||
"oldfieldtype": "Date",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Posting Date",
|
|
||||||
"oldfieldname": "posting_date",
|
|
||||||
"fieldname": "posting_date",
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"reqd": 1,
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"oldfieldtype": "Column Break",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"width": "50%",
|
|
||||||
"fieldname": "column_break1",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "The warehouse for finished goods where stock of produced items will be updated.",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "FG Warehouse",
|
|
||||||
"oldfieldname": "fg_warehouse",
|
|
||||||
"permlevel": 0,
|
|
||||||
"fieldname": "fg_warehouse",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"reqd": 1,
|
|
||||||
"in_filter": 1,
|
|
||||||
"options": "Warehouse"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "The work in progress warehouse where raw materials will be operated upon to create finished goods.",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "WIP Warehouse",
|
|
||||||
"oldfieldname": "wip_warehouse",
|
|
||||||
"permlevel": 0,
|
|
||||||
"fieldname": "wip_warehouse",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"reqd": 1,
|
|
||||||
"in_filter": 1,
|
|
||||||
"options": "Warehouse"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
|
|
||||||
"default": "1",
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Use Multi-Level BOM",
|
|
||||||
"oldfieldname": "consider_sa_items",
|
|
||||||
"fieldname": "use_multi_level_bom",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"reqd": 0,
|
|
||||||
"in_filter": 1,
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Updated after finished goods are transferred to FG Warehouse through Stock Entry",
|
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldtype": "Currency",
|
"search_index": 1,
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Produced Qty",
|
|
||||||
"oldfieldname": "produced_qty",
|
|
||||||
"fieldname": "produced_qty",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"permlevel": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "More Info",
|
|
||||||
"fieldname": "more_info",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocField",
|
|
||||||
"width": "50%",
|
|
||||||
"fieldname": "column_break2",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Origin",
|
|
||||||
"oldfieldname": "origin",
|
|
||||||
"options": "Manual\nMRP",
|
|
||||||
"fieldname": "origin",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"reqd": 1,
|
|
||||||
"permlevel": 0,
|
|
||||||
"in_filter": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"oldfieldname": "status",
|
"oldfieldname": "status",
|
||||||
"permlevel": 1,
|
|
||||||
"fieldname": "status",
|
"fieldname": "status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"search_index": 1,
|
"oldfieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
|
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"read_only": 0,
|
||||||
"label": "Sales Order",
|
|
||||||
"options": "Sales Order",
|
|
||||||
"fieldname": "sales_order",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Select name of the project if Production Order need to be created against any project",
|
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"label": "Project Name",
|
|
||||||
"oldfieldname": "project_name",
|
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "project_name",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"options": "Project",
|
"label": "Item To Manufacture",
|
||||||
"permlevel": 0,
|
"oldfieldname": "production_item",
|
||||||
|
"fieldname": "production_item",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"reqd": 1,
|
||||||
|
"options": "Item",
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"description": "Bill of Material to be considered for manufacturing",
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Company",
|
"label": "BOM No",
|
||||||
"oldfieldname": "company",
|
"oldfieldname": "bom_no",
|
||||||
"options": "Company",
|
"fieldname": "bom_no",
|
||||||
"fieldname": "company",
|
"fieldtype": "Link",
|
||||||
|
"depends_on": "production_item",
|
||||||
|
"reqd": 1,
|
||||||
|
"options": "BOM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"description": "Update Planned Quantity in this Warehouse",
|
||||||
|
"depends_on": "production_item",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "For Warehouse",
|
||||||
|
"fieldname": "fg_warehouse",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"permlevel": 0
|
"options": "Warehouse"
|
||||||
},
|
|
||||||
{
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Fiscal Year",
|
|
||||||
"oldfieldname": "fiscal_year",
|
|
||||||
"options": "link:Fiscal Year",
|
|
||||||
"fieldname": "fiscal_year",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"reqd": 1,
|
|
||||||
"permlevel": 0,
|
|
||||||
"in_filter": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldtype": "Data",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Amended From",
|
|
||||||
"oldfieldname": "amended_from",
|
|
||||||
"fieldname": "amended_from",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"permlevel": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldtype": "Date",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"label": "Amendment Date",
|
|
||||||
"oldfieldname": "amendment_date",
|
|
||||||
"fieldname": "amendment_date",
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"permlevel": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"oldfieldtype": "Column Break",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"width": "50%",
|
"width": "50%",
|
||||||
"fieldname": "column_break3",
|
"fieldname": "column_break1",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"permlevel": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"depends_on": "issued_qty",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Status HTML",
|
||||||
|
"fieldname": "status_html",
|
||||||
|
"fieldtype": "HTML"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"oldfieldtype": "Currency",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Qty To Manufacture",
|
||||||
|
"oldfieldname": "qty",
|
||||||
|
"fieldname": "qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"depends_on": "production_item",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 1,
|
||||||
|
"description": "Automatically updated via Backflush (Stock Entry)",
|
||||||
|
"no_copy": 1,
|
||||||
|
"oldfieldtype": "Currency",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Manufactured Qty",
|
||||||
|
"oldfieldname": "produced_qty",
|
||||||
|
"fieldname": "produced_qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"depends_on": "eval:doc.docstatus==1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 1,
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"permlevel": 1
|
"depends_on": "production_item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Text",
|
"read_only": 0,
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Production Item Description",
|
"label": "More Info",
|
||||||
"oldfieldname": "description",
|
"fieldname": "more_info",
|
||||||
"width": "300px",
|
"fieldtype": "Section Break"
|
||||||
"fieldname": "description",
|
|
||||||
"fieldtype": "Text",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"read_only": 0,
|
||||||
"create": 1,
|
"description": "Manufacture against Sales Order",
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocField",
|
||||||
"submit": 1,
|
"label": "Sales Order",
|
||||||
"write": 1,
|
"fieldname": "sales_order",
|
||||||
"role": "System Manager",
|
"fieldtype": "Link",
|
||||||
"cancel": 1,
|
"options": "Sales Order"
|
||||||
"permlevel": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"read_only": 0,
|
||||||
"role": "All",
|
"oldfieldtype": "Link",
|
||||||
"permlevel": 1
|
"doctype": "DocField",
|
||||||
|
"label": "Project Name",
|
||||||
|
"oldfieldname": "project_name",
|
||||||
|
"fieldname": "project_name",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Project",
|
||||||
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"read_only": 0,
|
||||||
"create": 1,
|
"doctype": "DocField",
|
||||||
"doctype": "DocPerm",
|
"width": "50%",
|
||||||
"submit": 1,
|
"fieldname": "column_break2",
|
||||||
"write": 1,
|
"fieldtype": "Column Break"
|
||||||
"role": "Manufacturing Manager",
|
|
||||||
"cancel": 1,
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"read_only": 0,
|
||||||
"create": 1,
|
"oldfieldtype": "Link",
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocField",
|
||||||
"submit": 1,
|
"label": "Company",
|
||||||
"write": 1,
|
"oldfieldname": "company",
|
||||||
"role": "Manufacturing User",
|
"fieldname": "company",
|
||||||
"cancel": 1,
|
"fieldtype": "Link",
|
||||||
"permlevel": 0
|
"reqd": 1,
|
||||||
|
"options": "Company"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 0,
|
||||||
|
"oldfieldtype": "Select",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Fiscal Year",
|
||||||
|
"oldfieldname": "fiscal_year",
|
||||||
|
"fieldname": "fiscal_year",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"reqd": 1,
|
||||||
|
"options": "link:Fiscal Year",
|
||||||
|
"in_filter": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"read_only": 1,
|
||||||
|
"no_copy": 1,
|
||||||
|
"oldfieldtype": "Data",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Amended From",
|
||||||
|
"oldfieldname": "amended_from",
|
||||||
|
"fieldname": "amended_from",
|
||||||
|
"fieldtype": "Data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"print_hide": 1,
|
||||||
|
"description": "The date at which current entry is corrected in the system.",
|
||||||
|
"no_copy": 1,
|
||||||
|
"depends_on": "eval:doc.amended_from",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Amendment Date",
|
||||||
|
"fieldname": "amendment_date",
|
||||||
|
"fieldtype": "Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -7,7 +7,7 @@ wn.doclistviews['Production Order'] = wn.views.ListView.extend({
|
|||||||
'`tabProduction Order`.fg_warehouse',
|
'`tabProduction Order`.fg_warehouse',
|
||||||
'`tabProduction Order`.stock_uom',
|
'`tabProduction Order`.stock_uom',
|
||||||
'IFNULL(`tabProduction Order`.qty, 0) as qty',
|
'IFNULL(`tabProduction Order`.qty, 0) as qty',
|
||||||
'`tabProduction Order`.posting_date',
|
'`tabProduction Order`.creation',
|
||||||
'`tabProduction Order`.status',
|
'`tabProduction Order`.status',
|
||||||
]);
|
]);
|
||||||
this.stats = this.stats.concat(['company']);
|
this.stats = this.stats.concat(['company']);
|
||||||
@ -15,7 +15,7 @@ wn.doclistviews['Production Order'] = wn.views.ListView.extend({
|
|||||||
|
|
||||||
prepare_data: function(data) {
|
prepare_data: function(data) {
|
||||||
this._super(data);
|
this._super(data);
|
||||||
data.posting_date = wn.datetime.str_to_user(data.posting_date);
|
data.creation = wn.datetime.str_to_user(data.creation);
|
||||||
},
|
},
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
@ -33,7 +33,7 @@ wn.doclistviews['Production Order'] = wn.views.ListView.extend({
|
|||||||
},
|
},
|
||||||
css: {'text-align':'right'}
|
css: {'text-align':'right'}
|
||||||
},
|
},
|
||||||
{width: '12%', content:'posting_date', css: {
|
{width: '12%', content:'creation', css: {
|
||||||
'text-align': 'right', 'color':'#777'
|
'text-align': 'right', 'color':'#777'
|
||||||
}},
|
}},
|
||||||
]
|
]
|
||||||
|
@ -204,10 +204,7 @@ class DocType:
|
|||||||
"bom_no" : d.bom_no,
|
"bom_no" : d.bom_no,
|
||||||
"description" : d.description,
|
"description" : d.description,
|
||||||
"stock_uom" : d.stock_uom,
|
"stock_uom" : d.stock_uom,
|
||||||
"use_multi_level_bom": self.doc.use_multi_level_bom,
|
|
||||||
"company" : self.doc.company,
|
"company" : self.doc.company,
|
||||||
"posting_date" : nowdate(),
|
|
||||||
"origin" : "MRP",
|
|
||||||
"wip_warehouse" : "",
|
"wip_warehouse" : "",
|
||||||
"fg_warehouse" : "",
|
"fg_warehouse" : "",
|
||||||
"status" : "Draft",
|
"status" : "Draft",
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
{
|
{
|
||||||
"owner": "jai@webnotestech.com",
|
"owner": "jai@webnotestech.com",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-07-03 13:30:03",
|
"creation": "2012-12-11 15:15:06",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-12-10 18:30:00"
|
"modified": "2012-12-11 16:13:59"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
|
"default_print_format": "Standard",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "__common__"
|
"name": "__common__"
|
||||||
@ -39,7 +40,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Select Sales Orders from which you want to create Production Orders.",
|
"description": "Select Sales Orders from which you want to create Production Orders.",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Select Sales Orders",
|
"label": "Select Sales Orders",
|
||||||
"fieldname": "select_sales_orders",
|
"fieldname": "select_sales_orders",
|
||||||
@ -68,9 +68,9 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"reqd": 1,
|
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"reqd": 1,
|
||||||
"options": "Company"
|
"options": "Company"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -99,7 +99,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Pull sales orders (pending to deliver) based on the above criteria",
|
"description": "Pull sales orders (pending to deliver) based on the above criteria",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Get Sales Orders",
|
"label": "Get Sales Orders",
|
||||||
"fieldname": "get_sales_orders",
|
"fieldname": "get_sales_orders",
|
||||||
@ -107,7 +106,6 @@
|
|||||||
"options": "get_open_sales_orders"
|
"options": "get_open_sales_orders"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Production Plan Sales Orders",
|
"label": "Production Plan Sales Orders",
|
||||||
"fieldname": "pp_so_details",
|
"fieldname": "pp_so_details",
|
||||||
@ -115,17 +113,14 @@
|
|||||||
"options": "Production Plan Sales Order"
|
"options": "Production Plan Sales Order"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Clear Table",
|
"label": "Clear Table",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "clear_so_table",
|
"fieldname": "clear_so_table",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"options": "clear_so_table"
|
"options": "clear_so_table"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
|
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Create Production Orders",
|
"label": "Create Production Orders",
|
||||||
"fieldname": "create_production_orders",
|
"fieldname": "create_production_orders",
|
||||||
@ -133,7 +128,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Pull items from Sales Order mentioned in the above table.",
|
"description": "Pull items from Sales Order mentioned in the above table.",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Get Items",
|
"label": "Get Items",
|
||||||
"fieldname": "get_items_from_so",
|
"fieldname": "get_items_from_so",
|
||||||
@ -141,7 +135,6 @@
|
|||||||
"options": "get_items_from_so"
|
"options": "get_items_from_so"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Production Plan Items",
|
"label": "Production Plan Items",
|
||||||
"fieldname": "pp_details",
|
"fieldname": "pp_details",
|
||||||
@ -149,23 +142,20 @@
|
|||||||
"options": "Production Plan Item"
|
"options": "Production Plan Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Clear Table",
|
"label": "Clear Table",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "clear_item_table",
|
"fieldname": "clear_item_table",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"options": "clear_item_table"
|
"options": "clear_item_table"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "If checked, BOM for sub-assembly items will be considered for raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
|
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
|
||||||
"default": "1",
|
"default": "1",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Use Multi-Level BOM",
|
"label": "Use Multi-Level BOM",
|
||||||
"reqd": 0,
|
|
||||||
"fieldname": "use_multi_level_bom",
|
"fieldname": "use_multi_level_bom",
|
||||||
"fieldtype": "Check"
|
"fieldtype": "Check",
|
||||||
|
"reqd": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -181,7 +171,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Separate production order will be created for each finished good item.",
|
"description": "Separate production order will be created for each finished good item.",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Raise Production Order",
|
"label": "Raise Production Order",
|
||||||
"fieldname": "raise_production_order",
|
"fieldname": "raise_production_order",
|
||||||
@ -196,10 +185,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Download a report containing all raw materials with their latest inventory status",
|
"description": "Download a report containing all raw materials with their latest inventory status",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Download Materials Required",
|
"label": "Download Materials Required",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "download_materials_required",
|
"fieldname": "download_materials_required",
|
||||||
"fieldtype": "Button"
|
"fieldtype": "Button"
|
||||||
},
|
},
|
||||||
|
@ -30,6 +30,9 @@ def rename_module():
|
|||||||
|
|
||||||
webnotes.conn.set_global("modules_list",
|
webnotes.conn.set_global("modules_list",
|
||||||
webnotes.conn.get_global('modules_list').replace("Production", "Manufacturing"))
|
webnotes.conn.get_global('modules_list').replace("Production", "Manufacturing"))
|
||||||
|
|
||||||
|
# set end of life to null if "0000-00-00"
|
||||||
|
webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
|
||||||
|
|
||||||
def rebuilt_exploded_bom():
|
def rebuilt_exploded_bom():
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
|
@ -469,6 +469,8 @@ class DocType(TransactionBase):
|
|||||||
"planned_qty": (is_submit and -1 or 1 ) * flt(self.doc.fg_completed_qty)
|
"planned_qty": (is_submit and -1 or 1 ) * flt(self.doc.fg_completed_qty)
|
||||||
}
|
}
|
||||||
get_obj('Warehouse', pro_obj.doc.fg_warehouse).update_bin(args)
|
get_obj('Warehouse', pro_obj.doc.fg_warehouse).update_bin(args)
|
||||||
|
elif self.doc.process == 'Material Transfer':
|
||||||
|
pass
|
||||||
|
|
||||||
pro_obj.doc.status = (flt(pro_obj.doc.qty)==flt(pro_obj.doc.produced_qty)) \
|
pro_obj.doc.status = (flt(pro_obj.doc.qty)==flt(pro_obj.doc.produced_qty)) \
|
||||||
and 'Completed' or 'In Process'
|
and 'Completed' or 'In Process'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user