Best Python code snippet using localstack_python
merge_land_unit_with_location.py
Source: merge_land_unit_with_location.py
...5from frappe.model.rename_doc import rename_doc6from frappe.model.utils.rename_field import rename_field7def execute():8 # Rename and reload the Land Unit and Linked Land Unit doctypes9 if frappe.db.table_exists('Land Unit') and not frappe.db.table_exists('Location'):10 rename_doc('DocType', 'Land Unit', 'Location', force=True)11 frappe.reload_doc('assets', 'doctype', 'location')12 if frappe.db.table_exists('Linked Land Unit') and not frappe.db.table_exists('Linked Location'):13 rename_doc('DocType', 'Linked Land Unit', 'Linked Location', force=True)14 frappe.reload_doc('assets', 'doctype', 'linked_location')15 if not frappe.db.table_exists('Crop Cycle'):16 frappe.reload_doc('agriculture', 'doctype', 'crop_cycle')17 # Rename the fields in related doctypes18 if 'linked_land_unit' in frappe.db.get_table_columns('Crop Cycle'):19 rename_field('Crop Cycle', 'linked_land_unit', 'linked_location')20 if 'land_unit' in frappe.db.get_table_columns('Linked Location'):21 rename_field('Linked Location', 'land_unit', 'location')22 if not frappe.db.exists("Location", "All Land Units"):23 frappe.get_doc({"doctype": "Location", "is_group": True, "location_name": "All Land Units"}).insert(ignore_permissions=True)24 if frappe.db.table_exists('Land Unit'):25 land_units = frappe.get_all('Land Unit', fields=['*'], order_by='lft')26 for land_unit in land_units:27 if not frappe.db.exists('Location', land_unit.get('land_unit_name')):28 frappe.get_doc({29 'doctype': 'Location',30 'location_name': land_unit.get('land_unit_name'),31 'parent_location': land_unit.get('parent_land_unit') or "All Land Units",32 'is_container': land_unit.get('is_container'),33 'is_group': land_unit.get('is_group'),34 'latitude': land_unit.get('latitude'),35 'longitude': land_unit.get('longitude'),36 'area': land_unit.get('area'),37 'location': land_unit.get('location'),38 'lft': land_unit.get('lft'),39 'rgt': land_unit.get('rgt')40 }).insert(ignore_permissions=True)41 # Delete the Land Unit and Linked Land Unit doctypes42 if frappe.db.table_exists('Land Unit'):43 frappe.delete_doc('DocType', 'Land Unit', force=1)44 if frappe.db.table_exists('Linked Land Unit'):...
rename_region_mater_regions.py
Source: rename_region_mater_regions.py
1import frappe2def execute():3 frappe.errprint("renaming regions master to Regions")4 if frappe.db.table_exists("tabRegion Master"):5 frappe.rename_doc("DocType", "Region Master", "Regions")6 if frappe.db.table_exists("tabZone Master"):7 frappe.rename_doc("DocType", "Zone Master", "Zones")8 if frappe.db.table_exists("tabGroup Church Master"):9 frappe.rename_doc("DocType", "Group Church Master", "Group Churches")10 if frappe.db.table_exists("tabChurch Master"):11 frappe.rename_doc("DocType", "Church Master", "Churches")12 if frappe.db.table_exists("tabPCF Master"):13 frappe.rename_doc("DocType", "PCF Master", "PCFs")14 if frappe.db.table_exists("tabSenior Cell Master"):15 frappe.rename_doc("DocType", "Senior Cell Master", "Senior Cells")16 if frappe.db.table_exists("tabCell Master"):17 frappe.rename_doc("DocType", "Cell Master", "Cells")18 if frappe.db.table_exists("tabFoundation School Exam Master"):19 frappe.rename_doc("DocType", "Foundation School Exam Master", "Foundation School Exams")20 if frappe.db.table_exists("tabFS Grade Master"):21 frappe.rename_doc("DocType", "FS Grade Master", "Foundation School Grades")22 if frappe.db.table_exists("tabPartnership Arm"):...
rename_masters.py
Source: rename_masters.py
1import frappe2def execute():3 frappe.errprint("renaming master")4 if frappe.db.table_exists("tabRegion Master"):5 frappe.rename_doc("DocType", "Region Master", "Regions")6 if frappe.db.table_exists("tabZone Master"):7 frappe.rename_doc("DocType", "Zone Master", "Zones")8 if frappe.db.table_exists("tabGroup Church Master"):9 frappe.rename_doc("DocType", "Group Church Master", "Group Churches")10 if frappe.db.table_exists("tabChurch Master"):11 frappe.rename_doc("DocType", "Church Master", "Churches")12 if frappe.db.table_exists("tabPCF Master"):13 frappe.rename_doc("DocType", "PCF Master", "PCFs")14 if frappe.db.table_exists("tabSenior Cell Master"):15 frappe.rename_doc("DocType", "Senior Cell Master", "Senior Cells")16 if frappe.db.table_exists("tabCell Master"):17 frappe.rename_doc("DocType", "Cell Master", "Cells")18 if frappe.db.table_exists("tabFoundation School Exam Master"):19 frappe.rename_doc("DocType", "Foundation School Exam Master", "Foundation School Exams")20 if frappe.db.table_exists("tabFS Grade Master"):21 frappe.rename_doc("DocType", "FS Grade Master", "Foundation School Grades")22 if frappe.db.table_exists("tabPartnership Arm"):...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!