brotherton-erpnext/erpnext/patches/v12_0/update_ewaybill_field_position.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
600 B
Python
Raw Normal View History

import frappe
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
field = frappe.db.get_value("Custom Field", {"dt": "Sales Invoice", "fieldname": "ewaybill"})
2019-07-18 12:44:12 +00:00
if field:
ewaybill_field = frappe.get_doc("Custom Field", field)
2019-07-18 12:44:12 +00:00
ewaybill_field.flags.ignore_validate = True
2019-07-18 12:44:12 +00:00
ewaybill_field.update({
'fieldname': 'ewaybill',
'label': 'e-Way Bill No.',
'fieldtype': 'Data',
'depends_on': 'eval:(doc.docstatus === 1)',
'allow_on_submit': 1,
'insert_after': 'tax_id',
'translatable': 0
})
2019-07-18 12:44:12 +00:00
ewaybill_field.save()