diff --git a/agriculture_management_odoo/README.rst b/agriculture_management_odoo/README.rst new file mode 100644 index 000000000..f265fa554 --- /dev/null +++ b/agriculture_management_odoo/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3) + +Agriculture Management +====================== +In the Agriculture Management App, We can manage the agriculture to our own need. +We can also manage the rentals of vehicle and animals for agriculture purpose. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +* Developers: (V15) Vyshnav AR, + (V14) Ayana KP, +Contact : odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/agriculture_management_odoo/__init__.py b/agriculture_management_odoo/__init__.py new file mode 100644 index 000000000..d27f4362a --- /dev/null +++ b/agriculture_management_odoo/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from . import models +from . import wizard diff --git a/agriculture_management_odoo/__manifest__.py b/agriculture_management_odoo/__manifest__.py new file mode 100644 index 000000000..8b08c649d --- /dev/null +++ b/agriculture_management_odoo/__manifest__.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +{ + 'name': 'Agriculture Management', + 'version': '14.0.1.0.0', + 'category': 'Industries', + 'summary': """ We Can Easily Manage the Agriculture to Our Own Need.""", + 'description': """ In the Agriculture Management App, We can manage the " + "agriculture to our own need.We can also manage the rentals of vehicle and + animals for agriculture purpose.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['fleet','account'], + 'data': [ + 'security/agriculture_management_groups.xml', + 'security/crop_request_security.xml', + 'security/ir.model.access.csv', + 'data/ir_sequence_data.xml', + 'report/crop_request_reports.xml', + 'report/pest_request_reports.xml', + 'report/crop_request_templates.xml', + 'report/pest_request_templates.xml', + 'report/crop_vehicle_templates.xml', + 'report/crop_animal_templates.xml', + 'report/crop_animal_reports.xml', + 'wizard/crop_report_views.xml', + 'wizard/pest_report_views.xml', + 'wizard/animal_register_payment_views.xml', + 'wizard/vehicle_register_payment_views.xml', + 'views/seed_detail_views.xml', + 'views/animal_detail_views.xml', + 'views/location_detail_views.xml', + 'views/vehicle_detail_views.xml', + 'views/fleet_vehicle_views.xml', + 'views/farmer_detail_views.xml', + 'views/pest_request_views.xml', + 'views/pest_detail_views.xml', + 'views/damage_loss_views.xml', + 'views/crop_request_views.xml', + 'views/agriculture_tag_views.xml', + 'views/vehicle_rental_views.xml', + 'views/animal_rental_views.xml', + 'report/crop_vehicle_reports.xml', + 'views/agriculture_management_menus.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/agriculture_management_odoo/data/ir_sequence_data.xml b/agriculture_management_odoo/data/ir_sequence_data.xml new file mode 100644 index 000000000..ab2024a8c --- /dev/null +++ b/agriculture_management_odoo/data/ir_sequence_data.xml @@ -0,0 +1,19 @@ + + + + + Pest Request + pest.request + PEST/REQ/ + 5 + + + + + Crop Request + crop.request + CROP/REQ/ + 5 + + + diff --git a/agriculture_management_odoo/doc/RELEASE_NOTES.md b/agriculture_management_odoo/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..3f7dd7314 --- /dev/null +++ b/agriculture_management_odoo/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 30.05.2024 +#### Version 14.0.1.0.0 +#### ADD +- Initial commit for Agriculture Management diff --git a/agriculture_management_odoo/models/__init__.py b/agriculture_management_odoo/models/__init__.py new file mode 100644 index 000000000..dd800d03f --- /dev/null +++ b/agriculture_management_odoo/models/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from . import animal_detail +from . import animal_rental +from . import agriculture_tag +from . import crop_animal +from . import crop_machinery +from . import crop_request +from . import damage_loss +from . import farmer_detail +from . import fleet_vehicle +from . import location_detail +from . import pest_detail +from . import pest_request +from . import seed_detail +from . import vehicle_detail +from . import vehicle_rental diff --git a/agriculture_management_odoo/models/agriculture_tag.py b/agriculture_management_odoo/models/agriculture_tag.py new file mode 100644 index 000000000..916d9745c --- /dev/null +++ b/agriculture_management_odoo/models/agriculture_tag.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 !"), + ] diff --git a/agriculture_management_odoo/models/animal_detail.py b/agriculture_management_odoo/models/animal_detail.py new file mode 100644 index 000000000..ba140ffef --- /dev/null +++ b/agriculture_management_odoo/models/animal_detail.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 in Agriculture Management" + _rec_name = 'breed' + + image = fields.Binary(string='Image', 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') + 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_sold(self): + """Function for change state to sold""" + self.state = 'sold' + + def action_available(self): + """Function for change state to available""" + self.state = 'available' diff --git a/agriculture_management_odoo/models/animal_rental.py b/agriculture_management_odoo/models/animal_rental.py new file mode 100644 index 000000000..ee40d716a --- /dev/null +++ b/agriculture_management_odoo/models/animal_rental.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class AnimalRental(models.Model): + """ This model represents details about animal rental in the context of + crop requests. It provides a structured way to manage information related to + the rental of animals for agricultural purposes. """ + _name = 'animal.rental' + _inherit = ['mail.thread', 'mail.activity.mixin'] + _description = 'Animal Rental Details' + _rec_name = 'animal_id' + + name = fields.Char(string='Reference', readonly=True, + default=lambda self: _('New'), copy=False, + help='Field for the sequence of renting entries of ' + 'animals') + farmer_id = fields.Many2one('farmer.detail', string='Farmer', + help='Select the farmer who needs animal.', + required=True, tracking=True) + animal_id = fields.Many2one('animal.detail', string='Animal', + help="Select the animal for renting", + required=True, tracking=True) + no_of_days = fields.Float(string='No of Days', tracking=True, store=True, + help="The number of days we want to rent that" + " animal.", compute='_compute_no_of_days') + start_date = fields.Date(string='Start Date', required=True, tracking=True, + help="Start date of rental period") + company_id = fields.Many2one('res.company', string='Company', + required=True, readonly=True, + default=lambda self: self.env.company, + help='This field represents the company ' + 'associated with the current user or ' + 'environment.') + currency_id = fields.Many2one(related='company_id.currency_id', + string='Currency', help='Currency of company') + amount = fields.Monetary(string='Amount', help="Rental amount per day", + required=True) + total_amount = fields.Monetary(string='Total Amount', + help="Total rental amount", + compute='_compute_total_amount', + currency_field='currency_id') + end_date = fields.Date(string='End Date', help="End date of rental period", + required=True, tracking=True) + note = fields.Text(string='Description', tracking=True, + help="Description for renting animal", + placeholder='Note') + state = fields.Selection( + [('draft', 'Draft'), ('confirm', 'Confirmed'), ('return', 'Returned'), + ('paid', 'Paid'), ('cancel', 'Cancel')], string='Status', + default='draft', tracking=True, copy=False, + help="Status of renting the animal, Which is th status of the animal " + "rented?") + animal_paid_bool = fields.Boolean(string='Paid Bool', default=False, + copy=False) + + @api.model + def create(self, values): + """Function for creating new animal rental""" + if values.get('name', _('New')) == _('New'): + values['name'] = self.env['ir.sequence'].next_by_code( + 'animal.rental') or _('New') + return super(AnimalRental, self).create(values) + + @api.constrains('start_date', 'end_date') + def _check_dates(self): + for record in self: + if record.start_date and record.end_date: + if record.end_date < record.start_date: + raise ValidationError( + "End date cannot be before start date!") + + @api.depends('no_of_days', 'amount') + def _compute_total_amount(self): + """ Function for compute total amount """ + for record in self: + record.total_amount = record.no_of_days * record.amount + + @api.depends('start_date', 'end_date') + def _compute_no_of_days(self): + """Function for computing rental period based on start date and end + date""" + for record in self: + if record.start_date and record.end_date: + record.no_of_days = (record.end_date - record.start_date).days + + def action_draft(self): + """ Function for change state of animal rental to draft """ + self.state = 'draft' + + def action_confirm(self): + """ Function for change state of crop request to confirm """ + self.state = 'confirm' + + def action_return(self): + """ Function for change state of crop request to cancel """ + self.state = 'return' + + def action_cancel(self): + """ Function for change state of crop request to cancel """ + self.state = 'cancel' + + def action_register_payment(self): + """Method for viewing the wizard for register payment""" + view_id = self.env.ref( + 'agriculture_management_odoo.animal_register_payment_wizard_view_form').id + return { + 'name': 'Register Payment', + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'animal.register.payment.wizard', + 'views': [(view_id, 'form')], + 'context': { + 'default_farmer_id': self.farmer_id.id, + 'default_rental_duration': self.no_of_days, + 'default_amount': self.total_amount, + 'default_ref': self.name + }, + 'target': 'new', + } diff --git a/agriculture_management_odoo/models/crop_animal.py b/agriculture_management_odoo/models/crop_animal.py new file mode 100644 index 000000000..b91fb9c69 --- /dev/null +++ b/agriculture_management_odoo/models/crop_animal.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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' + + dec_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) diff --git a/agriculture_management_odoo/models/crop_machinery.py b/agriculture_management_odoo/models/crop_machinery.py new file mode 100644 index 000000000..e92f14603 --- /dev/null +++ b/agriculture_management_odoo/models/crop_machinery.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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' + + des_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) diff --git a/agriculture_management_odoo/models/crop_request.py b/agriculture_management_odoo/models/crop_request.py new file mode 100644 index 000000000..5c9a55984 --- /dev/null +++ b/agriculture_management_odoo/models/crop_request.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 Details" + _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") + machinery_ids = fields.One2many('crop.machinery', + 'des_id', string='Machinery', + tracking=True, help="The machinery required" + "for this farming") + animal_ids = fields.One2many('crop.animal', + 'dec_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') + res = super(CropRequest, self).create(values) + return res + + 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): + """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] diff --git a/agriculture_management_odoo/models/damage_loss.py b/agriculture_management_odoo/models/damage_loss.py new file mode 100644 index 000000000..e94c8d89b --- /dev/null +++ b/agriculture_management_odoo/models/damage_loss.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import fields, models + + +class DamageLoss(models.Model): + """This model represents details about damage and loss incidents. + It provides a structured way to record information related to damages and + losses incurred in the context of agricultural activities or other domains. + """ + _name = 'damage.loss' + _description = 'Damage Loss Details' + _inherit = ["mail.thread", 'mail.activity.mixin'] + + name = fields.Char(string='Name', help="Reason for damage or loss of crop ", + required=True, tracking=True) + farmer_id = fields.Many2one('farmer.detail', + help=" Mention the corresponding Farmer", + string='Farmer', required=True, tracking=True) + crop_id = fields.Many2one('crop.request', + help="Mention the corresponding crop", + string='Crop', required=True, tracking=True) + location_id = fields.Many2one('location.detail', tracking=True, + string='Location', help="The location of the " + "damage or loss takes place", + required=True) + damage_loss_type = fields.Selection([('damage', 'Damage'), + ('loss', 'Loss')], + string='Damage/Loss Type', + help="Mention the damage or lass type", + required=True, tracking=True) + damage_loss_date = fields.Date(string='Damage/Loss Date', + help="The date in which damage occurs", + default=fields.Date.context_today, + required=True, tracking=True) + note = fields.Text(string='Damage/Loss Description', tracking=True, + help="Describe the details of damage/loss") + damage_loss_image = fields.Binary(string='Image', tracking=True, + help="Upload some images of damage/loss") + 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) diff --git a/agriculture_management_odoo/models/farmer_detail.py b/agriculture_management_odoo/models/farmer_detail.py new file mode 100644 index 000000000..7ef47d57b --- /dev/null +++ b/agriculture_management_odoo/models/farmer_detail.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 Details In Agriculture Management' + _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', tracking=True, + help='Upload image of Farmer') + note = fields.Text(string='Notes', tracking=True, + help="Description regarding the farmer") + 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 diff --git a/agriculture_management_odoo/models/fleet_vehicle.py b/agriculture_management_odoo/models/fleet_vehicle.py new file mode 100644 index 000000000..3d1228809 --- /dev/null +++ b/agriculture_management_odoo/models/fleet_vehicle.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import fields, models + + +class FleetVehicle(models.Model): + """ This model inherits from the 'fleet.vehicle' model to extend and + utilize the existing functionality for managing vehicle details. It provides + a structured way to access and utilize vehicle information within a fleet + management context.""" + _inherit = "fleet.vehicle" + + registration_date = fields.Date(string="Registration Date", + default=fields.Date.today, help="The" + "Registration date of the vehicle") diff --git a/agriculture_management_odoo/models/location_detail.py b/agriculture_management_odoo/models/location_detail.py new file mode 100644 index 000000000..5bbe9381d --- /dev/null +++ b/agriculture_management_odoo/models/location_detail.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 In Agriculture 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') + 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) diff --git a/agriculture_management_odoo/models/pest_detail.py b/agriculture_management_odoo/models/pest_detail.py new file mode 100644 index 000000000..ca99e8655 --- /dev/null +++ b/agriculture_management_odoo/models/pest_detail.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 In Agriculture Management' + _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 diff --git a/agriculture_management_odoo/models/pest_request.py b/agriculture_management_odoo/models/pest_request.py new file mode 100644 index 000000000..22db74727 --- /dev/null +++ b/agriculture_management_odoo/models/pest_request.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import api, fields, models, _ + + +class PestRequest(models.Model): + """ This model represents requests related to pest management within the + context of agriculture. It provides a structured way to initiate and manage + requests for pest control measures, treatments, and interventions.""" + _name = 'pest.request' + _inherit = ["mail.thread", 'mail.activity.mixin'] + _description = 'Pest Request In Agriculture Management' + _rec_name = 'reference' + + reference = fields.Char(string='Reference', help='Mention the details of ' + 'pesticide request', + copy=False, readonly=True, tracking=True, + default=lambda self: _('New')) + request_date = fields.Date(string='Request Date', tracking=True, + help='The date the pesticide request was sent.', + default=fields.Date.context_today, required=True) + farmer_id = fields.Many2one('res.partner', string='Farmer', + help='Mention the corresponding farmer that ' + 'request send', required=True, + tracking=True) + crop_id = fields.Many2one('crop.request', string='Crop', + help='Mention the corresponding crop the ' + 'pesticide needed', required=True, + tracking=True) + location_id = fields.Many2one('location.detail', + help='Location of details crop and farming', + tracking=True, string='Location') + pest_id = fields.Many2one('pest.detail', string='Pest', + help='Mention the pesticide name Required ', + required=True, tracking=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', string='Currency', + help='Currency used by the company', + default=lambda + self: self.env.user.company_id.currency_id) + pest_quantity = fields.Integer(string='Pest Quantity', tracking=True, + help='The quantity of pesticide that is' + 'required to be purchased', + required=True) + pest_cost = fields.Float(string='Pest Cost', required=True, + help="The unit price of the pesticide", + tracking=True, related='pest_id.pest_cost') + total_cost = fields.Float(string='Total Cost', tracking=True, store=True, + help="The total cost of the pesticide that was " + "purchased.", compute='_compute_total_cost') + disease = fields.Text(string='Disease', tracking=True, required=True, + help="The corresponding disease of crop") + note = fields.Text(string='Note', tracking=True, + help="Please describe any additional details here if " + "there is a need to mention additional data.") + state = fields.Selection( + [('draft', 'Draft'), ('pending', 'Pending'), ('approve', 'Approved'), + ('rejected', 'Rejected')], help=" The status of pesticide request", + string='Status', default='draft', tracking=True) + + def action_draft(self): + """ Function for change state of crop request to cancel """ + self.state = 'draft' + + def action_pending(self): + """ Function for change state of pest request to pending """ + self.state = 'pending' + + def action_approved(self): + """ Function for change state of pest request to approve """ + self.state = 'approve' + + def action_rejected(self): + """ Function for change state of pest request to rejected """ + self.state = 'rejected' + + @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 + + @api.model + def create(self, values): + """ Function for create new pest request """ + if values.get('reference', _('New')) == _('New'): + values['reference'] = self.env['ir.sequence'].next_by_code( + 'pest.request') or _('New') + res = super(PestRequest, self).create(values) + return res diff --git a/agriculture_management_odoo/models/seed_detail.py b/agriculture_management_odoo/models/seed_detail.py new file mode 100644 index 000000000..14c214abe --- /dev/null +++ b/agriculture_management_odoo/models/seed_detail.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 Details In Agriculture Management" + + 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.") + 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) diff --git a/agriculture_management_odoo/models/vehicle_detail.py b/agriculture_management_odoo/models/vehicle_detail.py new file mode 100644 index 000000000..93ddb1b5c --- /dev/null +++ b/agriculture_management_odoo/models/vehicle_detail.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +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 IN Agriculture Management" + _rec_name = 'name' + + name = fields.Char(string='Name', tracking=True, readonly=True, + help="Mention the name of vehicle chose", + compute='_compute_vehicle_name') + 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.") + 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.depends("vehicle_main_id") + def _compute_vehicle_name(self): + """Function for auto update the name of vehicle based on model and + brand""" + for ref in self: + ref.name = str( + ref.vehicle_main_id.model_id.brand_id.name or " ") + "/" + str( + ref.vehicle_main_id.model_id.name or " ") + "/" + str( + ref.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) diff --git a/agriculture_management_odoo/models/vehicle_rental.py b/agriculture_management_odoo/models/vehicle_rental.py new file mode 100644 index 000000000..26e1fe507 --- /dev/null +++ b/agriculture_management_odoo/models/vehicle_rental.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class VehicleRental(models.Model): + """This model represents details about vehicle rentals within the + context of agriculture management. It provides a structured way to manage + information related to renting vehicles for agricultural tasks.""" + _name = 'vehicle.rental' + _inherit = ['mail.thread', 'mail.activity.mixin'] + _description = 'Vehicle Rental Details' + _rec_name = 'vehicle_id' + + name = fields.Char(string='Reference', readonly=True, + default=lambda self: _('New'), copy=False, + help='Field for the sequence of renting entries of ' + 'vehicles.') + farmer_id = fields.Many2one('farmer.detail', string='Farmer', + help='Select the farmer who needs vehicle.', + required=True, tracking=True) + vehicle_id = fields.Many2one('vehicle.detail', + help="Select the vehicle that used for farming", + string='Vehicle', required=True, tracking=True) + no_of_days = fields.Float(string='No of Days', compute='_compute_no_of_days', + help="The number of days we want to rent that " + "vehicle.", tracking=True, store=True) + start_date = fields.Date(string='Start Date', tracking=True, + help=" Start date of rental period", required=True) + end_date = fields.Date(string='End Date', help="End date of rental period", + required=True, tracking=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(related='company_id.currency_id', + string='Currency', help='Currency of company') + amount = fields.Monetary(string='Amount', help="Rental amount per day", + required=True) + total_amount = fields.Monetary(string='Total Amount', + help="Total rental amount", + compute='_compute_total_amount', + currency_field='currency_id') + note = fields.Text(string='Description', tracking=True, + help="Please describe any additional details here if " + "there is a need to mention additional data.", + placeholder='Note') + state = fields.Selection( + [('draft', 'Draft'), ('confirm', 'Confirmed'), ('return', 'Returned'), + ('paid', 'Paid'), ('cancel', 'Cancel')], string='Status', + default='draft', tracking=True, copy=False, + help="Status of renting the vehicle, Which is th status of the vehicle " + "rented?") + vehicle_paid_bool = fields.Boolean(string='Paid Bool', default=False, + copy=False) + + @api.model + def create(self, values): + """Function for creating new animal rental""" + if values.get('name', _('New')) == _('New'): + values['name'] = self.env['ir.sequence'].next_by_code( + 'vehicle.rental') or _('New') + return super(VehicleRental, self).create(values) + + @api.constrains('start_date', 'end_date') + def _check_dates(self): + for record in self: + if record.start_date and record.end_date: + if record.end_date < record.start_date: + raise ValidationError( + "End date cannot be before start date!") + + @api.depends('no_of_days', 'amount') + def _compute_total_amount(self): + """ Function for compute total amount """ + for record in self: + record.total_amount = record.no_of_days * record.amount + + @api.depends('start_date', 'end_date') + def _compute_no_of_days(self): + """Function for calculating the rental period based start date and + end date""" + for record in self: + if record.start_date and record.end_date: + record.no_of_days = (record.end_date - record.start_date).days + + def action_draft(self): + """ Function for change state of animal rental to draft """ + self.state = 'draft' + + def action_confirm(self): + """ Function for change state of crop request to confirm """ + self.state = 'confirm' + + def action_return(self): + """ Function for change state of crop request to cancel """ + self.state = 'return' + + def action_cancel(self): + """ Function for change state of crop request to cancel """ + self.state = 'cancel' + + def action_register_payment(self): + """Method for viewing the wizard for register payment""" + view_id = self.env.ref( + 'agriculture_management_odoo.vehicle_register_payment_wizard_view_form').id + return { + 'name': 'Register Payment', + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'vehicle.register.payment.wizard', + 'views': [(view_id, 'form')], + 'context': { + 'default_farmer_id': self.farmer_id.id, + 'default_rental_duration': self.no_of_days, + 'default_amount': self.total_amount, + 'default_ref': self.name + }, + 'target': 'new', + } diff --git a/agriculture_management_odoo/report/crop_animal_reports.xml b/agriculture_management_odoo/report/crop_animal_reports.xml new file mode 100644 index 000000000..35eeff004 --- /dev/null +++ b/agriculture_management_odoo/report/crop_animal_reports.xml @@ -0,0 +1,13 @@ + + + + + Animal Crop Report + crop.request + qweb-pdf + agriculture_management_odoo.animal_crop + agriculture_management_odoo.animal_crop + + report + + diff --git a/agriculture_management_odoo/report/crop_animal_templates.xml b/agriculture_management_odoo/report/crop_animal_templates.xml new file mode 100644 index 000000000..089a4b4ab --- /dev/null +++ b/agriculture_management_odoo/report/crop_animal_templates.xml @@ -0,0 +1,72 @@ + + + + + diff --git a/agriculture_management_odoo/report/crop_request_reports.xml b/agriculture_management_odoo/report/crop_request_reports.xml new file mode 100644 index 000000000..c66d2e5cd --- /dev/null +++ b/agriculture_management_odoo/report/crop_request_reports.xml @@ -0,0 +1,13 @@ + + + + + Crop Report + crop.report + qweb-pdf + agriculture_management_odoo.report_crop_details + agriculture_management_odoo.report_crop_details + + report + + diff --git a/agriculture_management_odoo/report/crop_request_templates.xml b/agriculture_management_odoo/report/crop_request_templates.xml new file mode 100644 index 000000000..37f1668fe --- /dev/null +++ b/agriculture_management_odoo/report/crop_request_templates.xml @@ -0,0 +1,90 @@ + + + + + diff --git a/agriculture_management_odoo/report/crop_vehicle_reports.xml b/agriculture_management_odoo/report/crop_vehicle_reports.xml new file mode 100644 index 000000000..50a2d1538 --- /dev/null +++ b/agriculture_management_odoo/report/crop_vehicle_reports.xml @@ -0,0 +1,13 @@ + + + + + Vehicle Crop Report + crop.request + qweb-pdf + agriculture_management_odoo.vehicle_crop + agriculture_management_odoo.vehicle_crop + + report + + diff --git a/agriculture_management_odoo/report/crop_vehicle_templates.xml b/agriculture_management_odoo/report/crop_vehicle_templates.xml new file mode 100644 index 000000000..00f9367f4 --- /dev/null +++ b/agriculture_management_odoo/report/crop_vehicle_templates.xml @@ -0,0 +1,71 @@ + + + + + diff --git a/agriculture_management_odoo/report/pest_request_reports.xml b/agriculture_management_odoo/report/pest_request_reports.xml new file mode 100644 index 000000000..bcc777a0d --- /dev/null +++ b/agriculture_management_odoo/report/pest_request_reports.xml @@ -0,0 +1,13 @@ + + + + + pest Report + pest.report + qweb-pdf + agriculture_management_odoo.report_pest_detail + agriculture_management_odoo.report_pest_detail + + report + + diff --git a/agriculture_management_odoo/report/pest_request_templates.xml b/agriculture_management_odoo/report/pest_request_templates.xml new file mode 100644 index 000000000..659b8671f --- /dev/null +++ b/agriculture_management_odoo/report/pest_request_templates.xml @@ -0,0 +1,111 @@ + + + + + diff --git a/agriculture_management_odoo/security/agriculture_management_groups.xml b/agriculture_management_odoo/security/agriculture_management_groups.xml new file mode 100644 index 000000000..2fe7270f1 --- /dev/null +++ b/agriculture_management_odoo/security/agriculture_management_groups.xml @@ -0,0 +1,17 @@ + + + + + Agriculture Management + Category for Agriculture + + + User + + + + Manager + + + + diff --git a/agriculture_management_odoo/security/crop_request_security.xml b/agriculture_management_odoo/security/crop_request_security.xml new file mode 100644 index 000000000..318be7edc --- /dev/null +++ b/agriculture_management_odoo/security/crop_request_security.xml @@ -0,0 +1,85 @@ + + + + + View Own Docs + + ['|',('user_id', '=', user.id),('create_uid', + '=', user.id)] + + + + + View All Docs + + [(1, '=', 1)] + + + + Crop Request multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Animal Rental multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Animal Details multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Crop Animal multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Crop Machinery multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Damage Loss multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Farmer Detail multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Location Detail multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Pest Detail multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Pest Request multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Seed Detail multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Vehicle Detail multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Vehicle Rental multi company rule + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + diff --git a/agriculture_management_odoo/security/ir.model.access.csv b/agriculture_management_odoo/security/ir.model.access.csv new file mode 100644 index 000000000..9d410c758 --- /dev/null +++ b/agriculture_management_odoo/security/ir.model.access.csv @@ -0,0 +1,35 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_crop_request_admin,access.crop.request,model_crop_request,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_crop_request_user,access.crop.request,model_crop_request,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_seed_detail_admin,access.seed.detail,model_seed_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_seed_detail_user,access.seed.detail,model_seed_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_animal_detail_admin,access.animal.detail,model_animal_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_animal_detail,access.animal.detail,model_animal_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_location_detail_admin,access.location.detail,model_location_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_location_detail,access.location.detail,model_location_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_vehicle_detail_admin,access.vehicle.detail,model_vehicle_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_vehicle_detail,access.vehicle.detail,model_vehicle_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_farmer_detail_admin,access.farmer.detail,model_farmer_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_farmer_detail,access.farmer.detail,model_farmer_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_pest_request,_adminaccess.pest.request,model_pest_request,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_pest_request,access.pest.request,model_pest_request,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_pest_detail_admin,access.pest.detail,model_pest_detail,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_pest_detail,access.pest.detail,model_pest_detail,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_damage_loss_admin,access.damage.loss,model_damage_loss,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_damage_loss,access.damage.loss,model_damage_loss,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_crop_machinery_admin,access.crop.machinery,model_crop_machinery,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_crop_machinery,access.crop.machinery,model_crop_machinery,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_crop_animal_admin,access.crop.animal,model_crop_animal,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_crop_animal,access.crop.animal,model_crop_animal,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_agriculture_tag_admin,access.agriculture.tag,model_agriculture_tag,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_agriculture_tag,access.agriculture.tag,model_agriculture_tag,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_vehicle_rental_admin,access.vehicle.rental,model_vehicle_rental,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_vehicle_rental,access.vehicle.rental,model_vehicle_rental,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_animal_rental_admin,access.animal.rental,model_animal_rental,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_animal_rental,access.animal.rental,model_animal_rental,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_crop_report_admin,access.crop.report,model_crop_report,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_crop_report,access.crop.report,model_crop_report,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_pest_report_admin,access.pest.report,model_pest_report,agriculture_management_odoo.group_agriculture_admin,1,1,1,1 +access_pest_report,access.pest.report,model_pest_report,agriculture_management_odoo.group_agriculture_user,1,1,1,0 +access_animal_register_payment_wizard,access.animal.register.payment.wizard,model_animal_register_payment_wizard,base.group_user,1,1,1,1 +access_vehicle_register_payment_wizard,access.vehicle.register.payment.wizard,model_vehicle_register_payment_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/agriculture_management_odoo/static/description/assets/icons/check.png b/agriculture_management_odoo/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/check.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/chevron.png b/agriculture_management_odoo/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/chevron.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/cogs.png b/agriculture_management_odoo/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/cogs.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/consultation.png b/agriculture_management_odoo/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/consultation.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/ecom-black.png b/agriculture_management_odoo/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/ecom-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/education-black.png b/agriculture_management_odoo/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/education-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/hotel-black.png b/agriculture_management_odoo/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/hotel-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/license.png b/agriculture_management_odoo/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/license.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/lifebuoy.png b/agriculture_management_odoo/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/lifebuoy.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/logo.png b/agriculture_management_odoo/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/logo.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/manufacturing-black.png b/agriculture_management_odoo/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/manufacturing-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/pos-black.png b/agriculture_management_odoo/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/pos-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/puzzle.png b/agriculture_management_odoo/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/puzzle.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/restaurant-black.png b/agriculture_management_odoo/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/restaurant-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/service-black.png b/agriculture_management_odoo/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/service-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/trading-black.png b/agriculture_management_odoo/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/trading-black.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/training.png b/agriculture_management_odoo/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/training.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/update.png b/agriculture_management_odoo/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/update.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/user.png b/agriculture_management_odoo/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/user.png differ diff --git a/agriculture_management_odoo/static/description/assets/icons/wrench.png b/agriculture_management_odoo/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/icons/wrench.png differ diff --git a/agriculture_management_odoo/static/description/assets/modules/module_image (1).png b/agriculture_management_odoo/static/description/assets/modules/module_image (1).png new file mode 100644 index 000000000..de0c2ef12 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/modules/module_image (1).png differ diff --git a/agriculture_management_odoo/static/description/assets/modules/module_image (2).png b/agriculture_management_odoo/static/description/assets/modules/module_image (2).png new file mode 100644 index 000000000..77be44d63 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/modules/module_image (2).png differ diff --git a/agriculture_management_odoo/static/description/assets/modules/module_image (4).png b/agriculture_management_odoo/static/description/assets/modules/module_image (4).png new file mode 100644 index 000000000..d62e74a72 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/modules/module_image (4).png differ diff --git a/agriculture_management_odoo/static/description/assets/modules/module_image.jpeg b/agriculture_management_odoo/static/description/assets/modules/module_image.jpeg new file mode 100644 index 000000000..43123c0e2 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/modules/module_image.jpeg differ diff --git a/agriculture_management_odoo/static/description/assets/modules/module_image.png b/agriculture_management_odoo/static/description/assets/modules/module_image.png new file mode 100644 index 000000000..e29d7e316 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/modules/module_image.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_conf_3.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_conf_3.png new file mode 100644 index 000000000..363686bb0 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_conf_3.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_crop_4.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_crop_4.png new file mode 100644 index 000000000..f1023ddaf Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_crop_4.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_manager_1.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_manager_1.png new file mode 100644 index 000000000..e4118af0f Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_manager_1.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_user_2.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_user_2.png new file mode 100644 index 000000000..4e51b4cd3 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_user_2.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_repor_6.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_repor_6.png new file mode 100644 index 000000000..f2a5c9334 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_repor_6.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_report_print_5.png b/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_report_print_5.png new file mode 100644 index 000000000..c10febd5c Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/agr_vehicle_report_print_5.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/animal_rental_10.png b/agriculture_management_odoo/static/description/assets/screenshots/animal_rental_10.png new file mode 100644 index 000000000..f3f53501d Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/animal_rental_10.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/animal_repor_8.png b/agriculture_management_odoo/static/description/assets/screenshots/animal_repor_8.png new file mode 100644 index 000000000..a276a0f74 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/animal_repor_8.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/animal_report_print_7.png b/agriculture_management_odoo/static/description/assets/screenshots/animal_report_print_7.png new file mode 100644 index 000000000..d86ba02e1 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/animal_report_print_7.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/damage_loss_11.png b/agriculture_management_odoo/static/description/assets/screenshots/damage_loss_11.png new file mode 100644 index 000000000..eb40d2a55 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/damage_loss_11.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/hero.gif b/agriculture_management_odoo/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..daeb1f4d7 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/hero.gif differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/main_rep_pdf_out_16.png b/agriculture_management_odoo/static/description/assets/screenshots/main_rep_pdf_out_16.png new file mode 100644 index 000000000..26dc73248 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/main_rep_pdf_out_16.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/main_report_14.png b/agriculture_management_odoo/static/description/assets/screenshots/main_report_14.png new file mode 100644 index 000000000..5535beba4 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/main_report_14.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/pest_details_13.png b/agriculture_management_odoo/static/description/assets/screenshots/pest_details_13.png new file mode 100644 index 000000000..d94936876 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/pest_details_13.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/pest_req_12.png b/agriculture_management_odoo/static/description/assets/screenshots/pest_req_12.png new file mode 100644 index 000000000..b91644ac1 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/pest_req_12.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/rental_veh_9.png b/agriculture_management_odoo/static/description/assets/screenshots/rental_veh_9.png new file mode 100644 index 000000000..4b9f7a91c Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/rental_veh_9.png differ diff --git a/agriculture_management_odoo/static/description/assets/screenshots/report_wiz_15.png b/agriculture_management_odoo/static/description/assets/screenshots/report_wiz_15.png new file mode 100644 index 000000000..a1d07a041 Binary files /dev/null and b/agriculture_management_odoo/static/description/assets/screenshots/report_wiz_15.png differ diff --git a/agriculture_management_odoo/static/description/banner.png b/agriculture_management_odoo/static/description/banner.png new file mode 100644 index 000000000..e6ec5c0e8 Binary files /dev/null and b/agriculture_management_odoo/static/description/banner.png differ diff --git a/agriculture_management_odoo/static/description/icon.png b/agriculture_management_odoo/static/description/icon.png new file mode 100644 index 000000000..266f7a6cd Binary files /dev/null and b/agriculture_management_odoo/static/description/icon.png differ diff --git a/agriculture_management_odoo/static/description/index.html b/agriculture_management_odoo/static/description/index.html new file mode 100644 index 000000000..f443b074e --- /dev/null +++ b/agriculture_management_odoo/static/description/index.html @@ -0,0 +1,683 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+ +
+
+
+

+ Agriculture Management

+

+ A Module For Managing Agriculture. +

+ +
+
+ + + +
+
+

+ Overview +

+
+ +
+

+ In the Agriculture Management App, We can manage the agriculture to our own need. + We can also manage the rentals of vehicle and animals for agriculture purpose. + We can also customize and hide the fields.

+
+
+ +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Set the Manager and User in settings.

+
+
+ +
+
+ +
+
+

+ Create Crop Requests.

+
+
+ +
+
+ +
+
+

+ Create Rentals for Vehicles and Animals.

+
+
+ +
+
+ +
+
+

+ Create Damage/Loss Report.

+
+
+
+
+ +
+
+

+ Create Pesticide Request and Can View the Pesticide Details.

+
+
+
+
+ +
+
+

+ Create Total Crop Request Report.

+
+
+
+
+
+

+ Screenshots +

+
+
+

+ Provide User Access

+

+ In Settings, user can have Manager access which is overall access and another one is User access. + layout

+ + +
+
+

+ Configuration

+

+ User can create Seed, Farmers, Vehicles, Animals, Locations and Tags used for creating Crop Request. +

+ +
+ +
+

+ Create Crop Request using created values in configuration.

+ +
+
+

+ User can print report of current record of used vehicles.

+ +
+
+

+ Report view of used vehicle report.

+ +
+
+

+ User Can Print Report Of Current Record of Used Animals.

+ +
+ +
+

+ Report View Of Used Animal Report.

+ +
+ +
+

+ User Can Rent The Vehicles.

+ +
+ +
+

+ User Can Rent The Animals.

+ +
+ +
+

+ User Can Submit Damage/ Loss of the Crops.

+ +
+ +
+

+ User Can Request Pesticide For The Crops.

+ +
+ +
+

+ User Can Create and View Pesticides Available.

+ +
+ +
+

+ User Can Take The Crop Request Report.

+ +
+ +
+

+ Enter The Date Range To Print Report.

+ +
+ +
+

+ Report View Of Crop Request.

+ +
+ +
+ +
+
+

Suggested Products

+
+ + +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ + + + + +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
\ No newline at end of file diff --git a/agriculture_management_odoo/views/agriculture_management_menus.xml b/agriculture_management_odoo/views/agriculture_management_menus.xml new file mode 100644 index 000000000..933bb1bc8 --- /dev/null +++ b/agriculture_management_odoo/views/agriculture_management_menus.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/agriculture_management_odoo/views/agriculture_tag_views.xml b/agriculture_management_odoo/views/agriculture_tag_views.xml new file mode 100644 index 000000000..65715ef63 --- /dev/null +++ b/agriculture_management_odoo/views/agriculture_tag_views.xml @@ -0,0 +1,50 @@ + + + + + agriculture.tag.view.form + agriculture.tag + +
+ +
+
+ + + + + +
+
+
+
+ + + agriculture.tag.view.tree + agriculture.tag + + + + + + + + + + Tags + ir.actions.act_window + agriculture.tag + tree,form + {'search_default_available':1} + +

+ Create Your First Tag +

+
+
+
diff --git a/agriculture_management_odoo/views/animal_detail_views.xml b/agriculture_management_odoo/views/animal_detail_views.xml new file mode 100644 index 000000000..d4687f055 --- /dev/null +++ b/agriculture_management_odoo/views/animal_detail_views.xml @@ -0,0 +1,68 @@ + + + + + animal.detail.view.tree + animal.detail + + + + + + + + + + + animal.detail.view.form + animal.detail + +
+
+
+ +

+ +

+ + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Animals + ir.actions.act_window + animal.detail + tree,form + {'search_default_available':1} + +

+ Create Your First Animal +

+
+
+
diff --git a/agriculture_management_odoo/views/animal_rental_views.xml b/agriculture_management_odoo/views/animal_rental_views.xml new file mode 100644 index 000000000..eb98f29c0 --- /dev/null +++ b/agriculture_management_odoo/views/animal_rental_views.xml @@ -0,0 +1,93 @@ + + + + + animal.rental.view.tree + animal.rental + + + + + + + + + + + + + animal.rental.view.form + animal.rental + +
+
+
+ + +

+ +

+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Animal Rental + ir.actions.act_window + animal.rental + tree,form,kanban + {'search_default_available':1} + +

+ Create Your First Animal Rental Request +

+
+
+
diff --git a/agriculture_management_odoo/views/crop_request_views.xml b/agriculture_management_odoo/views/crop_request_views.xml new file mode 100644 index 000000000..cf739c1f3 --- /dev/null +++ b/agriculture_management_odoo/views/crop_request_views.xml @@ -0,0 +1,163 @@ + + + + + crop.request.view.kanban + crop.request + + + + + + + + + + +
+
+ + +
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+
+
+ + + crop.request.view.tree + crop.request + + + + + + + + + + + + + crop.request.view.form + crop.request + +
+
+
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + Crops Details Action + ir.actions.act_window + crop.request + kanban,tree,form + {'search_default_available':1} + +

+ Create Your First Crop Request +

+
+
+
diff --git a/agriculture_management_odoo/views/damage_loss_views.xml b/agriculture_management_odoo/views/damage_loss_views.xml new file mode 100644 index 000000000..adafb4cdd --- /dev/null +++ b/agriculture_management_odoo/views/damage_loss_views.xml @@ -0,0 +1,64 @@ + + + + + damage.loss.view.tree + damage.loss + + + + + + + + + + + + + + damage.loss.view.form + damage.loss + +
+ +

+ +

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Damage and Loss + ir.actions.act_window + damage.loss + tree,form + {'search_default_available':1} + +

+ Create Your First Damage and Loss +

+
+
+
diff --git a/agriculture_management_odoo/views/farmer_detail_views.xml b/agriculture_management_odoo/views/farmer_detail_views.xml new file mode 100644 index 000000000..2293b415e --- /dev/null +++ b/agriculture_management_odoo/views/farmer_detail_views.xml @@ -0,0 +1,79 @@ + + + + + farmer.detail.view.kanban + farmer.detail + + + + + + +
+
+
    + + +
    + + +
    +
    + +
    +
    +
    +
+
+
+
+
+
+
+
+ + + farmer.detail.view.form + farmer.detail + +
+ + + + + + + + + + + + +
+ + + +
+
+
+
+ + + Farmers + ir.actions.act_window + farmer.detail + kanban,form,tree + {'search_default_available':1} + +

+ Create Your First Farmer +

+
+
+
diff --git a/agriculture_management_odoo/views/fleet_vehicle_views.xml b/agriculture_management_odoo/views/fleet_vehicle_views.xml new file mode 100644 index 000000000..7dfa971ad --- /dev/null +++ b/agriculture_management_odoo/views/fleet_vehicle_views.xml @@ -0,0 +1,19 @@ + + + + + fleet.vehicle.inherit.agriculture.management + fleet.vehicle + + + + + + + + + + + diff --git a/agriculture_management_odoo/views/location_detail_views.xml b/agriculture_management_odoo/views/location_detail_views.xml new file mode 100644 index 000000000..ed63e7a50 --- /dev/null +++ b/agriculture_management_odoo/views/location_detail_views.xml @@ -0,0 +1,61 @@ + + + + + location.detail.view.tree + location.detail + + + + + + + + + + + + + location.detail.view.form + location.detail + +
+ +

+ +

+ + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Locations + ir.actions.act_window + location.detail + tree,form + {'search_default_available':1} + +

+ Create Your First Location +

+
+
+
diff --git a/agriculture_management_odoo/views/pest_detail_views.xml b/agriculture_management_odoo/views/pest_detail_views.xml new file mode 100644 index 000000000..58a5251bf --- /dev/null +++ b/agriculture_management_odoo/views/pest_detail_views.xml @@ -0,0 +1,67 @@ + + + + + pest.detail.view.tree + pest.detail + + + + + + + + + + + + + + pest.detail.view.form + pest.detail + +
+ + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + Pesticide Details + ir.actions.act_window + pest.detail + tree,form + {'search_default_available':1} + +

+ Create Your First Pesticide +

+
+
+
diff --git a/agriculture_management_odoo/views/pest_request_views.xml b/agriculture_management_odoo/views/pest_request_views.xml new file mode 100644 index 000000000..a3282a5df --- /dev/null +++ b/agriculture_management_odoo/views/pest_request_views.xml @@ -0,0 +1,94 @@ + + + + + pest.request.view.tree + pest.request + + + + + + + + + + + + + + + + pest.request.view.form + pest.request + +
+
+
+ +

+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Pesticide Request + ir.actions.act_window + pest.request + tree,form + {'search_default_available':1} + +

+ Create Your First Pest Request +

+
+
+
diff --git a/agriculture_management_odoo/views/seed_detail_views.xml b/agriculture_management_odoo/views/seed_detail_views.xml new file mode 100644 index 000000000..7abeb6a78 --- /dev/null +++ b/agriculture_management_odoo/views/seed_detail_views.xml @@ -0,0 +1,60 @@ + + + + + seed.detail.view.tree + seed.detail + + + + + + + + + + + + + seed.detail.view.form + seed.detail + +
+ +

+ Name +

+ + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Seeds + ir.actions.act_window + seed.detail + tree,form + {'search_default_available':1} + +

+ Create Your First Seed +

+
+
+
diff --git a/agriculture_management_odoo/views/vehicle_detail_views.xml b/agriculture_management_odoo/views/vehicle_detail_views.xml new file mode 100644 index 000000000..aa4161eb6 --- /dev/null +++ b/agriculture_management_odoo/views/vehicle_detail_views.xml @@ -0,0 +1,59 @@ + + + + + vehicle.detail.view.tree + vehicle.detail + + + + + + + + + + + + vehicle.detail.view.form + vehicle.detail + +
+ +

+ +

+ + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Vehicles + ir.actions.act_window + vehicle.detail + tree,form + {'search_default_available':1} + +

+ Create Your First Vehicle +

+
+
+
diff --git a/agriculture_management_odoo/views/vehicle_rental_views.xml b/agriculture_management_odoo/views/vehicle_rental_views.xml new file mode 100644 index 000000000..c9dabd168 --- /dev/null +++ b/agriculture_management_odoo/views/vehicle_rental_views.xml @@ -0,0 +1,94 @@ + + + + + vehicle.rental.view.tree + vehicle.rental + + + + + + + + + + + + + vehicle.rental.view.form + vehicle.rental + +
+
+
+ + +

+ +

+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + + Vehicle Rental + ir.actions.act_window + vehicle.rental + tree,form,kanban + {'search_default_available':1} + +

+ Create Your First Vehicle Rental Request +

+
+
+
diff --git a/agriculture_management_odoo/wizard/__init__.py b/agriculture_management_odoo/wizard/__init__.py new file mode 100644 index 000000000..dd0da596b --- /dev/null +++ b/agriculture_management_odoo/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from . import crop_report +from . import pest_report +from . import animal_register_payment +from . import vehicle_register_payment diff --git a/agriculture_management_odoo/wizard/animal_register_payment.py b/agriculture_management_odoo/wizard/animal_register_payment.py new file mode 100755 index 000000000..14857a567 --- /dev/null +++ b/agriculture_management_odoo/wizard/animal_register_payment.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import fields, models + + +class AnimalRegisterPayment(models.TransientModel): + """Details for a payment for animal rental""" + _name = 'animal.register.payment.wizard' + _description = 'Register Payment' + + farmer_id = fields.Many2one('farmer.detail', string='Partner', + help='Name of partner to register the payment') + rental_duration = fields.Float(string='Duration', + help='Duration of the parking vehicle') + amount = fields.Float(string='Amount', help='Amount of the parking vehicle') + ref = fields.Char(string='Reference', + help='Reference to the parking ticket') + date = fields.Date(string='Date', default=fields.Date.context_today, + help='Date when payment was made') + + def animal_rent_payment(self): + """Returns the amount of the rental of vehicle for the customer.""" + active_id = self._context.get('active_id') + active_record = self.env['animal.rental'].browse(active_id) + payment = self.env['account.payment'].create({ + 'payment_type': 'inbound', + 'partner_id': self.farmer_id.id, + 'amount': self.amount, + 'ref': self.ref, + }) + payment.action_post() + active_record.animal_paid_bool = True + active_record.state = 'paid' diff --git a/agriculture_management_odoo/wizard/animal_register_payment_views.xml b/agriculture_management_odoo/wizard/animal_register_payment_views.xml new file mode 100755 index 000000000..294e43550 --- /dev/null +++ b/agriculture_management_odoo/wizard/animal_register_payment_views.xml @@ -0,0 +1,27 @@ + + + + + animal.register.payment.wizard.view.form + animal.register.payment.wizard + +
+ + + + + + + + + + + +
+
+
+
+
+
diff --git a/agriculture_management_odoo/wizard/crop_report.py b/agriculture_management_odoo/wizard/crop_report.py new file mode 100644 index 000000000..899fcfd6a --- /dev/null +++ b/agriculture_management_odoo/wizard/crop_report.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo.exceptions import UserError +from odoo import fields, models, _ + + +class CropReport(models.TransientModel): + """ Model for creating report for crop request """ + _name = 'crop.report' + _description = 'Crop Report In Crop Request' + + date_from = fields.Date(string='From Date', help=' Start date of report') + date_to = fields.Date(string='To Date', help='End date of report') + + def action_pdf_report(self): + """ Function for crop request pdf report """ + ret = """select crop_request.ref, res_partner.name, + seed_detail.name, crop_request.request_date, + crop_request.state, + location_detail.location_name from crop_request + inner join farmer_detail ON + crop_request.farmer_id = farmer_detail.id + inner join res_partner ON + farmer_detail.farmer_id = res_partner.id + inner join seed_detail ON + crop_request.seed_id = seed_detail.id + inner join location_detail ON + crop_request.location_id = location_detail.id""" + today = fields.Date.today() + if self.date_from and not self.date_to: + if self.date_from > today: + raise UserError( + _('You could not set the start date or ' + 'the end date in the future.')) + else: + ret = ret + """ where crop_request.request_date >= '""" + str( + self.date_from) + """' AND crop_request.request_date <= '""" \ + + str( + today) + """'""" + if self.date_to and not self.date_from: + if self.date_to > today: + raise UserError( + _('You could not set the start date or the end ' + 'date in the future.')) + else: + ret = ret + """ where crop_request.request_date <= '""" + str( + self.date_to) + """'""" + if self.date_from and self.date_to: + if self.date_from <= self.date_to: + ret = ret + """ where crop_request.request_date >= '""" + \ + str(self.date_from) + """' AND crop_request.request_date <= '""" \ + + str(self.date_to) + """'""" + else: + raise UserError( + _('The start date must be inferior to the end date.')) + self.env.cr.execute(ret) + record = self.env.cr.fetchall() + data = { + 'form': self.read()[0], + 'date_to': self.date_to, + 'date_from': self.date_from, + 'record': record + } + return (self.env.ref( + 'agriculture_management_odoo.action_crop_request_report').report_action( + self, data=data)) diff --git a/agriculture_management_odoo/wizard/crop_report_views.xml b/agriculture_management_odoo/wizard/crop_report_views.xml new file mode 100644 index 000000000..d1edf39cb --- /dev/null +++ b/agriculture_management_odoo/wizard/crop_report_views.xml @@ -0,0 +1,35 @@ + + + + + crop.report.view.form + crop.report + +
+ + + + + + + + +
+
+
+
+
+ + + Crop Report + ir.actions.act_window + crop.report + form + + new + +
diff --git a/agriculture_management_odoo/wizard/pest_report.py b/agriculture_management_odoo/wizard/pest_report.py new file mode 100644 index 000000000..c01d5f495 --- /dev/null +++ b/agriculture_management_odoo/wizard/pest_report.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo.exceptions import UserError +from odoo import fields, models, _ + + +class PestReport(models.TransientModel): + """ Model for creating pest request report """ + _name = 'pest.report' + _description = 'Pest Report in Pest Request' + + date_from = fields.Date(string='From Date', help=' Start date of report') + date_to = fields.Date(string='To Date', help=' End date of report') + + def action_pdf_report(self): + """ Function for pest request pdf report """ + ret = """select pest_request.reference, res_partner.name, crop_request.ref, + pest_request.disease, pest_detail.pest_name as pest_name, + pest_detail.pest_cost as cost,pest_request.pest_quantity, + pest_request.total_cost,pest_request.state from pest_request + inner join res_partner on pest_request.farmer_id = res_partner.id + inner join crop_request on crop_request.id = pest_request.crop_id + inner join pest_detail on pest_detail.id = pest_request.pest_id""" + today = fields.Date.today() + if self.date_from and not self.date_to: + if self.date_from > today: + raise UserError( + _('You could not set the start date or the ' + 'end date in the future.')) + else: + ret = ret + """ where pest_request.request_date >= '""" + str( + self.date_from) + """' AND pest_request.request_date <= + '""" \ + + str( + today) + """'""" + if self.date_to and not self.date_from: + if self.date_to > today: + raise UserError( + _('You could not set the start date or the end ' + 'date in the future.')) + else: + ret = ret + """ where pest_request.request_date <= '""" + str( + self.date_to) + """'""" + if self.date_from and self.date_to: + if self.date_from <= self.date_to: + ret = ret + """ where pest_request.request_date >= '""" + \ + str(self.date_from) + """' AND pest_request.request_date + <= '""" \ + + str(self.date_to) + """'""" + else: + raise UserError( + _('The start date must be inferior to the end date.')) + self.env.cr.execute(ret) + record = self.env.cr.fetchall() + data = { + 'form': self.read()[0], + 'date_to': self.date_to, + 'date_from': self.date_from, + 'record': record + } + return self.env.ref( + 'agriculture_management_odoo.pest_request_report_action').report_action( + self, data=data) diff --git a/agriculture_management_odoo/wizard/pest_report_views.xml b/agriculture_management_odoo/wizard/pest_report_views.xml new file mode 100644 index 000000000..daeaeddeb --- /dev/null +++ b/agriculture_management_odoo/wizard/pest_report_views.xml @@ -0,0 +1,35 @@ + + + + + pest.report.view.form + pest.report + +
+ + + + + + + + +
+
+
+
+
+ + + Pest Report + ir.actions.act_window + pest.report + form + + new + +
diff --git a/agriculture_management_odoo/wizard/vehicle_register_payment.py b/agriculture_management_odoo/wizard/vehicle_register_payment.py new file mode 100755 index 000000000..cff1a5170 --- /dev/null +++ b/agriculture_management_odoo/wizard/vehicle_register_payment.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP() +# +# 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 . +# +############################################################################# +from odoo import fields, models + + +class VehicleRegisterPayment(models.TransientModel): + """Details for a payment for vehicle rental""" + _name = 'vehicle.register.payment.wizard' + _description = 'Register Payment' + + farmer_id = fields.Many2one('farmer.detail', string='Partner', + help='Name of partner to register the payment') + rental_duration = fields.Float(string='Duration', + help='Duration of the parking vehicle') + amount = fields.Float(string='Amount', help='Amount of the parking vehicle') + ref = fields.Char(string='Reference', + help='Reference to the parking ticket') + date = fields.Date(string='Date', default=fields.Date.context_today, + help='Date when payment was made') + + def vehicle_rent_payment(self): + """Returns the amount of the rental of vehicle for the customer.""" + active_id = self._context.get('active_id') + active_record = self.env['vehicle.rental'].browse(active_id) + payment = self.env['account.payment'].create({ + 'payment_type': 'inbound', + 'partner_id': self.farmer_id.id, + 'amount': self.amount, + 'ref': self.ref, + }) + payment.action_post() + active_record.vehicle_paid_bool = True + active_record.state = 'paid' diff --git a/agriculture_management_odoo/wizard/vehicle_register_payment_views.xml b/agriculture_management_odoo/wizard/vehicle_register_payment_views.xml new file mode 100755 index 000000000..1239c83f1 --- /dev/null +++ b/agriculture_management_odoo/wizard/vehicle_register_payment_views.xml @@ -0,0 +1,27 @@ + + + + + vehicle.register.payment.wizard.view.form + vehicle.register.payment.wizard + +
+ + + + + + + + + + + + +
+
+
+