Merge branch 'hotfix'
This commit is contained in:
commit
0ff35a852a
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '10.1.53'
|
__version__ = '10.1.54'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -506,7 +506,7 @@ def save_invoice(doc, name, name_list):
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
name_list.append(name)
|
name_list.append(name)
|
||||||
except Exception:
|
except Exception:
|
||||||
frappe.log_error(frappe.get_traceback())
|
|
||||||
frappe.db.rollback()
|
frappe.db.rollback()
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
|
||||||
return name_list
|
return name_list
|
||||||
|
@ -16,16 +16,23 @@ class BOMUpdateTool(Document):
|
|||||||
self.update_new_bom()
|
self.update_new_bom()
|
||||||
bom_list = self.get_parent_boms(self.new_bom)
|
bom_list = self.get_parent_boms(self.new_bom)
|
||||||
updated_bom = []
|
updated_bom = []
|
||||||
|
|
||||||
for bom in bom_list:
|
for bom in bom_list:
|
||||||
bom_obj = frappe.get_doc("BOM", bom)
|
try:
|
||||||
bom_obj.get_doc_before_save()
|
bom_obj = frappe.get_doc("BOM", bom)
|
||||||
updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
|
bom_obj.get_doc_before_save()
|
||||||
bom_obj.calculate_cost()
|
updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
|
||||||
bom_obj.update_parent_cost()
|
bom_obj.calculate_cost()
|
||||||
bom_obj.db_update()
|
bom_obj.update_parent_cost()
|
||||||
if (getattr(bom_obj.meta, 'track_changes', False)
|
bom_obj.db_update()
|
||||||
and bom_obj._doc_before_save and not bom_obj.flags.ignore_version):
|
if (getattr(bom_obj.meta, 'track_changes', False)
|
||||||
bom_obj.save_version()
|
and bom_obj._doc_before_save and not bom_obj.flags.ignore_version):
|
||||||
|
bom_obj.save_version()
|
||||||
|
|
||||||
|
frappe.db.commit()
|
||||||
|
except Exception:
|
||||||
|
frappe.db.rollback()
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
|
||||||
def validate_bom(self):
|
def validate_bom(self):
|
||||||
if cstr(self.current_bom) == cstr(self.new_bom):
|
if cstr(self.current_bom) == cstr(self.new_bom):
|
||||||
|
@ -138,10 +138,15 @@ erpnext.setup.slides_settings = [
|
|||||||
|
|
||||||
validate: function () {
|
validate: function () {
|
||||||
// validate fiscal year start and end dates
|
// validate fiscal year start and end dates
|
||||||
if (this.values.fy_start_date == 'Invalid date' || this.values.fy_end_date == 'Invalid date') {
|
const invalid = this.values.fy_start_date == 'Invalid date' ||
|
||||||
|
this.values.fy_end_date == 'Invalid date';
|
||||||
|
const start_greater_than_end = this.values.fy_start_date > this.values.fy_end_date;
|
||||||
|
|
||||||
|
if (invalid || start_greater_than_end) {
|
||||||
frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
|
frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -187,13 +187,14 @@ def process_serial_no(sle):
|
|||||||
update_serial_nos(sle, item_det)
|
update_serial_nos(sle, item_det)
|
||||||
|
|
||||||
def validate_serial_no(sle, item_det):
|
def validate_serial_no(sle, item_det):
|
||||||
|
serial_nos = get_serial_nos(sle.serial_no) if sle.serial_no else []
|
||||||
|
|
||||||
if item_det.has_serial_no==0:
|
if item_det.has_serial_no==0:
|
||||||
if sle.serial_no:
|
if serial_nos:
|
||||||
frappe.throw(_("Item {0} is not setup for Serial Nos. Column must be blank").format(sle.item_code),
|
frappe.throw(_("Item {0} is not setup for Serial Nos. Column must be blank").format(sle.item_code),
|
||||||
SerialNoNotRequiredError)
|
SerialNoNotRequiredError)
|
||||||
elif sle.is_cancelled == "No":
|
elif sle.is_cancelled == "No":
|
||||||
if sle.serial_no:
|
if serial_nos:
|
||||||
serial_nos = get_serial_nos(sle.serial_no)
|
|
||||||
if cint(sle.actual_qty) != flt(sle.actual_qty):
|
if cint(sle.actual_qty) != flt(sle.actual_qty):
|
||||||
frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
|
frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
|
||||||
|
|
||||||
@ -239,6 +240,12 @@ def validate_serial_no(sle, item_det):
|
|||||||
elif sle.actual_qty < 0 or not item_det.serial_no_series:
|
elif sle.actual_qty < 0 or not item_det.serial_no_series:
|
||||||
frappe.throw(_("Serial Nos Required for Serialized Item {0}").format(sle.item_code),
|
frappe.throw(_("Serial Nos Required for Serialized Item {0}").format(sle.item_code),
|
||||||
SerialNoRequiredError)
|
SerialNoRequiredError)
|
||||||
|
elif serial_nos:
|
||||||
|
for serial_no in serial_nos:
|
||||||
|
sr = frappe.db.get_value("Serial No", serial_no, ["name", "warehouse"], as_dict=1)
|
||||||
|
if sr and sle.actual_qty < 0 and sr.warehouse != sle.warehouse:
|
||||||
|
frappe.throw(_("Cannot cancel {0} {1} because Serial No {2} does not belong to the warehouse {3}")
|
||||||
|
.format(sle.voucher_type, sle.voucher_no, serial_no, sle.warehouse))
|
||||||
|
|
||||||
def has_duplicate_serial_no(sn, sle):
|
def has_duplicate_serial_no(sn, sle):
|
||||||
if sn.warehouse:
|
if sn.warehouse:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user