brotherton-erpnext/erpnext/agriculture/setup.py

435 lines
11 KiB
Python
Raw Normal View History

[Agriculture Domain] (#11663) * created Soil Analysis, Water Analysis, Weather and Fertilizer doctype * soil doctype edited and crop doctype added * minor stuff * Land Unit + Leaflet * crop cycle added * Land Unit changes + Crop cycle * autoname for plant_analysis * created Agriculture Task * minor stuff * - deleted agriculture_task - current state after the call * [Agriculture] modified fertilizer doctype to have a link to Item This was done so that the `Fertilizer` doctype could track the contents exclusive to the fertilizer, whereas the `Fertilizer Item` could be a seperate entity, so as to leverage the existing ERPNext doctypes * Added fields to `Water Analysis` doctype - Collection Datetime - Laboratory Testing Datetime - Results Datetime (default to Laboratory Testing Datetime) * Edited the doctypes `Agrivulture Task`, `Pest` and `Soil Texture` - Created `agriculture task` doctype - added fields `Common Name`, `Scientific Name`, `Treatment` and `Treatment Options` to `Pest` doctype - edited `Soil Texture` doctype to contain a soil texture ternary plot diagram made using SnapSVG. The code was put in public folder so as to be accessible by the entire agriculture module * Recursively reflect child land unit feature changes on parents * fixed feature repition bug * added legeneds to ternary plot * added stuff * changes * fix Task * reverted the Task Doctype to have naming in the form TASK.##### * fixed modifications made to TASK doctype * [dirty commit] added auto create Task from Crop on creation of Crop Cycle * Changed the Crop Cycle Doctype - Deleted the "Crop Cycly Task" doctype and its link from "Crop Cycle" - Creation of a new Project with the same name as the Crop Cycle on creation of a new Crop Cycle - Creation of all the tasks imported from Agriculture Task doctype of the Crop in the Crop Cycle * [Agriculture Module] Modifications - Created childtable doctype "Pest Detected" - Added childtable "Pest Detected" to Pest - Modified "Agriculture Task" to include "Start Day" and "End Day" of task - Modified the code in "Crop Cycle" to create a parent task with same name as Crop Cycle * [Agriculture Module] fixed Pest doctype not saving issue * [Agrcilture Module] Changes in Crop Cycle - removed the creation of a master task on creation of a new crop cycle - temporary fix to add the pest tasks from the pests added in crop cycle * land_unit_tree.js fields modified to have field objects instead of just field names * Revert "land_unit_tree.js modified" * land_unit_tree.js fields modified to have field objects instead of just field names * [Agriculture Domain] Converted Agriculture Module to a Domain - Converted into a Domain field from Select to Link field in Company doctype, linked to Domain doctype - Agriculture (alpha) is now a Domain * land_unit area aggregation enabled * land_unit.py checks feature diff for every ancestor and not just the parent * Removed unnecessary print messages * agriculture.py modified to include fixtures * fixtures added to setup.py inside agriculture module * [Agriculture Domain] UI tests added - 'materials' table renamed to 'materials_required' in 'Crop' - wrote UI test for Crop, Fertilizer, Crop Cycle, Pest, Water Analysis, Soil Texture - moved creation of tasks from client side to server side in Crop Cycle - Plant Analysis, Water Analysis, Soil Analysis, Soil Texture docs are now autonamed in the format PAnalysis.#####, WAnalysis.#####, SAnalysis.#####, STexture.##### respectively - company_name changed in domains.py from 'Schrute Farms.' to 'Schrute Farms' * [Agriculture Domain] Mostly written server side tests and moved client side code to server side - moved client side code to server side for Crop, Water Analysis, Pest, Soil Texture, - wrote server side tests for Crop, Crop Cycle, Fertilizer, Soil Texture, Pest - NOTE: none of the server side codes were tested * [Agriculture Domain] All server side tests working locally * [Agriculture Domain] Testing - added sample test for Land Unit, which needs to be modified to test multiple things - modified tests to be independant of each other * Land Units tests added and area aggregation code migrated to server side * added land_unit server side tests and on_trash added to land_unit * Changing field location for start date * [Agriculture Domain] deleted unnecessary comments * [Agriculture Domain] reverted changes * [Agriculture Domain] Modified the code to replace Pest doctype with Land Unit doctype - Deleted the Pest doctype and replaced it with the more generic Disease doctype - Deleted the Detected Pest doctype and replaced it with Detected Disease doctype * [Agriculture Domain] resolves #11654, resolves #11653 * [Agriculture] Added links to soil analysis, soil texture, plant analysis in crop cycle and land unit - not working perfectly yet - docs are fetched but not appended * [Agricuture] Crop Cycle modifed to link with relevent analysis docs, not fully functional * [Agriculture] added seperate stage for client side agriculture tests * [Agriculture] minor modification to crop_cycle.js test * [Agriculture] fixed tests * upgrade chromedriver in .travis.yml from 2.32 to 2.33 * [Agriculture] added land unit ui test * [Agriculture] added Agriculture server side test as a seperate stage in travis * tesing travis.yml * [Agriculture] Crop Cycle is able to fetch linked analysis docs * Modified travis.yml for modular server side testing * [minor fix][Agriculture] in soil_texture - fixed multiple soil_texture ternary plot creation on refresh - fixed error on soil composition change * Update .travis.yml * removed location field from linked doctypes * minor fixes and cleanup of agri * minor fix in agriculture and domain patches * permissions added to agriculture - Agriculture Manager and Agriculture User roles were added to all Agriculture doctypes * [Agriculture] - Created Agiculture Analysis Criteria and added sample records to it - All the analysis doctypes now fetch their fields inside a child table, form Agriculture Analysis Criteria - Also Fertilizer does the same This was introduced so that, new parameters could be added on demand * minor changes requested in Agriculture * minor changes * minor fix * Update desktop.py * Update .travis.yml
2017-12-06 13:06:27 +00:00
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.setup.utils import insert_record
def setup_agriculture():
records = [
dict(
doctype="Land Unit",
land_unit_name="All Land Units",
is_group=1,
is_container=1),
dict(
doctype='Item Group',
item_group_name='Fertilizer',
is_group=0,
parent_item_group=_('All Item Groups')),
dict(
doctype='Item Group',
item_group_name='Seed',
is_group=0,
parent_item_group=_('All Item Groups')),
dict(
doctype='Item Group',
item_group_name='By-product',
is_group=0,
parent_item_group=_('All Item Groups')),
dict(
doctype='Item Group',
item_group_name='Produce',
is_group=0,
parent_item_group=_('All Item Groups')),
dict(
doctype='Agriculture Analysis Criteria',
title='Nitrogen Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Phosphorous Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Potassium Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Calcium Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Sulphur Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Magnesium Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Iron Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Copper Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Zinc Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Boron Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Manganese Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Chlorine Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Molybdenum Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Sodium Content',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Humic Acid',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Fulvic Acid',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Inert',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Others',
standard=1,
linked_doctype='Fertilizer'),
dict(
doctype='Agriculture Analysis Criteria',
title='Nitrogen',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Phosphorous',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Potassium',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Calcium',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Magnesium',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Sulphur',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Boron',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Copper',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Iron',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Manganese',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Zinc',
standard=1,
linked_doctype='Plant Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Depth (in cm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='pH',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Salt Concentration (%)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Organic Matter (%)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='CEC (Cation Exchange Capacity) (MAQ/100mL)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Potassium Saturation (%)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Calcium Saturation (%)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Manganese Saturation (%)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Nirtogen (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Phosphorous (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Potassium (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Calcium (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Magnesium (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Sulphur (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Copper (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Iron (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Manganese (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Zinc (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Aluminium (ppm)',
standard=1,
linked_doctype='Soil Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='pH',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Conductivity (mS/cm)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Hardness (mg/CaCO3)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Turbidity (NTU)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Odor',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Color',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Nitrate (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Nirtite (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Calcium (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Magnesium (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Sulphate (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Boron (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Copper (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Iron (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Manganese (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Zinc (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Chlorine (mg/L)',
standard=1,
linked_doctype='Water Analysis'),
dict(
doctype='Agriculture Analysis Criteria',
title='Bulk Density',
standard=1,
linked_doctype='Soil Texture'),
dict(
doctype='Agriculture Analysis Criteria',
title='Field Capacity',
standard=1,
linked_doctype='Soil Texture'),
dict(
doctype='Agriculture Analysis Criteria',
title='Wilting Point',
standard=1,
linked_doctype='Soil Texture'),
dict(
doctype='Agriculture Analysis Criteria',
title='Hydraulic Conductivity',
standard=1,
linked_doctype='Soil Texture'),
dict(
doctype='Agriculture Analysis Criteria',
title='Organic Matter',
standard=1,
linked_doctype='Soil Texture'),
dict(
doctype='Agriculture Analysis Criteria',
title='Temperature High',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Temperature Low',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Temperature Average',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Dew Point',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Precipitation Received',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Humidity',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Pressure',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Insolation/ PAR (Photosynthetically Active Radiation)',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Degree Days',
standard=1,
linked_doctype='Weather'),
dict(
doctype='Agriculture Analysis Criteria',
title='Degree Days',
standard=1,
linked_doctype='Water Analysis')
]
insert_record(records)