Merge pull request #4420 from rmehta/stock-entry-fix
[minor] allow stock entry for manufacture without production order
This commit is contained in:
commit
acaef538c2
@ -148,11 +148,11 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
$.each(["from_bom", "bom_no", "fg_completed_qty", "use_multi_level_bom"], function(i, field) {
|
||||
me.frm.set_value(field, r.message[field]);
|
||||
})
|
||||
|
||||
|
||||
if (me.frm.doc.purpose == "Material Transfer for Manufacture" && !me.frm.doc.to_warehouse)
|
||||
me.frm.set_value("to_warehouse", r.message["wip_warehouse"]);
|
||||
|
||||
|
||||
|
||||
|
||||
if (me.frm.doc.purpose == "Manufacture") {
|
||||
if(r.message["additional_costs"].length) {
|
||||
$.each(r.message["additional_costs"], function(i, row) {
|
||||
@ -160,7 +160,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
})
|
||||
refresh_field("additional_costs");
|
||||
}
|
||||
|
||||
|
||||
if (!me.frm.doc.from_warehouse) me.frm.set_value("from_warehouse", r.message["wip_warehouse"]);
|
||||
if (!me.frm.doc.to_warehouse) me.frm.set_value("to_warehouse", r.message["fg_warehouse"]);
|
||||
}
|
||||
@ -171,7 +171,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
},
|
||||
|
||||
toggle_enable_bom: function() {
|
||||
this.frm.toggle_enable("bom_no", !in_list(["Manufacture", "Material Transfer for Manufacture"], this.frm.doc.purpose));
|
||||
this.frm.toggle_enable("bom_no", !!!this.frm.doc.production_order);
|
||||
},
|
||||
|
||||
add_excise_button: function() {
|
||||
@ -252,11 +252,11 @@ cur_frm.cscript.toggle_related_fields = function(doc) {
|
||||
if(doc.purpose == "Material Receipt") {
|
||||
cur_frm.set_value("from_bom", 0);
|
||||
}
|
||||
|
||||
|
||||
// Addition costs based on purpose
|
||||
cur_frm.toggle_display(["additional_costs", "total_additional_costs", "additional_costs_section"],
|
||||
cur_frm.toggle_display(["additional_costs", "total_additional_costs", "additional_costs_section"],
|
||||
doc.purpose!='Material Issue');
|
||||
|
||||
|
||||
cur_frm.fields_dict["items"].grid.set_column_disp("additional_cost", doc.purpose!='Material Issue');
|
||||
}
|
||||
|
||||
@ -405,4 +405,4 @@ cur_frm.cscript.company = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
|
||||
erpnext.get_fiscal_year(doc.company, doc.posting_date);
|
||||
}
|
||||
}
|
||||
|
@ -170,10 +170,8 @@ class StockEntry(StockController):
|
||||
def validate_production_order(self):
|
||||
if self.purpose in ("Manufacture", "Material Transfer for Manufacture"):
|
||||
# check if production order is entered
|
||||
if not self.production_order:
|
||||
frappe.throw(_("Production order number is mandatory for stock entry purpose manufacture"))
|
||||
# check for double entry
|
||||
if self.purpose=="Manufacture":
|
||||
|
||||
if self.purpose=="Manufacture" and self.production_order:
|
||||
if not self.fg_completed_qty:
|
||||
frappe.throw(_("For Quantity (Manufactured Qty) is mandatory"))
|
||||
self.check_if_operations_completed()
|
||||
|
Loading…
x
Reference in New Issue
Block a user