Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
| 2 | import frappe |
| 3 | from frappe import _ |
| 4 | from erpnext.setup.utils import insert_record |
| 5 | |
| 6 | def setup_agriculture(): |
Zarrar | 0acf687 | 2017-12-18 14:01:07 +0530 | [diff] [blame] | 7 | if frappe.get_all('Agriculture Analysis Criteria'): |
Ameya Shenoy | cc05c0b | 2017-12-13 18:50:39 +0530 | [diff] [blame] | 8 | # already setup |
| 9 | return |
| 10 | create_agriculture_data() |
| 11 | |
| 12 | def create_agriculture_data(): |
Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 13 | records = [ |
| 14 | dict( |
Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 15 | doctype='Item Group', |
| 16 | item_group_name='Fertilizer', |
| 17 | is_group=0, |
| 18 | parent_item_group=_('All Item Groups')), |
| 19 | dict( |
| 20 | doctype='Item Group', |
| 21 | item_group_name='Seed', |
| 22 | is_group=0, |
| 23 | parent_item_group=_('All Item Groups')), |
| 24 | dict( |
| 25 | doctype='Item Group', |
| 26 | item_group_name='By-product', |
| 27 | is_group=0, |
| 28 | parent_item_group=_('All Item Groups')), |
| 29 | dict( |
| 30 | doctype='Item Group', |
| 31 | item_group_name='Produce', |
| 32 | is_group=0, |
| 33 | parent_item_group=_('All Item Groups')), |
| 34 | dict( |
| 35 | doctype='Agriculture Analysis Criteria', |
| 36 | title='Nitrogen Content', |
| 37 | standard=1, |
| 38 | linked_doctype='Fertilizer'), |
| 39 | dict( |
| 40 | doctype='Agriculture Analysis Criteria', |
| 41 | title='Phosphorous Content', |
| 42 | standard=1, |
| 43 | linked_doctype='Fertilizer'), |
| 44 | dict( |
| 45 | doctype='Agriculture Analysis Criteria', |
| 46 | title='Potassium Content', |
| 47 | standard=1, |
| 48 | linked_doctype='Fertilizer'), |
| 49 | dict( |
| 50 | doctype='Agriculture Analysis Criteria', |
| 51 | title='Calcium Content', |
| 52 | standard=1, |
| 53 | linked_doctype='Fertilizer'), |
| 54 | dict( |
| 55 | doctype='Agriculture Analysis Criteria', |
| 56 | title='Sulphur Content', |
| 57 | standard=1, |
| 58 | linked_doctype='Fertilizer'), |
| 59 | dict( |
| 60 | doctype='Agriculture Analysis Criteria', |
| 61 | title='Magnesium Content', |
| 62 | standard=1, |
| 63 | linked_doctype='Fertilizer'), |
| 64 | dict( |
| 65 | doctype='Agriculture Analysis Criteria', |
| 66 | title='Iron Content', |
| 67 | standard=1, |
| 68 | linked_doctype='Fertilizer'), |
| 69 | dict( |
| 70 | doctype='Agriculture Analysis Criteria', |
| 71 | title='Copper Content', |
| 72 | standard=1, |
| 73 | linked_doctype='Fertilizer'), |
| 74 | dict( |
| 75 | doctype='Agriculture Analysis Criteria', |
| 76 | title='Zinc Content', |
| 77 | standard=1, |
| 78 | linked_doctype='Fertilizer'), |
| 79 | dict( |
| 80 | doctype='Agriculture Analysis Criteria', |
| 81 | title='Boron Content', |
| 82 | standard=1, |
| 83 | linked_doctype='Fertilizer'), |
| 84 | dict( |
| 85 | doctype='Agriculture Analysis Criteria', |
| 86 | title='Manganese Content', |
| 87 | standard=1, |
| 88 | linked_doctype='Fertilizer'), |
| 89 | dict( |
| 90 | doctype='Agriculture Analysis Criteria', |
| 91 | title='Chlorine Content', |
| 92 | standard=1, |
| 93 | linked_doctype='Fertilizer'), |
| 94 | dict( |
| 95 | doctype='Agriculture Analysis Criteria', |
| 96 | title='Molybdenum Content', |
| 97 | standard=1, |
| 98 | linked_doctype='Fertilizer'), |
| 99 | dict( |
| 100 | doctype='Agriculture Analysis Criteria', |
| 101 | title='Sodium Content', |
| 102 | standard=1, |
| 103 | linked_doctype='Fertilizer'), |
| 104 | dict( |
| 105 | doctype='Agriculture Analysis Criteria', |
| 106 | title='Humic Acid', |
| 107 | standard=1, |
| 108 | linked_doctype='Fertilizer'), |
| 109 | dict( |
| 110 | doctype='Agriculture Analysis Criteria', |
| 111 | title='Fulvic Acid', |
| 112 | standard=1, |
| 113 | linked_doctype='Fertilizer'), |
| 114 | dict( |
| 115 | doctype='Agriculture Analysis Criteria', |
| 116 | title='Inert', |
| 117 | standard=1, |
| 118 | linked_doctype='Fertilizer'), |
| 119 | dict( |
| 120 | doctype='Agriculture Analysis Criteria', |
| 121 | title='Others', |
| 122 | standard=1, |
| 123 | linked_doctype='Fertilizer'), |
| 124 | dict( |
| 125 | doctype='Agriculture Analysis Criteria', |
| 126 | title='Nitrogen', |
| 127 | standard=1, |
| 128 | linked_doctype='Plant Analysis'), |
| 129 | dict( |
| 130 | doctype='Agriculture Analysis Criteria', |
| 131 | title='Phosphorous', |
| 132 | standard=1, |
| 133 | linked_doctype='Plant Analysis'), |
| 134 | dict( |
| 135 | doctype='Agriculture Analysis Criteria', |
| 136 | title='Potassium', |
| 137 | standard=1, |
| 138 | linked_doctype='Plant Analysis'), |
| 139 | dict( |
| 140 | doctype='Agriculture Analysis Criteria', |
| 141 | title='Calcium', |
| 142 | standard=1, |
| 143 | linked_doctype='Plant Analysis'), |
| 144 | dict( |
| 145 | doctype='Agriculture Analysis Criteria', |
| 146 | title='Magnesium', |
| 147 | standard=1, |
| 148 | linked_doctype='Plant Analysis'), |
| 149 | dict( |
| 150 | doctype='Agriculture Analysis Criteria', |
| 151 | title='Sulphur', |
| 152 | standard=1, |
| 153 | linked_doctype='Plant Analysis'), |
| 154 | dict( |
| 155 | doctype='Agriculture Analysis Criteria', |
| 156 | title='Boron', |
| 157 | standard=1, |
| 158 | linked_doctype='Plant Analysis'), |
| 159 | dict( |
| 160 | doctype='Agriculture Analysis Criteria', |
| 161 | title='Copper', |
| 162 | standard=1, |
| 163 | linked_doctype='Plant Analysis'), |
| 164 | dict( |
| 165 | doctype='Agriculture Analysis Criteria', |
| 166 | title='Iron', |
| 167 | standard=1, |
| 168 | linked_doctype='Plant Analysis'), |
| 169 | dict( |
| 170 | doctype='Agriculture Analysis Criteria', |
| 171 | title='Manganese', |
| 172 | standard=1, |
| 173 | linked_doctype='Plant Analysis'), |
| 174 | dict( |
| 175 | doctype='Agriculture Analysis Criteria', |
| 176 | title='Zinc', |
| 177 | standard=1, |
| 178 | linked_doctype='Plant Analysis'), |
| 179 | dict( |
| 180 | doctype='Agriculture Analysis Criteria', |
| 181 | title='Depth (in cm)', |
| 182 | standard=1, |
| 183 | linked_doctype='Soil Analysis'), |
| 184 | dict( |
| 185 | doctype='Agriculture Analysis Criteria', |
Ameya Shenoy | cc05c0b | 2017-12-13 18:50:39 +0530 | [diff] [blame] | 186 | title='Soil pH', |
Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 187 | standard=1, |
| 188 | linked_doctype='Soil Analysis'), |
| 189 | dict( |
| 190 | doctype='Agriculture Analysis Criteria', |
| 191 | title='Salt Concentration (%)', |
| 192 | standard=1, |
| 193 | linked_doctype='Soil Analysis'), |
| 194 | dict( |
| 195 | doctype='Agriculture Analysis Criteria', |
| 196 | title='Organic Matter (%)', |
| 197 | standard=1, |
| 198 | linked_doctype='Soil Analysis'), |
| 199 | dict( |
| 200 | doctype='Agriculture Analysis Criteria', |
| 201 | title='CEC (Cation Exchange Capacity) (MAQ/100mL)', |
| 202 | standard=1, |
| 203 | linked_doctype='Soil Analysis'), |
| 204 | dict( |
| 205 | doctype='Agriculture Analysis Criteria', |
| 206 | title='Potassium Saturation (%)', |
| 207 | standard=1, |
| 208 | linked_doctype='Soil Analysis'), |
| 209 | dict( |
| 210 | doctype='Agriculture Analysis Criteria', |
| 211 | title='Calcium Saturation (%)', |
| 212 | standard=1, |
| 213 | linked_doctype='Soil Analysis'), |
| 214 | dict( |
| 215 | doctype='Agriculture Analysis Criteria', |
| 216 | title='Manganese Saturation (%)', |
| 217 | standard=1, |
| 218 | linked_doctype='Soil Analysis'), |
| 219 | dict( |
| 220 | doctype='Agriculture Analysis Criteria', |
| 221 | title='Nirtogen (ppm)', |
| 222 | standard=1, |
| 223 | linked_doctype='Soil Analysis'), |
| 224 | dict( |
| 225 | doctype='Agriculture Analysis Criteria', |
| 226 | title='Phosphorous (ppm)', |
| 227 | standard=1, |
| 228 | linked_doctype='Soil Analysis'), |
| 229 | dict( |
| 230 | doctype='Agriculture Analysis Criteria', |
| 231 | title='Potassium (ppm)', |
| 232 | standard=1, |
| 233 | linked_doctype='Soil Analysis'), |
| 234 | dict( |
| 235 | doctype='Agriculture Analysis Criteria', |
| 236 | title='Calcium (ppm)', |
| 237 | standard=1, |
| 238 | linked_doctype='Soil Analysis'), |
| 239 | dict( |
| 240 | doctype='Agriculture Analysis Criteria', |
| 241 | title='Magnesium (ppm)', |
| 242 | standard=1, |
| 243 | linked_doctype='Soil Analysis'), |
| 244 | dict( |
| 245 | doctype='Agriculture Analysis Criteria', |
| 246 | title='Sulphur (ppm)', |
| 247 | standard=1, |
| 248 | linked_doctype='Soil Analysis'), |
| 249 | dict( |
| 250 | doctype='Agriculture Analysis Criteria', |
| 251 | title='Copper (ppm)', |
| 252 | standard=1, |
| 253 | linked_doctype='Soil Analysis'), |
| 254 | dict( |
| 255 | doctype='Agriculture Analysis Criteria', |
| 256 | title='Iron (ppm)', |
| 257 | standard=1, |
| 258 | linked_doctype='Soil Analysis'), |
| 259 | dict( |
| 260 | doctype='Agriculture Analysis Criteria', |
| 261 | title='Manganese (ppm)', |
| 262 | standard=1, |
| 263 | linked_doctype='Soil Analysis'), |
| 264 | dict( |
| 265 | doctype='Agriculture Analysis Criteria', |
| 266 | title='Zinc (ppm)', |
| 267 | standard=1, |
| 268 | linked_doctype='Soil Analysis'), |
| 269 | dict( |
| 270 | doctype='Agriculture Analysis Criteria', |
| 271 | title='Aluminium (ppm)', |
| 272 | standard=1, |
| 273 | linked_doctype='Soil Analysis'), |
| 274 | dict( |
| 275 | doctype='Agriculture Analysis Criteria', |
Ameya Shenoy | cc05c0b | 2017-12-13 18:50:39 +0530 | [diff] [blame] | 276 | title='Water pH', |
Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 277 | standard=1, |
| 278 | linked_doctype='Water Analysis'), |
| 279 | dict( |
| 280 | doctype='Agriculture Analysis Criteria', |
| 281 | title='Conductivity (mS/cm)', |
| 282 | standard=1, |
| 283 | linked_doctype='Water Analysis'), |
| 284 | dict( |
| 285 | doctype='Agriculture Analysis Criteria', |
| 286 | title='Hardness (mg/CaCO3)', |
| 287 | standard=1, |
| 288 | linked_doctype='Water Analysis'), |
| 289 | dict( |
| 290 | doctype='Agriculture Analysis Criteria', |
| 291 | title='Turbidity (NTU)', |
| 292 | standard=1, |
| 293 | linked_doctype='Water Analysis'), |
| 294 | dict( |
| 295 | doctype='Agriculture Analysis Criteria', |
| 296 | title='Odor', |
| 297 | standard=1, |
| 298 | linked_doctype='Water Analysis'), |
| 299 | dict( |
| 300 | doctype='Agriculture Analysis Criteria', |
| 301 | title='Color', |
| 302 | standard=1, |
| 303 | linked_doctype='Water Analysis'), |
| 304 | dict( |
| 305 | doctype='Agriculture Analysis Criteria', |
| 306 | title='Nitrate (mg/L)', |
| 307 | standard=1, |
| 308 | linked_doctype='Water Analysis'), |
| 309 | dict( |
| 310 | doctype='Agriculture Analysis Criteria', |
| 311 | title='Nirtite (mg/L)', |
| 312 | standard=1, |
| 313 | linked_doctype='Water Analysis'), |
| 314 | dict( |
| 315 | doctype='Agriculture Analysis Criteria', |
| 316 | title='Calcium (mg/L)', |
| 317 | standard=1, |
| 318 | linked_doctype='Water Analysis'), |
| 319 | dict( |
| 320 | doctype='Agriculture Analysis Criteria', |
| 321 | title='Magnesium (mg/L)', |
| 322 | standard=1, |
| 323 | linked_doctype='Water Analysis'), |
| 324 | dict( |
| 325 | doctype='Agriculture Analysis Criteria', |
| 326 | title='Sulphate (mg/L)', |
| 327 | standard=1, |
| 328 | linked_doctype='Water Analysis'), |
| 329 | dict( |
| 330 | doctype='Agriculture Analysis Criteria', |
| 331 | title='Boron (mg/L)', |
| 332 | standard=1, |
| 333 | linked_doctype='Water Analysis'), |
| 334 | dict( |
| 335 | doctype='Agriculture Analysis Criteria', |
| 336 | title='Copper (mg/L)', |
| 337 | standard=1, |
| 338 | linked_doctype='Water Analysis'), |
| 339 | dict( |
| 340 | doctype='Agriculture Analysis Criteria', |
| 341 | title='Iron (mg/L)', |
| 342 | standard=1, |
| 343 | linked_doctype='Water Analysis'), |
| 344 | dict( |
| 345 | doctype='Agriculture Analysis Criteria', |
| 346 | title='Manganese (mg/L)', |
| 347 | standard=1, |
| 348 | linked_doctype='Water Analysis'), |
| 349 | dict( |
| 350 | doctype='Agriculture Analysis Criteria', |
| 351 | title='Zinc (mg/L)', |
| 352 | standard=1, |
| 353 | linked_doctype='Water Analysis'), |
| 354 | dict( |
| 355 | doctype='Agriculture Analysis Criteria', |
| 356 | title='Chlorine (mg/L)', |
| 357 | standard=1, |
| 358 | linked_doctype='Water Analysis'), |
| 359 | dict( |
| 360 | doctype='Agriculture Analysis Criteria', |
| 361 | title='Bulk Density', |
| 362 | standard=1, |
| 363 | linked_doctype='Soil Texture'), |
| 364 | dict( |
| 365 | doctype='Agriculture Analysis Criteria', |
| 366 | title='Field Capacity', |
| 367 | standard=1, |
| 368 | linked_doctype='Soil Texture'), |
| 369 | dict( |
| 370 | doctype='Agriculture Analysis Criteria', |
| 371 | title='Wilting Point', |
| 372 | standard=1, |
| 373 | linked_doctype='Soil Texture'), |
| 374 | dict( |
| 375 | doctype='Agriculture Analysis Criteria', |
| 376 | title='Hydraulic Conductivity', |
| 377 | standard=1, |
| 378 | linked_doctype='Soil Texture'), |
| 379 | dict( |
| 380 | doctype='Agriculture Analysis Criteria', |
| 381 | title='Organic Matter', |
| 382 | standard=1, |
| 383 | linked_doctype='Soil Texture'), |
| 384 | dict( |
| 385 | doctype='Agriculture Analysis Criteria', |
| 386 | title='Temperature High', |
| 387 | standard=1, |
| 388 | linked_doctype='Weather'), |
| 389 | dict( |
| 390 | doctype='Agriculture Analysis Criteria', |
| 391 | title='Temperature Low', |
| 392 | standard=1, |
| 393 | linked_doctype='Weather'), |
| 394 | dict( |
| 395 | doctype='Agriculture Analysis Criteria', |
| 396 | title='Temperature Average', |
| 397 | standard=1, |
| 398 | linked_doctype='Weather'), |
| 399 | dict( |
| 400 | doctype='Agriculture Analysis Criteria', |
| 401 | title='Dew Point', |
| 402 | standard=1, |
| 403 | linked_doctype='Weather'), |
| 404 | dict( |
| 405 | doctype='Agriculture Analysis Criteria', |
| 406 | title='Precipitation Received', |
| 407 | standard=1, |
| 408 | linked_doctype='Weather'), |
| 409 | dict( |
| 410 | doctype='Agriculture Analysis Criteria', |
| 411 | title='Humidity', |
| 412 | standard=1, |
| 413 | linked_doctype='Weather'), |
| 414 | dict( |
| 415 | doctype='Agriculture Analysis Criteria', |
| 416 | title='Pressure', |
| 417 | standard=1, |
| 418 | linked_doctype='Weather'), |
| 419 | dict( |
| 420 | doctype='Agriculture Analysis Criteria', |
| 421 | title='Insolation/ PAR (Photosynthetically Active Radiation)', |
| 422 | standard=1, |
| 423 | linked_doctype='Weather'), |
| 424 | dict( |
| 425 | doctype='Agriculture Analysis Criteria', |
| 426 | title='Degree Days', |
| 427 | standard=1, |
Ameya Shenoy | cc05c0b | 2017-12-13 18:50:39 +0530 | [diff] [blame] | 428 | linked_doctype='Weather') |
Ameya Shenoy | 5c62368 | 2017-12-06 18:36:27 +0530 | [diff] [blame] | 429 | ] |
| 430 | insert_record(records) |