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,
|
||||
// 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.
|
||||
//
|
||||
// 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) {
|
||||
if (!doc.posting_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
cfn_set_fields(doc, dt, dn);
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
cfn_set_fields(doc, dt, dn);
|
||||
}
|
||||
|
||||
// ================================== Refresh ==========================================
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
cfn_set_fields(doc, dt, dn);
|
||||
cur_frm.cscript.refresh = function(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) {
|
||||
if (doc.docstatus == 1) {
|
||||
if (doc.status != 'Stopped' && doc.status != 'Completed')
|
||||
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Production Order']);
|
||||
else if (doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Production Order']);
|
||||
if (doc.docstatus == 1) {
|
||||
if (doc.status != 'Stopped' && doc.status != 'Completed')
|
||||
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Production Order']);
|
||||
else if (doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Production Order']);
|
||||
|
||||
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('Backflush', cur_frm.cscript['Backflush']);
|
||||
}
|
||||
}
|
||||
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
|
||||
cur_frm.add_custom_button('Issue Raw Materials', cur_frm.cscript['Issue Raw Materials']);
|
||||
cur_frm.add_custom_button('Update Finished Goods', cur_frm.cscript['Update Finished Goods']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.production_item = function(doc, dt, dn) {
|
||||
get_server_fields('get_item_detail',doc.production_item,'',doc,dt,dn,1);
|
||||
cur_frm.cscript.production_item = function(doc) {
|
||||
cur_frm.call({
|
||||
method: "get_item_details",
|
||||
args: { item: doc.production_item }
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Stop Production Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to stop production order: " + doc.name);
|
||||
if (check) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to stop production order: " + doc.name);
|
||||
if (check) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Unstop Production Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do really want to unstop production order: " + doc.name);
|
||||
if (check)
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do really want to unstop production order: " + doc.name);
|
||||
if (check)
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Transfer Material'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
cur_frm.cscript.make_se(doc, process = 'Material Transfer');
|
||||
cur_frm.cscript['Issue Raw Materials'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
cur_frm.cscript.make_se(doc, process = 'Material Transfer');
|
||||
}
|
||||
|
||||
cur_frm.cscript['Backflush'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
cur_frm.cscript.make_se(doc, process = 'Backflush');
|
||||
cur_frm.cscript['Update Finished Goods'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
cur_frm.cscript.make_se(doc, process = 'Backflush');
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_se = function(doc, process) {
|
||||
var se = LocalDB.create('Stock Entry');
|
||||
se = locals['Stock Entry'][se];
|
||||
se.purpose = 'Production Order';
|
||||
se.process = process;
|
||||
se.posting_date = doc.posting_date;
|
||||
se.production_order = doc.name;
|
||||
se.fiscal_year = doc.fiscal_year;
|
||||
se.company = doc.company;
|
||||
|
||||
loaddoc('Stock Entry', se.name);
|
||||
var se = LocalDB.create('Stock Entry');
|
||||
se = locals['Stock Entry'][se];
|
||||
se.purpose = 'Production Order';
|
||||
se.process = process;
|
||||
se.production_order = doc.name;
|
||||
se.company = doc.company;
|
||||
|
||||
loaddoc('Stock Entry', se.name);
|
||||
}
|
||||
|
||||
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) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,20 +35,8 @@ class DocType:
|
||||
|
||||
|
||||
def autoname(self):
|
||||
p = self.doc.fiscal_year
|
||||
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5]+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
|
||||
|
||||
self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5] +
|
||||
self.doc.fiscal_year[7:9] + '/.######')
|
||||
|
||||
def validate(self):
|
||||
if self.doc.production_item :
|
||||
@ -144,4 +132,21 @@ class DocType:
|
||||
"posting_date": nowdate(),
|
||||
"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",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:03",
|
||||
"creation": "2012-12-11 15:15:05",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-10 18:30:00"
|
||||
"modified": "2012-12-11 18:30:35"
|
||||
},
|
||||
{
|
||||
"is_submittable": 1,
|
||||
@ -18,14 +18,22 @@
|
||||
"parent": "Production Order",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Order",
|
||||
"read": 1,
|
||||
"cancel": 1,
|
||||
"name": "__common__",
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"role": "Manufacturing User",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
@ -33,291 +41,183 @@
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"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",
|
||||
"read_only": 1,
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"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",
|
||||
"search_index": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
"permlevel": 1,
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"search_index": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"reqd": 1,
|
||||
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"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",
|
||||
"read_only": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"label": "Project Name",
|
||||
"oldfieldname": "project_name",
|
||||
"trigger": "Client",
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"options": "Project",
|
||||
"permlevel": 0,
|
||||
"label": "Item To Manufacture",
|
||||
"oldfieldname": "production_item",
|
||||
"fieldname": "production_item",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "Item",
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"read_only": 0,
|
||||
"description": "Bill of Material to be considered for manufacturing",
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"options": "Company",
|
||||
"fieldname": "company",
|
||||
"label": "BOM No",
|
||||
"oldfieldname": "bom_no",
|
||||
"fieldname": "bom_no",
|
||||
"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",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"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
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"read_only": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"doctype": "DocField",
|
||||
"label": "Stock UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 1
|
||||
"depends_on": "production_item"
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Text",
|
||||
"read_only": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Production Item Description",
|
||||
"oldfieldname": "description",
|
||||
"width": "300px",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"permlevel": 0
|
||||
"label": "More Info",
|
||||
"fieldname": "more_info",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "System Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
"read_only": 0,
|
||||
"description": "Manufacture against Sales Order",
|
||||
"doctype": "DocField",
|
||||
"label": "Sales Order",
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"options": "Sales Order"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "All",
|
||||
"permlevel": 1
|
||||
"read_only": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "Project Name",
|
||||
"oldfieldname": "project_name",
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"options": "Project",
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Manufacturing Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
"read_only": 0,
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Manufacturing User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
"read_only": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"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`.stock_uom',
|
||||
'IFNULL(`tabProduction Order`.qty, 0) as qty',
|
||||
'`tabProduction Order`.posting_date',
|
||||
'`tabProduction Order`.creation',
|
||||
'`tabProduction Order`.status',
|
||||
]);
|
||||
this.stats = this.stats.concat(['company']);
|
||||
@ -15,7 +15,7 @@ wn.doclistviews['Production Order'] = wn.views.ListView.extend({
|
||||
|
||||
prepare_data: function(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: [
|
||||
@ -33,7 +33,7 @@ wn.doclistviews['Production Order'] = wn.views.ListView.extend({
|
||||
},
|
||||
css: {'text-align':'right'}
|
||||
},
|
||||
{width: '12%', content:'posting_date', css: {
|
||||
{width: '12%', content:'creation', css: {
|
||||
'text-align': 'right', 'color':'#777'
|
||||
}},
|
||||
]
|
||||
|
@ -204,10 +204,7 @@ class DocType:
|
||||
"bom_no" : d.bom_no,
|
||||
"description" : d.description,
|
||||
"stock_uom" : d.stock_uom,
|
||||
"use_multi_level_bom": self.doc.use_multi_level_bom,
|
||||
"company" : self.doc.company,
|
||||
"posting_date" : nowdate(),
|
||||
"origin" : "MRP",
|
||||
"wip_warehouse" : "",
|
||||
"fg_warehouse" : "",
|
||||
"status" : "Draft",
|
||||
|
@ -2,14 +2,15 @@
|
||||
{
|
||||
"owner": "jai@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:03",
|
||||
"creation": "2012-12-11 15:15:06",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-10 18:30:00"
|
||||
"modified": "2012-12-11 16:13:59"
|
||||
},
|
||||
{
|
||||
"read_only": 1,
|
||||
"issingle": 1,
|
||||
"in_create": 1,
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"module": "Manufacturing",
|
||||
"name": "__common__"
|
||||
@ -39,7 +40,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Select Sales Orders from which you want to create Production Orders.",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Select Sales Orders",
|
||||
"fieldname": "select_sales_orders",
|
||||
@ -68,9 +68,9 @@
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"reqd": 1,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "Company"
|
||||
},
|
||||
{
|
||||
@ -99,7 +99,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Pull sales orders (pending to deliver) based on the above criteria",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Get Sales Orders",
|
||||
"fieldname": "get_sales_orders",
|
||||
@ -107,7 +106,6 @@
|
||||
"options": "get_open_sales_orders"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Production Plan Sales Orders",
|
||||
"fieldname": "pp_so_details",
|
||||
@ -115,17 +113,14 @@
|
||||
"options": "Production Plan Sales Order"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Clear Table",
|
||||
"trigger": "Client",
|
||||
"fieldname": "clear_so_table",
|
||||
"fieldtype": "Button",
|
||||
"options": "clear_so_table"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"label": "Create Production Orders",
|
||||
"fieldname": "create_production_orders",
|
||||
@ -133,7 +128,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Pull items from Sales Order mentioned in the above table.",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Get Items",
|
||||
"fieldname": "get_items_from_so",
|
||||
@ -141,7 +135,6 @@
|
||||
"options": "get_items_from_so"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Production Plan Items",
|
||||
"fieldname": "pp_details",
|
||||
@ -149,23 +142,20 @@
|
||||
"options": "Production Plan Item"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Clear Table",
|
||||
"trigger": "Client",
|
||||
"fieldname": "clear_item_table",
|
||||
"fieldtype": "Button",
|
||||
"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",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Use Multi-Level BOM",
|
||||
"reqd": 0,
|
||||
"fieldname": "use_multi_level_bom",
|
||||
"fieldtype": "Check"
|
||||
"fieldtype": "Check",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -181,7 +171,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Separate production order will be created for each finished good item.",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Raise Production Order",
|
||||
"fieldname": "raise_production_order",
|
||||
@ -196,10 +185,8 @@
|
||||
},
|
||||
{
|
||||
"description": "Download a report containing all raw materials with their latest inventory status",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Download Materials Required",
|
||||
"trigger": "Client",
|
||||
"fieldname": "download_materials_required",
|
||||
"fieldtype": "Button"
|
||||
},
|
||||
|
@ -30,6 +30,9 @@ def rename_module():
|
||||
|
||||
webnotes.conn.set_global("modules_list",
|
||||
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():
|
||||
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)
|
||||
}
|
||||
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)) \
|
||||
and 'Completed' or 'In Process'
|
||||
|
Loading…
Reference in New Issue
Block a user