mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
hide display of from/to warehouse based on purpose
This commit is contained in:
@@ -28,7 +28,7 @@ erpnext.stock.StockEntry = erpnext.utils.Controller.extend({
|
|||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
this._super();
|
this._super();
|
||||||
this.toggle_related_fields(doc);
|
this.toggle_related_fields(this.frm.doc);
|
||||||
if (this.frm.doc.docstatus==1) this.frm.add_custom_button("Show Stock Ledger",
|
if (this.frm.doc.docstatus==1) this.frm.add_custom_button("Show Stock Ledger",
|
||||||
this.show_stock_ledger)
|
this.show_stock_ledger)
|
||||||
},
|
},
|
||||||
@@ -54,6 +54,15 @@ erpnext.stock.StockEntry = erpnext.utils.Controller.extend({
|
|||||||
cur_frm.cscript = new erpnext.stock.StockEntry({frm: cur_frm});
|
cur_frm.cscript = new erpnext.stock.StockEntry({frm: cur_frm});
|
||||||
|
|
||||||
cur_frm.cscript.toggle_related_fields = function(doc) {
|
cur_frm.cscript.toggle_related_fields = function(doc) {
|
||||||
|
disable_from_warehouse = inList(["Material Receipt", "Sales Return"], doc.purpose);
|
||||||
|
disable_to_warehouse = inList(["Material Issue", "Purchase Return"], doc.purpose)
|
||||||
|
|
||||||
|
cur_frm.toggle_enable("from_warehouse", !disable_from_warehouse);
|
||||||
|
cur_frm.toggle_enable("to_warehouse", !disable_to_warehouse);
|
||||||
|
|
||||||
|
cur_frm.fields_dict["mtn_details"].grid.set_column_disp("s_warehouse", !disable_from_warehouse);
|
||||||
|
cur_frm.fields_dict["mtn_details"].grid.set_column_disp("t_warehouse", !disable_to_warehouse);
|
||||||
|
|
||||||
if(doc.purpose == 'Purchase Return') {
|
if(doc.purpose == 'Purchase Return') {
|
||||||
doc.customer = doc.customer_name = doc.customer_address =
|
doc.customer = doc.customer_name = doc.customer_address =
|
||||||
doc.delivery_note_no = doc.sales_invoice_no = null;
|
doc.delivery_note_no = doc.sales_invoice_no = null;
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ class DocType(TransactionBase):
|
|||||||
if not (d.s_warehouse or d.t_warehouse):
|
if not (d.s_warehouse or d.t_warehouse):
|
||||||
msgprint(_("Atleast one warehouse is mandatory"), raise_exception=1)
|
msgprint(_("Atleast one warehouse is mandatory"), raise_exception=1)
|
||||||
|
|
||||||
if d.s_warehouse == d.t_warehouse:
|
|
||||||
msgprint(_("Source and Target Warehouse cannot be same"), raise_exception=1)
|
|
||||||
|
|
||||||
if self.doc.purpose in source_mandatory:
|
if self.doc.purpose in source_mandatory:
|
||||||
if not d.s_warehouse:
|
if not d.s_warehouse:
|
||||||
msgprint(_("Row # ") + "%s: " % cint(d.idx)
|
msgprint(_("Row # ") + "%s: " % cint(d.idx)
|
||||||
@@ -118,6 +115,11 @@ class DocType(TransactionBase):
|
|||||||
msgprint(_("Row # ") + "%s: " % cint(d.idx)
|
msgprint(_("Row # ") + "%s: " % cint(d.idx)
|
||||||
+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1)
|
+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1)
|
||||||
|
|
||||||
|
if d.s_warehouse == d.t_warehouse:
|
||||||
|
msgprint(_("Source and Target Warehouse cannot be same"), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def validate_production_order(self, pro_obj=None):
|
def validate_production_order(self, pro_obj=None):
|
||||||
if not pro_obj:
|
if not pro_obj:
|
||||||
if self.doc.production_order:
|
if self.doc.production_order:
|
||||||
|
|||||||
Reference in New Issue
Block a user