Browse Source

Jan 11 : [FIX] Bug Fixed 'agriculture_management_odoo'

pull/231/head
AjmalCybro 2 years ago
parent
commit
e11c886726
  1. 3
      agriculture_management_odoo/doc/RELEASE_NOTES.md
  2. 1
      agriculture_management_odoo/models/vehicle_rental.py
  3. 4
      agriculture_management_odoo/report/pest_report_template.xml
  4. 30
      agriculture_management_odoo/wizard/crop_report_wiz.py
  5. 34
      agriculture_management_odoo/wizard/pest_report_wiz.py
  6. 1278
      auto_database_backup/static/description/index.html

3
agriculture_management_odoo/doc/RELEASE_NOTES.md

@ -5,9 +5,8 @@
#### ADD #### ADD
- Initial commit for agriculture_management_odoo - Initial commit for agriculture_management_odoo
#### 19.11.2022 #### 19.11.2022
#### Version 16.0.2.0.0 #### Version 16.0.2.0.0
#### UPDT #### UPDT
- Updated - Update

1
agriculture_management_odoo/models/vehicle_rental.py

@ -26,6 +26,7 @@ class VehicleRental(models.Model):
_name = 'vehicle.rental' _name = 'vehicle.rental'
_inherit = ['mail.thread', 'mail.activity.mixin'] _inherit = ['mail.thread', 'mail.activity.mixin']
_description = 'Vehicle Rental' _description = 'Vehicle Rental'
_rec_name = 'vehicle_id'
vehicle_id = fields.Many2one('vehicle.details', string='Vehicle', vehicle_id = fields.Many2one('vehicle.details', string='Vehicle',
required=True, tracking=True) required=True, tracking=True)

4
agriculture_management_odoo/report/pest_report_template.xml

@ -86,11 +86,11 @@
</td> </td>
<td> <td>
<span t-att-style="style" <span t-att-style="style"
t-esc="val[5]"/> t-esc="val[6]"/>
</td> </td>
<td> <td>
<span t-att-style="style" <span t-att-style="style"
t-esc="val[6]"/> t-esc="val[5]"/>
</td> </td>
<td> <td>
<span t-att-style="style" <span t-att-style="style"

30
agriculture_management_odoo/wizard/crop_report_wiz.py

@ -43,26 +43,34 @@ class CropReport(models.TransientModel):
crop_requests.seed_id = seed_details.id crop_requests.seed_id = seed_details.id
inner join location_details ON inner join location_details ON
crop_requests.location_id = location_details.id""" crop_requests.location_id = location_details.id"""
today = fields.Date.today() today = fields.Date.today()
if self.date_from: if self.date_from and not self.date_to:
if self.date_from > today: if self.date_from > today:
raise UserError( raise UserError(
_('You could not set the start date or the end date in the future.')) _('You could not set the start date or the end date in the future.'))
if self.date_to: else:
ret = ret + """ where crop_requests.request_date >= '""" + str(
self.date_from) + """' AND crop_requests.request_date <= '""" \
+ str(
today) + """'"""
if self.date_to and not self.date_from:
if self.date_to > today: if self.date_to > today:
raise UserError( raise UserError(
_('You could not set the start date or the end date in the future.')) _('You could not set the start date or the end date in the future.'))
if self.date_from >= self.date_to: else:
raise UserError( ret = ret + """ where crop_requests.request_date <= '""" + str(
_('The start date must be inferior to the end date.')) self.date_to) + """'"""
if self.date_from and self.date_to: if self.date_from and self.date_to:
ret = ret + """ where crop_requests.request_date >= '""" + str( if self.date_from <= self.date_to:
self.date_from) + """' AND crop_requests.request_date <= '""" \ ret = ret + """ where crop_requests.request_date >= '""" + \
+ str( str(self.date_from) + """' AND crop_requests.request_date <= '""" \
self.date_to) + """'""" + str(self.date_to) + """'"""
else:
raise UserError(
_('The start date must be inferior to the end date.'))
self.env.cr.execute(ret) self.env.cr.execute(ret)
record = self.env.cr.fetchall() record = self.env.cr.fetchall()
data = { data = {

34
agriculture_management_odoo/wizard/pest_report_wiz.py

@ -32,30 +32,42 @@ class CropReport(models.TransientModel):
def action_pdf_pest_report(self): def action_pdf_pest_report(self):
ret = """select pest_request.reference, res_partner.name, crop_requests.ref, ret = """select pest_request.reference, res_partner.name, crop_requests.ref,
pest_request.disease, pest_details.pest_name,pest_request.pest_quantity, pest_request.disease, pest_details.pest_name as pest_name,pest_details.pest_cost as cost,pest_request.pest_quantity,
pest_request.pest_cost, pest_request.total_cost,pest_request.state from pest_request pest_request.total_cost,pest_request.state from pest_request
inner join res_partner on pest_request.farmer_id = res_partner.id inner join res_partner on pest_request.farmer_id = res_partner.id
inner join crop_requests on crop_requests.id = pest_request.crop_id inner join crop_requests on crop_requests.id = pest_request.crop_id
inner join pest_details on pest_details.id = pest_request.pest_id""" inner join pest_details on pest_details.id = pest_request.pest_id"""
today = fields.Date.today() today = fields.Date.today()
if self.date_from: if self.date_from and not self.date_to:
if self.date_from > today: if self.date_from > today:
raise UserError( raise UserError(
_('You could not set the start date or the end date in the future.')) _('You could not set the start date or the end date in the future.'))
if self.date_to: else:
ret = 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: if self.date_to > today:
raise UserError( raise UserError(
_('You could not set the start date or the end date in the future.')) _('You could not set the start date or the end date in the future.'))
if self.date_from >= self.date_to: else:
raise UserError( ret = ret + """ where pest_request.request_date <= '""" + str(
_('The start date must be inferior to the end date.')) self.date_to) + """'"""
if self.date_from and self.date_to: if self.date_from and self.date_to:
ret = ret + """ where crop_requests.request_date >= '""" + str( if self.date_from <= self.date_to:
self.date_from) + """' AND crop_requests.request_date <= '"""\ ret = ret + """ where pest_request.request_date >= '""" + \
+ str( str(self.date_from) + """' AND pest_request.request_date
self.date_to) + """'""" <= '""" \
+ str(self.date_to) + """'"""
else:
raise UserError(
_('The start date must be inferior to the end date.'))
self.env.cr.execute(ret) self.env.cr.execute(ret)
record = self.env.cr.fetchall() record = self.env.cr.fetchall()
data = { data = {

1278
auto_database_backup/static/description/index.html

File diff suppressed because it is too large
Loading…
Cancel
Save