Merge pull request #8034 from mbauskar/hotfix
[minor] make item code mandatory if update_stock is selected
This commit is contained in:
commit
f494626ce4
@ -205,6 +205,7 @@ function hide_fields(doc) {
|
|||||||
|
|
||||||
cur_frm.cscript.update_stock = function(doc, dt, dn) {
|
cur_frm.cscript.update_stock = function(doc, dt, dn) {
|
||||||
hide_fields(doc, dt, dn);
|
hide_fields(doc, dt, dn);
|
||||||
|
this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
||||||
|
@ -156,6 +156,12 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
super(PurchaseInvoice, self).validate_warehouse()
|
super(PurchaseInvoice, self).validate_warehouse()
|
||||||
|
|
||||||
|
|
||||||
|
def validate_item_code(self):
|
||||||
|
for d in self.get('items'):
|
||||||
|
if not d.item_code:
|
||||||
|
frappe.msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
|
||||||
|
|
||||||
def set_expense_account(self, for_validate=False):
|
def set_expense_account(self, for_validate=False):
|
||||||
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
|
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
|
||||||
|
|
||||||
@ -164,6 +170,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
stock_items = self.get_stock_items()
|
stock_items = self.get_stock_items()
|
||||||
|
|
||||||
if self.update_stock:
|
if self.update_stock:
|
||||||
|
self.validate_item_code()
|
||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
warehouse_account = get_warehouse_account()
|
warehouse_account = get_warehouse_account()
|
||||||
|
|
||||||
|
@ -321,6 +321,7 @@ cur_frm.cscript.hide_fields = function(doc) {
|
|||||||
|
|
||||||
cur_frm.cscript.update_stock = function(doc, dt, dn) {
|
cur_frm.cscript.update_stock = function(doc, dt, dn) {
|
||||||
cur_frm.cscript.hide_fields(doc, dt, dn);
|
cur_frm.cscript.hide_fields(doc, dt, dn);
|
||||||
|
this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||||
|
@ -1047,5 +1047,4 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
return method
|
return method
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user