@ -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 <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V15)(V16)(V17) Vyshnav AR, |
||||
|
* 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 <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
||||
|
from . import wizard |
@ -0,0 +1,73 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Agriculture Management', |
||||
|
'version': '17.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': ['base','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.jpg'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': True, |
||||
|
} |
||||
|
|
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Record for creating sequence in pest request model--> |
||||
|
<record id="seq_pesticide" model="ir.sequence"> |
||||
|
<field name="name">Pest Request</field> |
||||
|
<field name="code">pest.request</field> |
||||
|
<field name="prefix">PEST/REQ/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="company_id" eval="False"/> |
||||
|
</record> |
||||
|
<!-- Record for creating sequence in crop request model--> |
||||
|
<record id="seq_crop" model="ir.sequence"> |
||||
|
<field name="name">Crop Request</field> |
||||
|
<field name="code">crop.request</field> |
||||
|
<field name="prefix">CROP/REQ/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="company_id" eval="False"/> |
||||
|
</record> |
||||
|
<!-- Record for creating sequence in animal rental model--> |
||||
|
<record id="seq_animal_rental" model="ir.sequence"> |
||||
|
<field name="name">Animal Rental</field> |
||||
|
<field name="code">animal.rental</field> |
||||
|
<field name="prefix">ANIMAL/RENTAL/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="company_id" eval="False"/> |
||||
|
</record> |
||||
|
<!-- Record for creating sequence in vehicle rental model--> |
||||
|
<record id="seq_vehicle_rental" model="ir.sequence"> |
||||
|
<field name="name">Vehicle Rental</field> |
||||
|
<field name="code">vehicle.rental</field> |
||||
|
<field name="prefix">VEHICLE/RENTAL/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="company_id" eval="False"/> |
||||
|
</record> |
||||
|
</data> |
@ -0,0 +1,6 @@ |
|||||
|
## Module <agriculture_management_odoo> |
||||
|
|
||||
|
#### 09.01.2024 |
||||
|
#### Version 17.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial commit for Agriculture Management |
@ -0,0 +1,36 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import agriculture_tag |
||||
|
from . import animal_detail |
||||
|
from . import animal_rental |
||||
|
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 |
@ -0,0 +1,52 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
from random import randint |
||||
|
|
||||
|
|
||||
|
class AgricultureTag(models.Model): |
||||
|
""" This model represents tags related to agriculture. Tags are used to |
||||
|
categorize and label various agricultural elements, products. |
||||
|
They facilitate the organization and grouping of agricultural information |
||||
|
for easier searching and classification. """ |
||||
|
_name = "agriculture.tag" |
||||
|
_description = "Agriculture Tags" |
||||
|
|
||||
|
def _get_default_color(self): |
||||
|
""" The function selects colors for tags, likely based on some |
||||
|
criteria or input, facilitating visual differentiation and |
||||
|
categorization.""" |
||||
|
return randint(1, 11) |
||||
|
|
||||
|
name = fields.Char(string='Tag Name', required=True, translate=True, |
||||
|
help='Tags are helpful for easy identification. Please ' |
||||
|
'create appropriate tags.') |
||||
|
color = fields.Integer(string='Color', default=_get_default_color, |
||||
|
help='Color are helpful for Highlight tags . Please' |
||||
|
'choose different colors for differed tags') |
||||
|
|
||||
|
_sql_constraints = [ |
||||
|
# Partial constraint, complemented by unique tag and name. |
||||
|
# useful to keep because it provides a proper error message when a |
||||
|
# violation occurs |
||||
|
('name_uniq', 'unique (name)', "Tag name already exists !"), |
||||
|
] |
@ -0,0 +1,58 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class AnimalDetail(models.Model): |
||||
|
"""This model represents comprehensive details about animals involved |
||||
|
in agricultural management. It provides a structured way to store |
||||
|
information related to various animal breeds and their attributes.""" |
||||
|
_name = 'animal.detail' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
_description = "Animal Details 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_available(self): |
||||
|
"""Function for change state to available""" |
||||
|
self.state = 'available' |
@ -0,0 +1,132 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class 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") |
||||
|
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') |
||||
|
res = super(AnimalRental, self).create(values) |
||||
|
return res |
||||
|
|
||||
|
@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: |
||||
|
days = (record.end_date - record.start_date).days |
||||
|
record.no_of_days = 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', |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class 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) |
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class CropMachinery(models.Model): |
||||
|
""" This model serves as a bridge to attach machinery details to crop |
||||
|
request records. It provides a structured way to associate machinery-related |
||||
|
information with specific crop requests.""" |
||||
|
_name = 'crop.machinery' |
||||
|
_description = 'Crop Machinery Details' |
||||
|
|
||||
|
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) |
@ -0,0 +1,134 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class CropRequest(models.Model): |
||||
|
""" This model represents the creation of crop requests. It provides a |
||||
|
structured way to initiate and manage requests for crop cultivation tasks, |
||||
|
including associating animals, machinery, and other relevant details.""" |
||||
|
_name = 'crop.request' |
||||
|
_inherit = ["mail.thread", 'mail.activity.mixin'] |
||||
|
_description = "Crop Request 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,states, domain, order): |
||||
|
"""This function takes a list of states and expands them based on the |
||||
|
given domain and order.""" |
||||
|
return [key for |
||||
|
key, val in type(self).state.selection] |
@ -0,0 +1,62 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class 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) |
@ -0,0 +1,54 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class FarmerDetail(models.Model): |
||||
|
"""This model represents comprehensive details about farmers within the |
||||
|
context of agriculture management. It provides a structured way to store |
||||
|
information related to individual farmers, including their personal and |
||||
|
contact details. """ |
||||
|
_name = 'farmer.detail' |
||||
|
_inherit = ["mail.thread", 'mail.activity.mixin'] |
||||
|
_description = 'Farmer 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', copy=False, |
||||
|
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 |
@ -0,0 +1,34 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class 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") |
@ -0,0 +1,58 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class LocationDetail(models.Model): |
||||
|
"""This model represents comprehensive details about locations within |
||||
|
the context of agriculture. It provides a structured way to store |
||||
|
information related to various geographic locations, such as farms, fields, |
||||
|
or storage areas. """ |
||||
|
_name = 'location.detail' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
_description = "Location Details 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) |
@ -0,0 +1,64 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class PestDetail(models.Model): |
||||
|
""" This model represents comprehensive details about pests within the |
||||
|
context of agriculture management. """ |
||||
|
_name = 'pest.detail' |
||||
|
_inherit = ["mail.thread", 'mail.activity.mixin'] |
||||
|
_description = 'Pest Details 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 |
@ -0,0 +1,136 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class 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('farmer.detail', 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) |
||||
|
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'), ('paid', 'Paid')], string='Status', |
||||
|
default='draft', tracking=True, copy=False, |
||||
|
help=" The status of pesticide request") |
||||
|
pest_paid_bool = fields.Boolean(string='Paid Bool', default=False, |
||||
|
copy=False) |
||||
|
|
||||
|
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_create_invoice(self): |
||||
|
"""Method for creating invoice for the pesticides""" |
||||
|
create_invoice = self.env['account.move'].create({ |
||||
|
'partner_id': self.farmer_id.id, |
||||
|
'move_type': 'out_invoice', |
||||
|
'invoice_line_ids': [(0, 0, {'name': self.pest_id.pest_name, |
||||
|
'price_unit': self.total_cost})] |
||||
|
}) |
||||
|
create_invoice.action_post() |
||||
|
if create_invoice.payment_state == 'paid': |
||||
|
self.pest_paid_bool = True |
||||
|
self.state = 'paid' |
||||
|
return { |
||||
|
'name': 'Customer Invoice', |
||||
|
'view_mode': 'form', |
||||
|
'view_type': 'form', |
||||
|
'view_id': self.env.ref('account.view_move_form').id, |
||||
|
'res_id': create_invoice.id, |
||||
|
'res_model': 'account.move', |
||||
|
'context': "{'move_type':'out_invoice'}", |
||||
|
'type': 'ir.actions.act_window', |
||||
|
} |
||||
|
|
||||
|
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 |
@ -0,0 +1,55 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import 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) |
@ -0,0 +1,78 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
from datetime import datetime |
||||
|
|
||||
|
|
||||
|
class VehicleDetail(models.Model): |
||||
|
""" This model represents comprehensive details about vehicles within |
||||
|
the context of agriculture management. It provides a structured way to |
||||
|
store information related to various types of vehicles used for |
||||
|
transportation and agricultural operations.""" |
||||
|
_name = 'vehicle.detail' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
_description = "Vehicle Details IN Agriculture Management" |
||||
|
|
||||
|
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) |
@ -0,0 +1,134 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Vyshnav AR(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class 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.") |
||||
|
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') |
||||
|
res = super(VehicleRental, self).create(values) |
||||
|
return res |
||||
|
|
||||
|
@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: |
||||
|
days = (record.end_date - record.start_date).days |
||||
|
record.no_of_days = 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', |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- The record of animals report action --> |
||||
|
<record id="report_animal_crop" model="ir.actions.report"> |
||||
|
<field name="name">Animal Crop Report</field> |
||||
|
<field name="model">crop.request</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">agriculture_management_odoo.animal_crop</field> |
||||
|
<field name="report_file">agriculture_management_odoo.animal_crop</field> |
||||
|
<field name="binding_model_id" ref="model_crop_request"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,72 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- PDF Report Template for rented animal for farming report--> |
||||
|
<template id="animal_crop"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-foreach="docs" t-as="doc"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div class="page"> |
||||
|
<center> |
||||
|
<h1>Crop Animal Report</h1> |
||||
|
</center> |
||||
|
<br/> |
||||
|
<div t-if="doc.ref" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Reference : |
||||
|
<t t-esc="doc.ref"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.farmer_id.farmer_id.name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Farmer : |
||||
|
<t t-esc="doc.farmer_id.farmer_id.name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.seed_id.name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Crop : |
||||
|
<t t-esc="doc.seed_id.name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.location_id.location_name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Location : |
||||
|
<t t-esc="doc.location_id.location_name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<br> |
||||
|
</br> |
||||
|
<style> |
||||
|
table, thead, th, td, tr, tbody { |
||||
|
border: 1px solid black; |
||||
|
border-collapse: collapse; |
||||
|
padding: 5px; |
||||
|
} |
||||
|
</style> |
||||
|
<table class="table table-bordered" |
||||
|
style="border: 2px solid black;text-align: center !important;"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<strong> |
||||
|
<th>Animal</th> |
||||
|
<th>Quantity</th> |
||||
|
</strong> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr t-foreach="doc.animal_ids" t-as="line"> |
||||
|
<td> |
||||
|
<span t-esc="line.animal_id.breed"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line.qty"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- Action for report of crop request --> |
||||
|
<record id="action_crop_request_report" model="ir.actions.report"> |
||||
|
<field name="name">Crop Report</field> |
||||
|
<field name="model">crop.report</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">agriculture_management_odoo.report_crop_details</field> |
||||
|
<field name="report_file">agriculture_management_odoo.report_crop_details</field> |
||||
|
<field name="binding_model_id" ref="model_crop_report"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,90 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- PDF Report Template of crop details --> |
||||
|
<template id="report_crop_details"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<div class="text-center"> |
||||
|
<h1>Crop Report</h1> |
||||
|
</div> |
||||
|
<table class="table table-condensed"> |
||||
|
<tr> |
||||
|
<td>FROM DATE</td> |
||||
|
<td>:</td> |
||||
|
<td> |
||||
|
<t t-if="form.get('date_from')"> |
||||
|
<t t-esc="form['date_from']"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>TO DATE</td> |
||||
|
<td>:</td> |
||||
|
<td> |
||||
|
<t t-if="form.get('date_to')"> |
||||
|
<t t-esc="form['date_to']"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<table class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Reference |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Farmer |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Crop |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Request Date |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Location |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Status |
||||
|
</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t> |
||||
|
<tr t-foreach="record" t-as="val"> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[0]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[1]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[2]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[3]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[5]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[4]"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Report action for crop vehicle --> |
||||
|
<record id="report_vehicle_crop" model="ir.actions.report"> |
||||
|
<field name="name">Vehicle Crop Report</field> |
||||
|
<field name="model">crop.request</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">agriculture_management_odoo.vehicle_crop</field> |
||||
|
<field name="report_file">agriculture_management_odoo.vehicle_crop</field> |
||||
|
<field name="binding_model_id" ref="model_crop_request"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,71 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Template for PDF Report of vehicles in crops farming --> |
||||
|
<template id="vehicle_crop"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-foreach="docs" t-as="doc"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div class="page"> |
||||
|
<center> |
||||
|
<h1>Crop Vehicle Report</h1> |
||||
|
</center> |
||||
|
<br/> |
||||
|
<div t-if="doc.ref" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Reference : |
||||
|
<t t-esc="doc.ref"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.farmer_id.farmer_id.name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Farmer : |
||||
|
<t t-esc="doc.farmer_id.farmer_id.name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.seed_id.name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Crop : |
||||
|
<t t-esc="doc.seed_id.name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div t-if="doc.location_id.location_name" |
||||
|
style="font-family: 'Montserrat', sans-serif !important;font-weight: bold;font-size: 1.3rem"> |
||||
|
<p>Location : |
||||
|
<t t-esc="doc.location_id.location_name"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
<br/> |
||||
|
<style> |
||||
|
table, thead, th, td, tr, tbody { |
||||
|
border: 1px solid black; |
||||
|
border-collapse: collapse; |
||||
|
padding: 5px; |
||||
|
} |
||||
|
</style> |
||||
|
<table class="table table-sm" |
||||
|
style="border: 2px solid black"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<strong> |
||||
|
<th>Vehicle</th> |
||||
|
<th>Quantity</th> |
||||
|
</strong> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr t-foreach="doc.machinery_ids" t-as="line"> |
||||
|
<td> |
||||
|
<span t-esc="'%s/%s/%s' % (line.vehicle_id.vehicle_main_id.model_id.name,line.vehicle_id.vehicle_main_id.model_id.name,line.vehicle_id.vehicle_main_id.license_plate)"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line.qty"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- Record for actions of pesticide PDF report--> |
||||
|
<record id="pest_request_report_action" model="ir.actions.report"> |
||||
|
<field name="name">pest Report</field> |
||||
|
<field name="model">pest.report</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">agriculture_management_odoo.report_pest_detail</field> |
||||
|
<field name="report_file">agriculture_management_odoo.report_pest_detail</field> |
||||
|
<field name="binding_model_id" ref="model_pest_report"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,111 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- PDF Report Template for pesticide purchased in farming --> |
||||
|
<template id="report_pest_detail"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<div class="text-center"> |
||||
|
<h1>Pest Report</h1> |
||||
|
</div> |
||||
|
<table class="table table-condensed"> |
||||
|
<tr> |
||||
|
<td>FROM DATE</td> |
||||
|
<td>:</td> |
||||
|
<td> |
||||
|
<t t-if="form.get('date_from')"> |
||||
|
<t t-esc="form['date_from']"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>TO DATE</td> |
||||
|
<td>:</td> |
||||
|
<td> |
||||
|
<t t-if="form.get('date_to')"> |
||||
|
<t t-esc="form['date_to']"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<table class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Reference |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Farmer |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Crop |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Disease |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Pest |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Quantity |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Cost |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Total |
||||
|
</th> |
||||
|
<th style="text-align:left;color:black!important;"> |
||||
|
Status |
||||
|
</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t> |
||||
|
<tr t-foreach="record" t-as="val"> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[0]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[1]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[2]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[3]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[4]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[6]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[5]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[7]"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-att-style="style" |
||||
|
t-esc="val[8]"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- User groups for Agriculture Management--> |
||||
|
<record id="module_agriculture_management_odoo" model="ir.module.category"> |
||||
|
<field name="name">Agriculture Management</field> |
||||
|
<field name="description">Category for Agriculture</field> |
||||
|
</record> |
||||
|
<record id="group_agriculture_user" model="res.groups"> |
||||
|
<field name="name">User</field> |
||||
|
<field name="category_id" ref="module_agriculture_management_odoo"/> |
||||
|
</record> |
||||
|
<record id="group_agriculture_admin" model="res.groups"> |
||||
|
<field name="name">Manager</field> |
||||
|
<field name="category_id" ref="module_agriculture_management_odoo"/> |
||||
|
<field name="implied_ids" eval="[(4, ref('group_agriculture_user'))]"/> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,85 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Security rules for crop request --> |
||||
|
<record id="rule_own_doc" model="ir.rule"> |
||||
|
<field name="name">View Own Docs</field> |
||||
|
<field ref="model_crop_request" name="model_id"/> |
||||
|
<field name="domain_force">['|',('user_id', '=', user.id),('create_uid', |
||||
|
'=', user.id)] |
||||
|
</field> |
||||
|
<field name="groups" |
||||
|
eval="[(4, ref('agriculture_management_odoo.group_agriculture_user'))]"/> |
||||
|
</record> |
||||
|
<record id="rule_all_doc" model="ir.rule"> |
||||
|
<field name="name">View All Docs</field> |
||||
|
<field ref="model_crop_request" name="model_id"/> |
||||
|
<field name="domain_force">[(1, '=', 1)]</field> |
||||
|
<field name="groups" |
||||
|
eval="[(4, ref('agriculture_management_odoo.group_agriculture_admin'))]"/> |
||||
|
</record> |
||||
|
<record id="crop_request_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Crop Request multi company rule</field> |
||||
|
<field name="model_id" ref="model_crop_request"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="animal_rental_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Animal Rental multi company rule</field> |
||||
|
<field name="model_id" ref="model_animal_rental"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="animal_details_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Animal Details multi company rule</field> |
||||
|
<field name="model_id" ref="model_animal_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="crop_animal_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Crop Animal multi company rule</field> |
||||
|
<field name="model_id" ref="model_crop_animal"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="crop_machinery_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Crop Machinery multi company rule</field> |
||||
|
<field name="model_id" ref="model_crop_machinery"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="damage_loss_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Damage Loss multi company rule</field> |
||||
|
<field name="model_id" ref="model_damage_loss"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="farmer_detail_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Farmer Detail multi company rule</field> |
||||
|
<field name="model_id" ref="model_farmer_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="location_detail_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Location Detail multi company rule</field> |
||||
|
<field name="model_id" ref="model_location_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="pest_detail_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Pest Detail multi company rule</field> |
||||
|
<field name="model_id" ref="model_pest_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="pest_request_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Pest Request multi company rule</field> |
||||
|
<field name="model_id" ref="model_pest_request"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="seed_detail_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Seed Detail multi company rule</field> |
||||
|
<field name="model_id" ref="model_seed_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="vehicle_detail_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Vehicle Detail multi company rule</field> |
||||
|
<field name="model_id" ref="model_vehicle_detail"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
<record id="vehicle_rental_comp_rule" model="ir.rule"> |
||||
|
<field name="name">Vehicle Rental multi company rule</field> |
||||
|
<field name="model_id" ref="model_vehicle_rental"/> |
||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> |
||||
|
</record> |
||||
|
</odoo> |
|
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 18 KiB |