fix: ewaybill mandatory conditions

This commit is contained in:
Saqib Ansari
2020-12-02 12:59:20 +05:30
parent 9760eb9d57
commit 57e6759088
3 changed files with 12 additions and 5 deletions

View File

@@ -678,4 +678,4 @@ erpnext.patches.v12_0.update_state_code_for_daman_and_diu
erpnext.patches.v12_0.rename_lost_reason_detail
erpnext.patches.v12_0.update_leave_application_status
erpnext.patches.v12_0.update_payment_entry_status
erpnext.patches.v12_0.setup_einvoice_fields #2020-11-04
erpnext.patches.v12_0.setup_einvoice_fields #2020-12-02

View File

@@ -31,6 +31,14 @@ def execute():
add_permissions()
add_print_formats()
frappe.db.set_value('Custom Field', { 'fieldname': 'mode_of_transport' }, 'default', '')
frappe.db.set_value('Custom Field', { 'fieldname': 'vehicle_no' }, 'depends_on', 'eval:doc.mode_of_transport == "Road"')
frappe.db.set_value('Custom Field', { 'fieldname': 'ewaybill' }, 'depends_on', 'eval:((doc.docstatus === 1 || doc.ewaybill) && doc.eway_bill_cancelled === 0)')
t = {
'mode_of_transport': [{'default': None}],
'ewaybill': [
{'depends_on': 'eval:((doc.docstatus === 1 || doc.ewaybill) && doc.eway_bill_cancelled === 0)'}
]
}
for field, conditions in t.items():
for c in conditions:
[(prop, value)] = c.items()
frappe.db.set_value('Custom Field', { 'fieldname': field }, prop, value)

View File

@@ -303,7 +303,6 @@ def make_custom_fields(update=True):
'label': 'Vehicle No',
'fieldtype': 'Data',
'insert_after': 'lr_no',
'depends_on': 'eval:(doc.mode_of_transport === "Road")',
'print_hide': 1,
'translatable': 0
},