Production plan cleanup and fixes
This commit is contained in:
parent
375ba8ef0a
commit
6aa80071e5
@ -192,7 +192,7 @@ class DocType:
|
||||
|
||||
# check total debit / credit
|
||||
# Due to old wrong entries (total debit != total credit) some voucher could be cancelled
|
||||
if abs(self.td - self.tc) > 0.01 and not cancel:
|
||||
if abs(self.td - self.tc) > 0.004 and not cancel:
|
||||
msgprint("Debit and Credit not equal for this voucher: Diff (Debit) is %s" % (self.td-self.tc))
|
||||
raise Exception
|
||||
|
||||
|
@ -1,159 +1,109 @@
|
||||
# DocType, Production Plan Item
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:03',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:03',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': u'PPID/.#####',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': u'Production',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 27
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Production Plan Item',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# DocType, Production Plan Item
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Production Plan Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sales_order',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Sales Order',
|
||||
'oldfieldname': u'source_docname',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item_code',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Item Code',
|
||||
'oldfieldname': u'item_code',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': u'Client',
|
||||
'width': u'150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'bom_no',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'BOM No',
|
||||
'oldfieldname': u'bom_no',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'BOM',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': u'100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'0.00',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'so_pending_qty',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'SO Pending Qty',
|
||||
'oldfieldname': u'prevdoc_reqd_qty',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'width': u'100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'0.00',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'planned_qty',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Planned Qty',
|
||||
'oldfieldname': u'planned_qty',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': u'100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'stock_uom',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'UOM',
|
||||
'oldfieldname': u'stock_uom',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'width': u'80px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'description',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Description',
|
||||
'oldfieldname': u'description',
|
||||
'oldfieldtype': u'Text',
|
||||
'permlevel': 1,
|
||||
'width': u'200px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'parent_packing_item',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Parent Packing Item',
|
||||
'oldfieldname': u'parent_item',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Item',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'is_pro_created',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Is PRO Created',
|
||||
'oldfieldname': u'pro_created',
|
||||
'oldfieldtype': u'Check',
|
||||
'permlevel': 1
|
||||
}
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:04",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-11-29 19:02:38"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"autoname": "PPID/.#####",
|
||||
"name": "__common__",
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"module": "Production"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Plan Item",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "Production Plan Item",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"width": "150px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "Item"
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "BOM No",
|
||||
"oldfieldname": "bom_no",
|
||||
"width": "100px",
|
||||
"options": "BOM",
|
||||
"fieldname": "bom_no",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Planned Qty",
|
||||
"oldfieldname": "planned_qty",
|
||||
"width": "100px",
|
||||
"fieldname": "planned_qty",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "Sales Order",
|
||||
"oldfieldname": "source_docname",
|
||||
"options": "Sales Order",
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "SO Pending Qty",
|
||||
"oldfieldname": "prevdoc_reqd_qty",
|
||||
"width": "100px",
|
||||
"fieldname": "so_pending_qty",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"width": "80px",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Text",
|
||||
"doctype": "DocField",
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"width": "200px",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"permlevel": 1
|
||||
}
|
||||
]
|
@ -1,124 +1,84 @@
|
||||
# DocType, Production Plan Sales Order
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:04',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': u'PP/.SO/.#####',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': u'Production',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Production Plan Sales Order',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Production Plan Sales Order',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1,
|
||||
'role': u'System Manager'
|
||||
},
|
||||
|
||||
# DocType, Production Plan Sales Order
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Production Plan Sales Order'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sales_order',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Sales Order',
|
||||
'oldfieldname': u'prevdoc_docname',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Sales Order',
|
||||
'permlevel': 0,
|
||||
'width': u'150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sales_order_date',
|
||||
'fieldtype': u'Date',
|
||||
'label': u'Sales Order Date',
|
||||
'oldfieldname': u'document_date',
|
||||
'oldfieldtype': u'Date',
|
||||
'permlevel': 1,
|
||||
'width': u'100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'customer',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Customer',
|
||||
'options': u'Customer',
|
||||
'permlevel': 1,
|
||||
'width': u'150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'grand_total',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Grand Total',
|
||||
'permlevel': 1,
|
||||
'width': u'100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'include_in_plan',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Include In Plan',
|
||||
'oldfieldname': u'include_in_plan',
|
||||
'oldfieldtype': u'Check',
|
||||
'permlevel': 0,
|
||||
'width': u'100px'
|
||||
}
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:04",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-11-29 17:49:15"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"autoname": "PP/.SO/.#####",
|
||||
"name": "__common__",
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"module": "Production"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Plan Sales Order",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Plan Sales Order",
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"parenttype": "DocType",
|
||||
"role": "System Manager",
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "Production Plan Sales Order",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "Sales Order",
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
"width": "150px",
|
||||
"options": "Sales Order",
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Date",
|
||||
"doctype": "DocField",
|
||||
"label": "SO Date",
|
||||
"oldfieldname": "document_date",
|
||||
"width": "120px",
|
||||
"fieldname": "sales_order_date",
|
||||
"fieldtype": "Date",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Customer",
|
||||
"width": "150px",
|
||||
"options": "Customer",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Grand Total",
|
||||
"width": "120px",
|
||||
"fieldname": "grand_total",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"write": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1
|
||||
}
|
||||
]
|
@ -14,11 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
get_server_fields('get_item_details', d.item_code, 'pp_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
doc.company = sys_defaults.company;
|
||||
refresh_field("company");
|
||||
}
|
||||
|
||||
cur_frm.cscript.sales_order = function(doc,cdt,cdn) {
|
||||
@ -28,25 +26,35 @@ cur_frm.cscript.sales_order = function(doc,cdt,cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.download_raw_material = function(doc, cdt, cdn) {
|
||||
var callback = function(r, rt){
|
||||
if (r.message)
|
||||
$c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
get_server_fields('get_item_details', d.item_code, 'pp_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
$c_obj(make_doclist(cdt, cdn), 'validate_data', '', callback)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
//
|
||||
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(cdt, cdn), 'validate_data', '', function(r, rt) {
|
||||
if (!r['exc'])
|
||||
$c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`,`tabItem`.`item_name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life`="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_pro_applicable = "Yes" AND tabItem.%(key)s like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
return 'SELECT DISTINCT `tabItem`.`name`,`tabItem`.`item_name` \
|
||||
FROM `tabItem` WHERE `tabItem`.is_pro_applicable = "Yes" \
|
||||
AND (IFNULL(`tabItem`.`end_of_life`,"") = "" \
|
||||
OR `tabItem`.`end_of_life`="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) \
|
||||
AND tabItem.%(key)s like "%s" \
|
||||
ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = "Yes" AND `tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" ORDER BY `tabBOM`.`name` LIMIT 50';
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return 'SELECT DISTINCT `tabBOM`.`name` \
|
||||
FROM `tabBOM` WHERE `tabBOM`.`item` = "' + d.item_code +
|
||||
'" AND `tabBOM`.`is_active` = "Yes" AND `tabBOM`.docstatus = 1 \
|
||||
AND `tabBOM`.`name` like "%s" ORDER BY `tabBOM`.`name` LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
|
@ -32,142 +32,129 @@ class DocType:
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.item_dict = {}
|
||||
|
||||
|
||||
def get_so_details(self, so):
|
||||
"""Pull other details from so"""
|
||||
so = sql("""select transaction_date, customer, grand_total
|
||||
from `tabSales Order` where name = %s""", so, as_dict = 1)
|
||||
ret = {
|
||||
'sales_order_date': so and so[0]['transaction_date'] or '',
|
||||
'customer' : so[0]['customer'] or '',
|
||||
'grand_total': so[0]['grand_total']
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_item_details(self, item_code):
|
||||
""" Pull other item details from item master"""
|
||||
|
||||
item = sql("""select description, stock_uom, default_bom from `tabItem` where name = %s
|
||||
and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())""", item_code, as_dict =1 )
|
||||
item = sql("""select description, stock_uom, default_bom
|
||||
from `tabItem` where name = %s""", item_code, as_dict =1)
|
||||
ret = {
|
||||
'description' : item and item[0]['description'],
|
||||
'stock_uom' : item and item[0]['stock_uom'],
|
||||
'bom_no' : item and item[0]['default_bom']
|
||||
}
|
||||
return ret
|
||||
|
||||
|
||||
def get_so_details(self, so):
|
||||
"""Pull other details from so"""
|
||||
so = sql("select transaction_date, customer, grand_total from `tabSales Order` where name = %s", so, as_dict = 1)
|
||||
ret = {
|
||||
'sales_order_date': so and so[0]['transaction_date'] or '',
|
||||
'customer' : so[0]['customer'] or '',
|
||||
'grand_total': so[0]['grand_total']
|
||||
}
|
||||
return ret
|
||||
|
||||
|
||||
def clear_so_table(self):
|
||||
""" Clears sales order table"""
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'pp_so_details')
|
||||
|
||||
|
||||
|
||||
def clear_item_table(self):
|
||||
""" Clears item table"""
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'pp_details')
|
||||
|
||||
|
||||
|
||||
def get_open_sales_orders(self):
|
||||
""" Pull sales orders which are pending to deliver based on criteria selected"""
|
||||
cond = self.get_filter_condition()
|
||||
open_so = sql("""
|
||||
select
|
||||
distinct t1.name, t1.transaction_date, t1.customer, t1.grand_total
|
||||
from
|
||||
`tabSales Order` t1, `tabSales Order Item` t2, `tabDelivery Note Packing Item` t3, tabItem t4
|
||||
where
|
||||
t1.name = t2.parent and t1.name = t3.parent and t3.parenttype = 'Sales Order' and t1.docstatus = 1 and t2.item_code = t3.parent_item
|
||||
and t4.name = t3.item_code and t1.status != 'Stopped' and t1.company = '%s' and ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0)
|
||||
and (ifnull(t4.is_pro_applicable, 'No') = 'Yes' or ifnull(t4.is_sub_contracted_item, 'No') = 'Yes') %s
|
||||
order by t1.name desc
|
||||
"""% (self.doc.company, cond), as_dict = 1)
|
||||
|
||||
self.add_so_in_table(open_so)
|
||||
|
||||
|
||||
|
||||
def validate_company(self):
|
||||
if not self.doc.company:
|
||||
msgprint("Please enter Company", raise_exception=1)
|
||||
|
||||
|
||||
|
||||
def get_filter_condition(self):
|
||||
self.validate_company()
|
||||
|
||||
cond = ''
|
||||
def get_open_sales_orders(self):
|
||||
""" Pull sales orders which are pending to deliver based on criteria selected"""
|
||||
so_filter = item_filter = ""
|
||||
if self.doc.from_date:
|
||||
cond += ' and t1.transaction_date >= "' + self.doc.from_date + '"'
|
||||
so_filter += ' and so.transaction_date >= "' + self.doc.from_date + '"'
|
||||
if self.doc.to_date:
|
||||
cond += ' and t1.transaction_date <= "' + self.doc.to_date + '"'
|
||||
so_filter += ' and so.transaction_date <= "' + self.doc.to_date + '"'
|
||||
if self.doc.customer:
|
||||
cond += ' and t1.customer = "' + self.doc.customer + '"'
|
||||
so_filter += ' and so.customer = "' + self.doc.customer + '"'
|
||||
|
||||
if self.doc.fg_item:
|
||||
cond += ' and t3.item_code = "' + self.doc.fg_item + '"'
|
||||
|
||||
return cond
|
||||
|
||||
|
||||
item_filter += ' and item.name = "' + self.doc.fg_item + '"'
|
||||
|
||||
open_so = sql("""
|
||||
select distinct so.name, so.transaction_date, so.customer, so.grand_total
|
||||
from `tabSales Order` so, `tabSales Order Item` so_item
|
||||
where so_item.parent = so.name
|
||||
and so.docstatus = 1 and so.status != "Stopped"
|
||||
and so.company = 'Web Notes Technologies Pvt Ltd'
|
||||
and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0) %s
|
||||
and (exists (select * from `tabItem` item where item.name=so_item.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes') %s)
|
||||
or exists (select * from `tabDelivery Note Packing Item` dnpi
|
||||
where dnpi.parent = so.name and dnpi.parent_item = so_item.item_code
|
||||
and exists (select * from `tabItem` item where item.name=dnpi.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes') %s)))
|
||||
""" % (so_filter, item_filter, item_filter), as_dict=1)
|
||||
|
||||
self.add_so_in_table(open_so)
|
||||
|
||||
def add_so_in_table(self, open_so):
|
||||
""" Add sales orders in the table"""
|
||||
so_list = []
|
||||
for d in getlist(self.doclist, 'pp_so_details'):
|
||||
so_list.append(d.sales_order)
|
||||
so_list = [d.sales_order for d in getlist(self.doclist, 'pp_so_details')]
|
||||
for r in open_so:
|
||||
if cstr(r['name']) not in so_list:
|
||||
pp_so = addchild(self.doc, 'pp_so_details', 'Production Plan Sales Order', 1, self.doclist)
|
||||
pp_so = addchild(self.doc, 'pp_so_details',
|
||||
'Production Plan Sales Order', 1, self.doclist)
|
||||
pp_so.sales_order = r['name']
|
||||
pp_so.sales_order_date = cstr(r['transaction_date'])
|
||||
pp_so.customer = cstr(r['customer'])
|
||||
pp_so.grand_total = flt(r['grand_total'])
|
||||
|
||||
|
||||
|
||||
def get_items_from_so(self):
|
||||
""" Pull items from Sales Order, only proction item
|
||||
and subcontracted item will be pulled from Packing item
|
||||
and add items in the table
|
||||
"""
|
||||
so = self.get_included_so()
|
||||
items = self.get_packing_items(so)
|
||||
items = self.get_items()
|
||||
self.add_items(items)
|
||||
|
||||
def get_items(self):
|
||||
so_list = filter(None, [d.sales_order for d in getlist(self.doclist, 'pp_so_details')])
|
||||
if not so_list:
|
||||
msgprint("Please enter sales order in the above table", raise_exception=1)
|
||||
|
||||
items = sql("""select distinct parent, item_code,
|
||||
(qty - ifnull(delivered_qty, 0)) as pending_qty
|
||||
from `tabSales Order Item` so_item
|
||||
where parent in (%s) and docstatus = 1 and ifnull(qty, 0) > ifnull(delivered_qty, 0)
|
||||
and exists (select * from `tabItem` item where item.name=so_item.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes'))""" % \
|
||||
(", ".join(["%s"] * len(so_list))), tuple(so_list), as_dict=1)
|
||||
|
||||
dnpi_items = sql("""select distinct dnpi.parent, dnpi.item_code,
|
||||
(((so_item.qty - ifnull(so_item.delivered_qty, 0)) * dnpi.qty) / so_item.qty)
|
||||
as pending_qty
|
||||
from `tabSales Order Item` so_item, `tabDelivery Note Packing Item` dnpi
|
||||
where so_item.parent = dnpi.parent and so_item.docstatus = 1
|
||||
and dnpi.parent_item = so_item.item_code
|
||||
and so_item.parent in (%s) and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0)
|
||||
and exists (select * from `tabItem` item where item.name=dnpi.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes'))""" % \
|
||||
(", ".join(["%s"] * len(so_list))), tuple(so_list), as_dict=1)
|
||||
|
||||
def get_included_so(self):
|
||||
so = "'" + "','".join([cstr(d.sales_order) for d in getlist(self.doclist, 'pp_so_details') if d.include_in_plan]) + "'"
|
||||
return so
|
||||
|
||||
|
||||
|
||||
def get_packing_items(self, so):
|
||||
packing_items = sql("""
|
||||
select
|
||||
t0.name, t2.parent_item, t2.item_code,
|
||||
(t1.qty - ifnull(t1.delivered_qty,0)) * (ifnull(t2.qty,0) / ifnull(t1.qty,1)) as 'pending_qty'
|
||||
from
|
||||
`tabSales Order` t0, `tabSales Order Item` t1, `tabDelivery Note Packing Item` t2, `tabItem` t3
|
||||
where
|
||||
t0.name = t1.parent and t0.name = t2.parent and t1.name = t2.parent_detail_docname
|
||||
and t0.name in (%s) and t0.docstatus = 1 and t1.qty > ifnull(t1.delivered_qty,0) and t3.name = t2.item_code
|
||||
and (ifnull(t3.is_pro_applicable, 'No') = 'Yes' or ifnull(t3.is_sub_contracted_item, 'No') = 'Yes')
|
||||
""" % so, as_dict=1)
|
||||
return packing_items
|
||||
return items + dnpi_items
|
||||
|
||||
|
||||
def add_items(self, items):
|
||||
self.clear_item_table()
|
||||
|
||||
def add_items(self, packing_items):
|
||||
for d in getlist(self.doclist, 'pp_details'):
|
||||
if d.sales_order:
|
||||
d.parent = ''
|
||||
|
||||
for p in packing_items:
|
||||
item_details = sql("select description, stock_uom, default_bom from tabItem where name=%s", p['item_code'])
|
||||
for p in items:
|
||||
item_details = sql("""select description, stock_uom, default_bom
|
||||
from tabItem where name=%s""", p['item_code'])
|
||||
pi = addchild(self.doc, 'pp_details', 'Production Plan Item', 1, self.doclist)
|
||||
pi.sales_order = p['name']
|
||||
pi.parent_packing_item = p['parent_item']
|
||||
pi.sales_order = p['parent']
|
||||
pi.item_code = p['item_code']
|
||||
pi.description = item_details and item_details[0][0] or ''
|
||||
pi.stock_uom = item_details and item_details[0][1] or ''
|
||||
@ -176,16 +163,12 @@ class DocType:
|
||||
pi.planned_qty = flt(p['pending_qty'])
|
||||
|
||||
|
||||
|
||||
def validate_data(self):
|
||||
for d in getlist(self.doclist, 'pp_details'):
|
||||
if not d.pro_created:
|
||||
self.validate_bom_no(d)
|
||||
|
||||
if not flt(d.planned_qty):
|
||||
msgprint("Please Enter Planned Qty for item: %s at row no: %s"% (d.item_code, d.idx), raise_exception=1)
|
||||
return 'validated'
|
||||
|
||||
self.validate_bom_no(d)
|
||||
if not flt(d.planned_qty):
|
||||
msgprint("Please Enter Planned Qty for item: %s at row no: %s" %
|
||||
(d.item_code, d.idx), raise_exception=1)
|
||||
|
||||
|
||||
def validate_bom_no(self, d):
|
||||
@ -206,13 +189,10 @@ class DocType:
|
||||
self.get_raw_materials(bom_dict)
|
||||
return self.get_csv()
|
||||
|
||||
|
||||
|
||||
|
||||
def get_raw_materials(self, bom_dict):
|
||||
""" Get raw materials considering sub-assembly items """
|
||||
for bom in bom_dict:
|
||||
if self.doc.consider_sa_items == 'Yes':
|
||||
if self.doc.use_multi_level_bom == 'No':
|
||||
# Get all raw materials considering SA items as raw materials,
|
||||
# so no childs of SA items
|
||||
fl_bom_items = sql("""
|
||||
@ -260,8 +240,6 @@ class DocType:
|
||||
|
||||
return item_list
|
||||
|
||||
|
||||
|
||||
def raise_production_order(self):
|
||||
"""It will raise production order (Draft) for all distinct FG items"""
|
||||
self.validate_company()
|
||||
@ -274,8 +252,7 @@ class DocType:
|
||||
d.is_pro_created = 1
|
||||
msgprint("Following Production Order has been generated:\n" + '\n'.join(pro))
|
||||
else :
|
||||
msgprint("No Production Order is generated.")
|
||||
|
||||
msgprint("No Production Order generated.")
|
||||
|
||||
|
||||
def get_distinct_bom(self, action):
|
||||
@ -298,7 +275,7 @@ class DocType:
|
||||
'bom_no' : item_dict[d][1],
|
||||
'description' : item_dict[d][2],
|
||||
'stock_uom' : item_dict[d][3],
|
||||
'consider_sa_items' : self.doc.consider_sa_items
|
||||
'consider_sa_items' : self.doc.use_multi_level_bom == "Yes" and "No" or "Yes"
|
||||
})
|
||||
|
||||
return action == 'download_rm' and bom_dict or pp_items
|
||||
return action == 'download_rm' and bom_dict or pp_items
|
@ -1,318 +1,220 @@
|
||||
# DocType, Production Planning Tool
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:05',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:05',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'jai@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1326188323',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'in_create': 1,
|
||||
'issingle': 1,
|
||||
'module': u'Production',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': u'Tabbed',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 1,
|
||||
'version': 106
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Production Planning Tool',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Production Planning Tool',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Production Planning Tool
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Production Planning Tool'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Production User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Production Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'select_sales_orders',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Select Sales Orders'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break0',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'from_date',
|
||||
'fieldtype': u'Date',
|
||||
'label': u'From Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'to_date',
|
||||
'fieldtype': u'Date',
|
||||
'label': u'To Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'fg_item',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'FG Item',
|
||||
'options': u'Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break1',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'customer',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Customer',
|
||||
'options': u'Customer'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Company',
|
||||
'options': u'Company',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'section_break0',
|
||||
'fieldtype': u'Section Break',
|
||||
'options': u'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break2',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'get_sales_orders',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Get Sales Orders',
|
||||
'options': u'get_open_sales_orders'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break3',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'clear_so_table',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Clear SO Table',
|
||||
'options': u'clear_so_table',
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'section_break1',
|
||||
'fieldtype': u'Section Break',
|
||||
'options': u'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Select Sales Orders from which you want to create Production Orders. You can get sales orders based on above criteria.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'pp_so_details',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Production Plan Sales Orders',
|
||||
'options': u'Production Plan Sales Order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'items',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Items'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'get_items_from_so',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Get Items from SO',
|
||||
'options': u'get_items_from_so'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break4',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'clear_item_table',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Clear Item Table',
|
||||
'options': u'clear_item_table',
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'section_break2',
|
||||
'fieldtype': u'Section Break',
|
||||
'options': u'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Enter items and planned qty for which you want to raise production orders or download raw materials for analysis. You can pull items (which are pending to deliver) from SO as well by adding SO in plan.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'pp_details',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Production Plan Items',
|
||||
'options': u'Production Plan Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'default': u'No',
|
||||
'description': u'Select "Yes" if stock is maintained and tracked for sub assembly items.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'consider_sa_items',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Consider Sub Assemblies as Raw Material',
|
||||
'options': u'No\nYes',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'section_break3',
|
||||
'fieldtype': u'Section Break',
|
||||
'options': u'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break5',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'raise_production_order',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Raise Production Order',
|
||||
'options': u'raise_production_order'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break6',
|
||||
'fieldtype': u'Column Break',
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'download_raw_material',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Download Raw Material',
|
||||
'trigger': u'Client'
|
||||
}
|
||||
{
|
||||
"owner": "jai@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:03",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-11-29 17:52:20"
|
||||
},
|
||||
{
|
||||
"read_only": 1,
|
||||
"issingle": 1,
|
||||
"in_create": 1,
|
||||
"default_print_format": "Standard",
|
||||
"doctype": "DocType",
|
||||
"module": "Production",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Planning Tool",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Production Planning Tool",
|
||||
"read": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "Production Planning Tool",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Filter based on item",
|
||||
"fieldname": "fg_item",
|
||||
"fieldtype": "Link",
|
||||
"options": "Item"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Filter based on customer",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"reqd": 1,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"options": "Company"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "From Date",
|
||||
"fieldname": "from_date",
|
||||
"fieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "To Date",
|
||||
"fieldname": "to_date",
|
||||
"fieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break1",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "Simple"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"fieldtype": "Button",
|
||||
"options": "get_open_sales_orders"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Production Plan Sales Orders",
|
||||
"fieldname": "pp_so_details",
|
||||
"fieldtype": "Table",
|
||||
"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",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "Pull items from Sales Order mentioned in the above table.",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Get Items",
|
||||
"fieldname": "get_items_from_so",
|
||||
"fieldtype": "Button",
|
||||
"options": "get_items_from_so"
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Production Plan Items",
|
||||
"fieldname": "pp_details",
|
||||
"fieldtype": "Table",
|
||||
"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 selected as \"No\", all sub-assembly items will be treated as a raw material. Otherwise, BOM for sub-assembly items will be considered for raw materials.",
|
||||
"default": "Yes",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Use multi-level BOM",
|
||||
"reqd": 1,
|
||||
"fieldname": "use_multi_level_bom",
|
||||
"fieldtype": "Select",
|
||||
"options": "No\nYes"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break3",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "Simple"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break5",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"fieldtype": "Button",
|
||||
"options": "raise_production_order"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break6",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"role": "System Manager",
|
||||
"doctype": "DocPerm"
|
||||
},
|
||||
{
|
||||
"role": "Production User",
|
||||
"doctype": "DocPerm"
|
||||
},
|
||||
{
|
||||
"role": "Production Manager",
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user