@ -1,18 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<data> |
|||
<record id="seq_pesticide" model="ir.sequence"> |
|||
<field name="name">Pest Request</field> |
|||
<field name="code">pest.request</field> |
|||
<field name="prefix">PEST/REQ/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
<record id="seq_crop" model="ir.sequence"> |
|||
<field name="name">Crop Request</field> |
|||
<field name="code">crop.requests</field> |
|||
<field name="prefix">CROP/REQ/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
|
|||
</data> |
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<data noupdate="1"> |
|||
<!-- Record for creating sequence in pest request model--> |
|||
<record id="seq_pesticide" model="ir.sequence"> |
|||
<field name="name">Pest Request</field> |
|||
<field name="code">pest.request</field> |
|||
<field name="prefix">PEST/REQ/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
<!-- Record for creating sequence in crop request model--> |
|||
<record id="seq_crop" model="ir.sequence"> |
|||
<field name="name">Crop Request</field> |
|||
<field name="code">crop.request</field> |
|||
<field name="prefix">CROP/REQ/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
<!-- Record for creating sequence in animal rental model--> |
|||
<record id="seq_animal_rental" model="ir.sequence"> |
|||
<field name="name">Animal Rental</field> |
|||
<field name="code">animal.rental</field> |
|||
<field name="prefix">ANIMAL/RENTAL/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
<!-- Record for creating sequence in vehicle rental model--> |
|||
<record id="seq_vehicle_rental" model="ir.sequence"> |
|||
<field name="name">Vehicle Rental</field> |
|||
<field name="code">vehicle.rental</field> |
|||
<field name="prefix">VEHICLE/RENTAL/</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
</data> |
@ -0,0 +1,52 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
from random import randint |
|||
|
|||
|
|||
class AgricultureTag(models.Model): |
|||
""" This model represents tags related to agriculture. Tags are used to |
|||
categorize and label various agricultural elements, products. |
|||
They facilitate the organization and grouping of agricultural information |
|||
for easier searching and classification. """ |
|||
_name = "agriculture.tag" |
|||
_description = "Agriculture Tags" |
|||
|
|||
def _get_default_color(self): |
|||
""" The function selects colors for tags, likely based on some |
|||
criteria or input, facilitating visual differentiation and |
|||
categorization.""" |
|||
return randint(1, 11) |
|||
|
|||
name = fields.Char(string='Tag Name', required=True, translate=True, |
|||
help='Tags are helpful for easy identification. Please ' |
|||
'create appropriate tags.') |
|||
color = fields.Integer(string='Color', default=_get_default_color, |
|||
help='Color are helpful for Highlight tags . Please' |
|||
'choose different colors for differed tags') |
|||
|
|||
_sql_constraints = [ |
|||
# Partial constraint, complemented by unique tag and name. |
|||
# useful to keep because it provides a proper error message when a |
|||
# violation occurs |
|||
('name_uniq', 'unique (name)', "Tag name already exists !"), |
|||
] |
@ -0,0 +1,60 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AnimalDetail(models.Model): |
|||
"""This model represents comprehensive details about animals involved |
|||
in agricultural management. It provides a structured way to store |
|||
information related to various animal breeds and their attributes.""" |
|||
_name = 'animal.detail' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Animal Details" |
|||
_rec_name = 'breed' |
|||
|
|||
image = fields.Binary(help='Upload images of animals', |
|||
tracking=True) |
|||
breed = fields.Char(string='Breed', help='Mention the breed of animal', |
|||
required=True, tracking=True) |
|||
age = fields.Char(string='Age', help='Mention the age of animal', |
|||
required=True, tracking=True) |
|||
state = fields.Selection( |
|||
[('available', 'Available'), ('not_available', 'Not Available')], |
|||
default="available", help='The status whether this animal, whether it ' |
|||
'is available or not', |
|||
string='Status', required=True, tracking=True) |
|||
note = fields.Text(string='Note', tracking=True, |
|||
help='If any notes or description about the animal', |
|||
placeholder='Note') |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='This field represents the company associated with ' |
|||
'the current user or environment.', |
|||
default=lambda self: self.env.company) |
|||
|
|||
def action_not_available(self): |
|||
"""Function for change state to not available""" |
|||
self.state = 'not_available' |
|||
|
|||
def action_available(self): |
|||
"""Function for change state to available""" |
|||
self.state = 'available' |
@ -1,49 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
'''Module for Creating Animal Records''' |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class AnimalDetails(models.Model): |
|||
'''Details of Animals''' |
|||
_name = 'animal.details' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Animal Details" |
|||
_rec_name = 'breed' |
|||
|
|||
image = fields.Binary(string='Image', tracking=True) |
|||
breed = fields.Char(string='Breed', required=True, tracking=True) |
|||
age = fields.Char(string='Age', required=True, tracking=True) |
|||
state = fields.Selection( |
|||
[('available', 'Available'), ('not_available', 'Not Available')], |
|||
default="available", |
|||
string='Status', required=True, tracking=True) |
|||
note = fields.Text(string='Note', tracking=True) |
|||
|
|||
def action_not_available(self): |
|||
self.state = 'not_available' |
|||
|
|||
def action_sold(self): |
|||
self.state = 'sold' |
|||
|
|||
def action_available(self): |
|||
self.state = 'available' |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class CropAnimal(models.Model): |
|||
""" This model serves as a bridge to attach animal details to crop |
|||
request records. It provides a structured way to associate animal-related |
|||
information with specific crop requests.""" |
|||
_name = 'crop.animal' |
|||
_description = 'Crop Animal Details' |
|||
|
|||
crop_request_id = fields.Many2one('crop.request', string='Crop', |
|||
help='Select the crop id for this animal to be ' |
|||
'used') |
|||
animal_id = fields.Many2one('animal.detail', string='Animal', |
|||
help="select animal used for this farming", |
|||
domain=[('state', '=', 'available')], |
|||
tracking=True) |
|||
qty = fields.Integer(string='Quantity', |
|||
help=" Number of animals used for farming") |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='This field represents the company associated with ' |
|||
'the current user or environment.', |
|||
default=lambda self: self.env.company) |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class CropMachinery(models.Model): |
|||
""" This model serves as a bridge to attach machinery details to crop |
|||
request records. It provides a structured way to associate machinery-related |
|||
information with specific crop requests.""" |
|||
_name = 'crop.machinery' |
|||
_description = 'Crop Machinery Details' |
|||
|
|||
crop_request_id = fields.Many2one('crop.request', string='Crop id', |
|||
help="The crop id should be used to identify the " |
|||
"machinery is used which crop farming") |
|||
vehicle_id = fields.Many2one('vehicle.detail', |
|||
help="The vehicle that used for farming", |
|||
tracking=True, string='Vehicle', ) |
|||
qty = fields.Integer(string='Quantity', |
|||
help="The Number of the vehicle that used for farming") |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='This field represents the company associated with' |
|||
' the current user or environment.', |
|||
default=lambda self: self.env.company) |
@ -0,0 +1,134 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class CropRequest(models.Model): |
|||
""" This model represents the creation of crop requests. It provides a |
|||
structured way to initiate and manage requests for crop cultivation tasks, |
|||
including associating animals, machinery, and other relevant details.""" |
|||
_name = 'crop.request' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = "Crop Request" |
|||
_rec_name = 'ref' |
|||
|
|||
ref = fields.Char(string='Reference', help="Reference id of crop requests", |
|||
copy=False, readonly=True, tracking=True, |
|||
default=lambda self: _('New')) |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
|||
farmer_id = fields.Many2one('farmer.detail', string='Farmer', |
|||
help="Choose the farmer for the crop", |
|||
required=True, tracking=True) |
|||
seed_id = fields.Many2one('seed.detail', string='Crop', |
|||
help=" Select the seed details", |
|||
required=True, tracking=True) |
|||
location_id = fields.Many2one('location.detail', |
|||
string='Location', required=True, |
|||
help="Mention the Location details for " |
|||
"farming", tracking=True) |
|||
request_date = fields.Date(string='Request Date', tracking=True, |
|||
help="The Requested Date for crop", |
|||
default=fields.Date.context_today, required=True) |
|||
state = fields.Selection( |
|||
[('draft', 'Draft'), ('confirm', 'Confirmed'), |
|||
('ploughing', 'Ploughing'), ('sowing', 'Sowing'), |
|||
('manuring', 'Manuring'), ('irrigation', 'Irrigation'), |
|||
('weeding', 'Weeding'), ('harvest', 'Harvest'), ('storage', 'Storage'), |
|||
('cancel', 'Cancel')], group_expand='_group_expand_states', |
|||
string='Status', default='draft', tracking=True, |
|||
help="Mention the Status of crop, which stage now the crop is reached") |
|||
note = fields.Text(string='Note', tracking=True, |
|||
help="Description about crop and farming need to " |
|||
"remember", placeholder='Note') |
|||
machinery_ids = fields.One2many('crop.machinery', |
|||
'crop_request_id', string='Machinery', |
|||
tracking=True, help="The machinery required" |
|||
"for this farming") |
|||
animal_ids = fields.One2many('crop.animal', |
|||
'crop_request_id', string='Animals', |
|||
tracking=True, |
|||
help="Animals used for this crop farming") |
|||
tag_ids = fields.Many2many('agriculture.tag', string='Tags', |
|||
tracking=True, help="Create appropriate" |
|||
" tags for the crop ") |
|||
user_id = fields.Many2one('res.users', |
|||
string='Responsible User', |
|||
help="Mention the user of the documents", |
|||
default=lambda self: self.env.user) |
|||
|
|||
@api.model |
|||
def create(self, values): |
|||
"""Function for creating new crop requests""" |
|||
if values.get('ref', _('New')) == _('New'): |
|||
values['ref'] = self.env['ir.sequence'].next_by_code( |
|||
'crop.request') or _('New') |
|||
return super(CropRequest, self).create(values) |
|||
|
|||
def action_draft(self): |
|||
""" Function for change state of crop request to draft """ |
|||
self.state = 'draft' |
|||
|
|||
def action_confirm(self): |
|||
""" Function for change state of crop request to confirm """ |
|||
self.state = 'confirm' |
|||
|
|||
def action_ploughing(self): |
|||
""" Function for change state of crop request to ploughing """ |
|||
self.state = 'ploughing' |
|||
|
|||
def action_sowing(self): |
|||
""" Function for change state of crop request to sowing """ |
|||
self.state = 'sowing' |
|||
|
|||
def action_manuring(self): |
|||
""" Function for change state of crop request to manuring """ |
|||
self.state = 'manuring' |
|||
|
|||
def action_irrigation(self): |
|||
""" Function for change state of crop request to irrigation """ |
|||
self.state = 'irrigation' |
|||
|
|||
def action_weeding(self): |
|||
""" Function for change state of crop request to weeding """ |
|||
self.state = 'weeding' |
|||
|
|||
def action_harvest(self): |
|||
""" Function for change state of crop request to harvest """ |
|||
self.state = 'harvest' |
|||
|
|||
def action_cancel(self): |
|||
""" Function for change state of crop request to cancel """ |
|||
self.state = 'cancel' |
|||
|
|||
def action_storage(self): |
|||
""" Function for change state of crop request to storage """ |
|||
self.state = 'storage' |
|||
|
|||
def _group_expand_states(self, states, domain, order): |
|||
"""This function takes a list of states and expands them based on the |
|||
given domain and order.""" |
|||
return [key for |
|||
key, val in type(self).state.selection] |
@ -1,123 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
'''Model For Creating Crop Requests''' |
|||
from odoo import models, fields, api, _ |
|||
|
|||
|
|||
class CropRequests(models.Model): |
|||
'''Details to create Crop Requests''' |
|||
_name = 'crop.requests' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = "Agriculture Management" |
|||
_rec_name = 'ref' |
|||
|
|||
ref = fields.Char(string='Reference', required=True, copy=False, |
|||
readonly=True, tracking=True, |
|||
default=lambda self: _('New')) |
|||
farmer_id = fields.Many2one('farmer.details', string='Farmer', |
|||
required=True, tracking=True) |
|||
seed_id = fields.Many2one('seed.details', string='Crop', required=True, |
|||
tracking=True) |
|||
location_id = fields.Many2one('location.details', string='Location', |
|||
required=True, tracking=True) |
|||
request_date = fields.Date(string='Request Date', |
|||
default=fields.Date.context_today, required=True, |
|||
tracking=True) |
|||
state = fields.Selection( |
|||
[('draft', 'Draft'), ('confirm', 'Confirmed'), |
|||
('ploughing', 'Ploughing'), ('sowing', 'Sowing'), |
|||
('manuring', 'Manuring'), ('irrigation', 'Irrigation'), |
|||
('weeding', 'Weeding'), ('harvest', 'Harvest'), ('storage', 'Storage'), |
|||
('cancel', 'Cancel')], |
|||
string='Status', default='draft', tracking=True, |
|||
group_expand='_group_expand_states') |
|||
note = fields.Text(string='Note', tracking=True) |
|||
machinery_ids = fields.One2many('crop.machinery', 'des', string='Machinery', |
|||
tracking=True) |
|||
animal_ids = fields.One2many('crop.animals', 'dec', string='Animals', |
|||
tracking=True) |
|||
tags_id = fields.Many2many('agr.tag', string='Tags', tracking=True) |
|||
user_id = fields.Many2one('res.users', string='Responsible User', |
|||
default=lambda self: self.env.user) |
|||
|
|||
@api.model |
|||
def create(self, values): |
|||
if values.get('ref', _('New')) == _('New'): |
|||
values['ref'] = self.env['ir.sequence'].next_by_code( |
|||
'crop.requests') or _('New') |
|||
res = super(CropRequests, self).create(values) |
|||
return res |
|||
|
|||
def action_draft(self): |
|||
self.state = 'draft' |
|||
|
|||
def action_confirm(self): |
|||
self.state = 'confirm' |
|||
|
|||
def action_ploughing(self): |
|||
self.state = 'ploughing' |
|||
|
|||
def action_sowing(self): |
|||
self.state = 'sowing' |
|||
|
|||
def action_manuring(self): |
|||
self.state = 'manuring' |
|||
|
|||
def action_irrigation(self): |
|||
self.state = 'irrigation' |
|||
|
|||
def action_weeding(self): |
|||
self.state = 'weeding' |
|||
|
|||
def action_harvest(self): |
|||
self.state = 'harvest' |
|||
|
|||
def action_cancel(self): |
|||
self.state = 'cancel' |
|||
|
|||
def action_storage(self): |
|||
self.state = 'storage' |
|||
|
|||
def _group_expand_states(self, states, domain, order): |
|||
return [key for |
|||
key, val in type(self).state.selection] |
|||
|
|||
|
|||
class CropMachinery(models.Model): |
|||
'''Model For Attaching Vehicles''' |
|||
_name = 'crop.machinery' |
|||
|
|||
des = fields.Many2one('crop.requests') |
|||
vehicle_id = fields.Many2one('vehicle.details', string='Vehicle', |
|||
tracking=True) |
|||
qty = fields.Integer(string='Quantity') |
|||
|
|||
|
|||
class CropAnimals(models.Model): |
|||
'''Model For Attaching Animals''' |
|||
_name = 'crop.animals' |
|||
|
|||
dec = fields.Many2one('crop.requests') |
|||
animal_id = fields.Many2one('animal.details', string='Animal', |
|||
domain=[('state', '=', 'available')], |
|||
tracking=True) |
|||
qty = fields.Integer(string='Quantity') |
@ -0,0 +1,55 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class FarmerDetail(models.Model): |
|||
"""This model represents comprehensive details about farmers within the |
|||
context of agriculture management. It provides a structured way to store |
|||
information related to individual farmers, including their personal and |
|||
contact details. """ |
|||
_name = 'farmer.detail' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = 'Farmer' |
|||
_rec_name = 'farmer_id' |
|||
|
|||
farmer_id = fields.Many2one('res.partner', string='Farmer', |
|||
help=' Select the corresponding farmer', |
|||
required=True, tracking=True) |
|||
farmer_image = fields.Binary(string='Image', copy=False, |
|||
help='Upload image of Farmer') |
|||
note = fields.Text(string='Notes', tracking=True, |
|||
help="Description regarding the farmer", |
|||
placeholder='Note') |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
|||
|
|||
@api.onchange('farmer_id') |
|||
def _onchange_farmer_id(self): |
|||
"""Function for select image of farmer automatically when choosing |
|||
the farmer""" |
|||
for record in self: |
|||
if record.farmer_id: |
|||
record.farmer_image = record.farmer_id.image_1920 |
@ -1,39 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class FarmerDetails(models.Model): |
|||
_name = 'farmer.details' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = 'Farmer Details' |
|||
_rec_name = 'farmer_name' |
|||
|
|||
farmer_name = fields.Many2one('res.partner', string='Farmer', required=True, |
|||
tracking=True) |
|||
farmer_image = fields.Binary(string='Image', tracking=True) |
|||
note = fields.Text(string='Notes', tracking=True) |
|||
|
|||
@api.onchange('farmer_name') |
|||
def onchange_farmer_name(self): |
|||
if self.farmer_name: |
|||
self.farmer_image = self.farmer_name.image_1920 |
@ -0,0 +1,60 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class LocationDetail(models.Model): |
|||
"""This model represents comprehensive details about locations within |
|||
the context of agriculture. It provides a structured way to store |
|||
information related to various geographic locations, such as farms, fields, |
|||
or storage areas. """ |
|||
_name = 'location.detail' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Location Details" |
|||
_rec_name = 'location_name' |
|||
|
|||
location_name = fields.Char(string='Location Name', required=True, |
|||
help='Give the name of Location where' |
|||
' farming done', tracking=True) |
|||
location_address = fields.Char(string='Location Address', required=True, |
|||
help='Give the full address of the location', |
|||
tracking=True) |
|||
location_area = fields.Float(string='Location Area', required=True, |
|||
help='The area of location', tracking=True) |
|||
location_area_unit = fields.Selection([('acres', 'Acres'), |
|||
('hectares', 'Hectares')], |
|||
string='Area Unit', tracking=True, |
|||
required=True, |
|||
help='Mention the units of area') |
|||
location_type = fields.Selection([('plot', 'Plot'), |
|||
('field', 'Field')], default="plot", |
|||
required=True, tracking=True, |
|||
help='Describe the type of farming area', |
|||
string='Location Type') |
|||
note = fields.Text(string='Note', tracking=True, |
|||
help='If any description for the location, mention here', |
|||
placeholder='Note') |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
@ -1,44 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class LocationDetails(models.Model): |
|||
_name = 'location.details' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Location Details" |
|||
_rec_name = 'location_name' |
|||
|
|||
location_name = fields.Char(string='Location Name', required=True, |
|||
tracking=True) |
|||
location_address = fields.Char(string='Location Address', required=True, |
|||
tracking=True) |
|||
location_area = fields.Float(string='Location Area', required=True, |
|||
tracking=True) |
|||
location_area_unit = fields.Selection( |
|||
[('acres', 'Acres'), ('hectares', 'Hectares')], string='Area Unit', |
|||
required=True, tracking=True) |
|||
location_type = fields.Selection([('plot', 'Plot'), ('field', 'Field')], |
|||
default="plot", |
|||
string='Location Type', required=True, |
|||
tracking=True) |
|||
note = fields.Text(string='Note', tracking=True) |
@ -0,0 +1,65 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class PestDetail(models.Model): |
|||
""" This model represents comprehensive details about pests within the |
|||
context of agriculture management. """ |
|||
_name = 'pest.detail' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = 'Pest Details' |
|||
_rec_name = 'pest_name' |
|||
|
|||
pest_name = fields.Char(string='Pesticide', tracking=True, |
|||
help="Mention the pesticide name", required=True) |
|||
pest_expiry_date = fields.Date(string='Expiry Date', |
|||
help=" Mention the pesticide expiry date", |
|||
required=True, tracking=True) |
|||
pest_description = fields.Text(string='Pest Description', tracking=True, |
|||
help="Brief description about the pesticide") |
|||
pest_image = fields.Binary(string='Image', tracking=True, |
|||
help="Upload the image of pesticide") |
|||
pest_cost = fields.Float(string='Cost', help="The cost of the pesticide", |
|||
required=True, tracking=True) |
|||
pest_quantity = fields.Integer(string='Quantity', |
|||
help="The quantity of pesticide purchased", |
|||
required=True, tracking=True) |
|||
total_cost = fields.Float(string='Total Cost', tracking=True, |
|||
help="The total cost of pesticide", |
|||
compute='_compute_total_cost', store=True) |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
|||
currency_id = fields.Many2one('res.currency', |
|||
help="Currency of company", string='Currency', |
|||
default=lambda |
|||
self: self.env.user.company_id.currency_id, |
|||
tracking=True) |
|||
|
|||
@api.depends('pest_cost', 'pest_quantity') |
|||
def _compute_total_cost(self): |
|||
"""Function for calculate total cost of pesticide """ |
|||
for record in self: |
|||
record.total_cost = record.pest_cost * record.pest_quantity |
@ -1,50 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class PestDetails(models.Model): |
|||
_name = 'pest.details' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = 'Pest Details' |
|||
_rec_name = 'pest_name' |
|||
|
|||
pest_name = fields.Char(string='Pesticide', required=True, tracking=True) |
|||
pest_expiry_date = fields.Date(string='Expiry Date', required=True, |
|||
tracking=True) |
|||
pest_description = fields.Text(string='Pest Description', tracking=True) |
|||
pest_image = fields.Binary(string='Image', tracking=True) |
|||
pest_cost = fields.Float(string='Cost', required=True, tracking=True) |
|||
pest_quantity = fields.Integer(string='Quantity', required=True, |
|||
tracking=True) |
|||
total_cost = fields.Float(string='Total Cost', |
|||
compute='_compute_total_cost', store=True, |
|||
tracking=True) |
|||
currency_id = fields.Many2one('res.currency', string='Currency', |
|||
default=lambda |
|||
self: self.env.user.company_id.currency_id, |
|||
tracking=True) |
|||
|
|||
@api.depends('pest_cost', 'pest_quantity') |
|||
def _compute_total_cost(self): |
|||
for record in self: |
|||
record.total_cost = record.pest_cost * record.pest_quantity |
@ -0,0 +1,57 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class SeedDetail(models.Model): |
|||
"""This model represents comprehensive details about seeds within the |
|||
context of agriculture management. It provides a structured way to store |
|||
information related to various types of seeds used for planting and |
|||
cultivation.""" |
|||
_name = 'seed.detail' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = "Seed" |
|||
|
|||
name = fields.Char(string='Name', help='Mention the name of the breed of ' |
|||
'crop used for farming', |
|||
required=True, tracking=True) |
|||
quantity = fields.Integer(string='Quantity', required=True, tracking=True, |
|||
help='Mention Quantity or seed purchased for ' |
|||
'farming') |
|||
unit = fields.Selection([('kg', 'Kilograms'), ('gms', 'Grams')], |
|||
string='Unit', required=True, tracking=True, |
|||
help='Mention the quantity of seed purchased for ' |
|||
'farming') |
|||
seed_type = fields.Selection( |
|||
[('registered', 'Registered'), ('breeder', 'Breeder'), |
|||
('foundation', 'Foundation'), |
|||
('certified', 'Certified')], string='Type', tracking=True, |
|||
help='Mention the status of seed purchased for farming', required=True) |
|||
note = fields.Text(string='Note', tracking=True, |
|||
help="Please describe any additional details here if " |
|||
"there is a need to mention additional data.", |
|||
placeholder='Note') |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
@ -1,39 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class SeedDetails(models.Model): |
|||
_name = 'seed.details' |
|||
_inherit = ["mail.thread", 'mail.activity.mixin'] |
|||
_description = "Seed Details" |
|||
|
|||
name = fields.Char(string='Name', required=True, tracking=True) |
|||
quantity = fields.Integer(string='Quantity', required=True, tracking=True) |
|||
unit = fields.Selection([('kg', 'Kilograms'), ('gms', 'Grams')], |
|||
string='Unit', required=True, tracking=True) |
|||
seed_type = fields.Selection( |
|||
[('registered', 'Registered'), ('breeder', 'Breeder'), |
|||
('foundation', 'Foundation'), |
|||
('certified', 'Certified')], string='Type', required=True, |
|||
tracking=True) |
|||
note = fields.Text(string='Note', tracking=True) |
@ -1,39 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from random import randint |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class Tag(models.Model): |
|||
_name = "agr.tag" |
|||
_description = "Agriculture Tags" |
|||
|
|||
def _get_default_color(self): |
|||
return randint(1, 11) |
|||
|
|||
name = fields.Char('Tag Name', required=True, translate=True) |
|||
color = fields.Integer('Color', default=_get_default_color) |
|||
|
|||
_sql_constraints = [ |
|||
('name_uniq', 'unique (name)', "Tag name already exists !"), |
|||
] |
@ -0,0 +1,78 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models |
|||
from datetime import datetime |
|||
|
|||
|
|||
class VehicleDetail(models.Model): |
|||
""" This model represents comprehensive details about vehicles within |
|||
the context of agriculture management. It provides a structured way to |
|||
store information related to various types of vehicles used for |
|||
transportation and agricultural operations.""" |
|||
_name = 'vehicle.detail' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Vehicle Details" |
|||
|
|||
name = fields.Char(string='Name', tracking=True, |
|||
help="Mention the name of vehicle chose", ) |
|||
vehicle_main_id = fields.Many2one('fleet.vehicle', |
|||
help="Select the vehicle that used for " |
|||
"farming", string='Vehicle', |
|||
required=True, |
|||
tracking=True, domain=( |
|||
[('state_id', '=', 'Registered')])) |
|||
vehicle_type = fields.Selection( |
|||
[('tractor', 'Tractor'), ('harvester', 'Harvester'), |
|||
('pickup', 'Pickup'), ('other', 'Other')], |
|||
string='Vehicle Type', required=True, |
|||
help=' Mention the status of vehicle ', tracking=True) |
|||
vehicle_model = fields.Char(string='Model Year', store=True, |
|||
help='Mention the model of selected model', |
|||
compute='_compute_vehicle_model', tracking=True) |
|||
note = fields.Text(string='Note', tracking=True, |
|||
help="Please describe any additional details here if " |
|||
"there is a need to mention additional data.", |
|||
placeholder='Note') |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', required=True, |
|||
readonly=True, help='The company associated with the current user or ' |
|||
'environment.', |
|||
default=lambda self: self.env.company) |
|||
|
|||
@api.onchange("vehicle_main_id") |
|||
def _onchange_vehicle_main_id(self): |
|||
"""Function for auto update the name of vehicle based on model and |
|||
brand""" |
|||
self.name = str( |
|||
self.vehicle_main_id.model_id.brand_id.name or " ") + "/" + str( |
|||
self.vehicle_main_id.model_id.name or " ") + "/" + str( |
|||
self.vehicle_main_id.license_plate or " ") |
|||
|
|||
@api.depends('vehicle_main_id') |
|||
def _compute_vehicle_model(self): |
|||
""" Function for selecting model of vehicle based on vehicle id""" |
|||
for ref in self: |
|||
ref.vehicle_model = False |
|||
if ref.vehicle_main_id.registration_date: |
|||
date = datetime.strptime( |
|||
str(ref.vehicle_main_id.registration_date), '%Y-%m-%d') |
|||
ref.vehicle_model = str(date.year) |
@ -1,58 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from datetime import datetime |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class VehicleDetails(models.Model): |
|||
_name = 'vehicle.details' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = "Vehicle Details" |
|||
|
|||
name = fields.Char(string='Name', tracking=True, ) |
|||
vehicle_main_id = fields.Many2one('fleet.vehicle', string='Vehicle', |
|||
required=True, tracking=True, |
|||
domain=( |
|||
[('state_id', '=', 'Registered')])) |
|||
vehicle_type = fields.Selection( |
|||
[('tractor', 'Tractor'), ('harvester', 'Harvester'), |
|||
('pickup', 'Pickup'), ('other', 'Other')], |
|||
string='Vehicle Type', required=True, tracking=True) |
|||
vehicle_model = fields.Char(string='Model Year', compute='compute_model', |
|||
store=True, tracking=True) |
|||
note = fields.Text(string='Note', tracking=True) |
|||
|
|||
@api.onchange("vehicle_main_id") |
|||
def onchange_vehicle(self): |
|||
self.name = str( |
|||
self.vehicle_main_id.model_id.brand_id.name or " ") + "/" + str( |
|||
self.vehicle_main_id.model_id.name or " ") + "/" + str( |
|||
self.vehicle_main_id.license_plate or " ") |
|||
|
|||
@api.depends('vehicle_main_id') |
|||
def compute_model(self): |
|||
for ref in self: |
|||
ref.vehicle_model = False |
|||
if ref.vehicle_main_id.registration_date: |
|||
date = datetime.strptime( |
|||
str(ref.vehicle_main_id.registration_date), '%Y-%m-%d') |
|||
ref.vehicle_model = str(date.year) |
@ -1,12 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- The record of animals report action --> |
|||
<record id="report_animal_crop" model="ir.actions.report"> |
|||
<field name="name">Animal Crop Report</field> |
|||
<field name="model">crop.requests</field> |
|||
<field name="model">crop.request</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">agriculture_management_odoo.animal_crop</field> |
|||
<field name="report_file">agriculture_management_odoo.animal_crop</field> |
|||
<field name="binding_model_id" ref="model_crop_requests"/> |
|||
<field name="binding_model_id" ref="model_crop_request"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
@ -1,13 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- Action for report of crop request --> |
|||
<record id="action_crop_request_report" model="ir.actions.report"> |
|||
<field name="name">Crop Report</field> |
|||
<field name="model">crop.report.wizard</field> |
|||
<field name="model">crop.report</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">agriculture_management_odoo.report_crop_details</field> |
|||
<field name="report_file">agriculture_management_odoo.report_crop_details</field> |
|||
<field name="binding_model_id" ref="model_crop_report_wizard"/> |
|||
<field name="binding_model_id" ref="model_crop_report"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
|||
|
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Report action for crop vehicle --> |
|||
<record id="report_vehicle_crop" model="ir.actions.report"> |
|||
<field name="name">Vehicle Crop Report</field> |
|||
<field name="model">crop.request</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">agriculture_management_odoo.vehicle_crop</field> |
|||
<field name="report_file">agriculture_management_odoo.vehicle_crop</field> |
|||
<field name="binding_model_id" ref="model_crop_request"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
@ -1,13 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<record id="action_pest_request_report" model="ir.actions.report"> |
|||
<!-- Record for actions of pesticide PDF report--> |
|||
<record id="pest_request_report_action" model="ir.actions.report"> |
|||
<field name="name">pest Report</field> |
|||
<field name="model">pest.report.wizard</field> |
|||
<field name="model">pest.report</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">agriculture_management_odoo.report_pest_details</field> |
|||
<field name="report_file">agriculture_management_odoo.report_pest_details</field> |
|||
<field name="binding_model_id" ref="model_pest_report_wizard"/> |
|||
<field name="report_name">agriculture_management_odoo.report_pest_detail</field> |
|||
<field name="report_file">agriculture_management_odoo.report_pest_detail</field> |
|||
<field name="binding_model_id" ref="model_pest_report"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
|||
|
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- User groups for Agriculture Management--> |
|||
<record id="module_agriculture_management_odoo" model="ir.module.category"> |
|||
<field name="name">Agriculture Management</field> |
|||
<field name="description">Category for Agriculture</field> |
|||
</record> |
|||
<record id="group_agriculture_user" model="res.groups"> |
|||
<field name="name">User</field> |
|||
<field name="category_id" ref="module_agriculture_management_odoo"/> |
|||
</record> |
|||
<record id="group_agriculture_admin" model="res.groups"> |
|||
<field name="name">Manager</field> |
|||
<field name="category_id" ref="module_agriculture_management_odoo"/> |
|||
<field name="implied_ids" eval="[(4, ref('group_agriculture_user'))]"/> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,85 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Security rules for crop request --> |
|||
<record id="rule_own_doc" model="ir.rule"> |
|||
<field name="name">View Own Docs</field> |
|||
<field ref="model_crop_request" name="model_id"/> |
|||
<field name="domain_force">['|',('user_id', '=', user.id),('create_uid', |
|||
'=', user.id)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('agriculture_management_odoo.group_agriculture_user'))]"/> |
|||
</record> |
|||
<record id="rule_all_doc" model="ir.rule"> |
|||
<field name="name">View All Docs</field> |
|||
<field ref="model_crop_request" name="model_id"/> |
|||
<field name="domain_force">[(1, '=', 1)]</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('agriculture_management_odoo.group_agriculture_admin'))]"/> |
|||
</record> |
|||
<record id="crop_request_comp_rule" model="ir.rule"> |
|||
<field name="name">Crop Request multi company rule</field> |
|||
<field name="model_id" ref="model_crop_request"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="animal_rental_comp_rule" model="ir.rule"> |
|||
<field name="name">Animal Rental multi company rule</field> |
|||
<field name="model_id" ref="model_animal_rental"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="animal_details_comp_rule" model="ir.rule"> |
|||
<field name="name">Animal Details multi company rule</field> |
|||
<field name="model_id" ref="model_animal_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="crop_animal_comp_rule" model="ir.rule"> |
|||
<field name="name">Crop Animal multi company rule</field> |
|||
<field name="model_id" ref="model_crop_animal"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="crop_machinery_comp_rule" model="ir.rule"> |
|||
<field name="name">Crop Machinery multi company rule</field> |
|||
<field name="model_id" ref="model_crop_machinery"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="damage_loss_comp_rule" model="ir.rule"> |
|||
<field name="name">Damage Loss multi company rule</field> |
|||
<field name="model_id" ref="model_damage_loss"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="farmer_detail_comp_rule" model="ir.rule"> |
|||
<field name="name">Farmer Detail multi company rule</field> |
|||
<field name="model_id" ref="model_farmer_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="location_detail_comp_rule" model="ir.rule"> |
|||
<field name="name">Location Detail multi company rule</field> |
|||
<field name="model_id" ref="model_location_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="pest_detail_comp_rule" model="ir.rule"> |
|||
<field name="name">Pest Detail multi company rule</field> |
|||
<field name="model_id" ref="model_pest_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="pest_request_comp_rule" model="ir.rule"> |
|||
<field name="name">Pest Request multi company rule</field> |
|||
<field name="model_id" ref="model_pest_request"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="seed_detail_comp_rule" model="ir.rule"> |
|||
<field name="name">Seed Detail multi company rule</field> |
|||
<field name="model_id" ref="model_seed_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="vehicle_detail_comp_rule" model="ir.rule"> |
|||
<field name="name">Vehicle Detail multi company rule</field> |
|||
<field name="model_id" ref="model_vehicle_detail"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
<record id="vehicle_rental_comp_rule" model="ir.rule"> |
|||
<field name="name">Vehicle Rental multi company rule</field> |
|||
<field name="model_id" ref="model_vehicle_rental"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
</odoo> |
|
@ -1,36 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record model="ir.module.category" id="module_agriculture_management_odoo"> |
|||
<field name="name">Agriculture Management</field> |
|||
<field name="description">Category for Agriculture</field> |
|||
</record> |
|||
|
|||
<record id="group_agriculture_user" model="res.groups"> |
|||
<field name="name">User</field> |
|||
<field name="category_id" ref="module_agriculture_management_odoo"/> |
|||
</record> |
|||
|
|||
<record id="group_agriculture_admin" model="res.groups"> |
|||
<field name="name">Manager</field> |
|||
<field name="category_id" ref="module_agriculture_management_odoo"/> |
|||
<field name="implied_ids" eval="[(4, ref('group_agriculture_user'))]"/> |
|||
</record> |
|||
|
|||
<record id="rule_own_doc" model="ir.rule"> |
|||
<field name="name">View Own Docs</field> |
|||
<field ref="model_crop_requests" name="model_id"/> |
|||
<field name="domain_force">['|',('user_id', '=', user.id),('create_uid', |
|||
'=', user.id)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('agriculture_management_odoo.group_agriculture_user'))]"/> |
|||
</record> |
|||
|
|||
<record id="rule_all_doc" model="ir.rule"> |
|||
<field name="name">View All Docs</field> |
|||
<field ref="model_crop_requests" name="model_id"/> |
|||
<field name="domain_force">[(1, '=', 1)]</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('agriculture_management_odoo.group_agriculture_admin'))]"/> |
|||
</record> |
|||
</odoo> |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 911 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 905 B After Width: | Height: | Size: 905 B |
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 839 B |
Before Width: | Height: | Size: 427 B After Width: | Height: | Size: 427 B |
Before Width: | Height: | Size: 627 B After Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 988 B After Width: | Height: | Size: 988 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 45 KiB |