Merge remote-tracking branch 'origin/preprod_odex25_fleet' into preprod_odex25_fleet
This commit is contained in:
commit
3eaaaf2cdb
|
|
@ -65,7 +65,6 @@ jobs:
|
|||
|
||||
sudo chmod +x ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.APP_SERVER_USER14 }} ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_APP_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
sudo systemctl restart ${{ secrets.ODEX25_STANDARD_MASTER_SERVICE }}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "** [INFO] "MASTER" services have been restarted."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -308,7 +308,8 @@ msgstr "مبلغ الدفعة"
|
|||
#: model_terms:ir.ui.view,arch_db:odex_fleet.odex_fleet_vehicle_log_services_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.vehicle_infraction_view_form
|
||||
msgid "Approve"
|
||||
msgstr ""
|
||||
msgstr "اعتماد"
|
||||
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_vehicle_log_fuel__state__approve
|
||||
|
|
@ -990,6 +991,16 @@ msgstr "الاسم المعروض"
|
|||
msgid "Draft"
|
||||
msgstr "مسودة"
|
||||
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:res.groups,name:odex_fleet.fleet_group_draft
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.fleet_form_renew_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.fleet_request_maintenance_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.odex_fleet_vehicle_log_fuel_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.odex_fleet_vehicle_log_services_view_form
|
||||
msgid "Set To Draft"
|
||||
msgstr "إرسال الى مسودة"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_maintenance__employee_id
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_vehicle__driver_id
|
||||
|
|
@ -1345,14 +1356,14 @@ msgstr ""
|
|||
#. module: odex_fleet
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.invoice_report_pdf
|
||||
msgid "From"
|
||||
msgstr ""
|
||||
msgstr "استمارة"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_account_config__type__fuel
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_vehicle_cost__cost_type__fuel
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.car_consumption_cost_report_pdf
|
||||
msgid "Fuel"
|
||||
msgstr ""
|
||||
msgstr "وقود"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.fleet_vehicle_log_fuel_view_tree
|
||||
|
|
@ -1698,7 +1709,7 @@ msgstr "تقرير الفاتورة"
|
|||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_vehicle_log_fuel__state__invoiced
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_vehicle_log_services__status__invoiced
|
||||
msgid "Invoiced"
|
||||
msgstr ""
|
||||
msgstr "مفوتر"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_hr_employee__driver
|
||||
|
|
@ -2209,6 +2220,13 @@ msgid ""
|
|||
" contracts (fixed or recurring) and fuel logs."
|
||||
msgstr ""
|
||||
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_account_config__type__form
|
||||
msgid "Form"
|
||||
msgstr "استمارة"
|
||||
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_quotation__offer
|
||||
msgid "Offer Attachment"
|
||||
|
|
@ -2271,7 +2289,7 @@ msgstr "المالك"
|
|||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_maintenance__state__paid
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.fleet_request_maintenance_view_form
|
||||
msgid "Paid"
|
||||
msgstr ""
|
||||
msgstr "إنشاء فاتورة"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_vehicle_cost__parent_id
|
||||
|
|
@ -2394,7 +2412,7 @@ msgstr "بيانات تعبئة الوقود"
|
|||
#: model_terms:ir.ui.view,arch_db:odex_fleet.odex_fleet_vehicle_log_services_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.vehicle_infraction_view_form
|
||||
msgid "Refuse"
|
||||
msgstr ""
|
||||
msgstr "رفض"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__fleet_vehicle_log_fuel__state__refused
|
||||
|
|
@ -2403,7 +2421,7 @@ msgstr ""
|
|||
#: model:ir.model.fields.selection,name:odex_fleet.selection__vehicle_delegation__state__refused
|
||||
#: model:ir.model.fields.selection,name:odex_fleet.selection__vehicle_infraction__state__refused
|
||||
msgid "Refused"
|
||||
msgstr "رفض"
|
||||
msgstr "مرفوض"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: model_terms:ir.ui.view,arch_db:odex_fleet.fleet_request_maintenance_view_form
|
||||
|
|
@ -2556,7 +2574,15 @@ msgstr ""
|
|||
msgid "Serial Number"
|
||||
msgstr "الرقم المسلسل"
|
||||
|
||||
|
||||
#. module: odex_fleet
|
||||
#: code:addons/odex_fleet/models/fleet_service_type.py:0
|
||||
#, python-format
|
||||
msgid "service"
|
||||
msgstr "الخدمة"
|
||||
|
||||
#. module: odex_fleet
|
||||
#: code:addons/odex_fleet/models/fleet_service_type.py:0
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_quotation_service__service_id
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_service_line_config__service_ids
|
||||
#: model:ir.model.fields,field_description:odex_fleet.field_fleet_vehicle_cost__service_id
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ from . import form_renew
|
|||
from . import account_config
|
||||
from . import insurance_companies
|
||||
from . import infractions
|
||||
from . import driver_departments
|
||||
from . import driver_departments
|
||||
from . import fleet_service_type
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.api import returns
|
||||
|
||||
|
||||
class FleetServiceType(models.Model):
|
||||
_inherit = 'fleet.service.type'
|
||||
_description = 'Fleet Service Type'
|
||||
|
||||
category = fields.Selection(selection='get_new_category_selection', string='Category', required=True,
|
||||
help='Choose whether the service refer to contracts, vehicle services or both')
|
||||
|
||||
def get_new_category_selection(self):
|
||||
selection = [(_('service'), _('Service'))]
|
||||
return selection
|
||||
|
|
@ -36,26 +36,26 @@ class FormRenew(models.Model):
|
|||
default=lambda self: self.env.user.company_id)
|
||||
|
||||
vehicle_id = fields.Many2one('fleet.vehicle', string="Vehicle", )
|
||||
cost = fields.Float( string="Renew Cost", )
|
||||
date = fields.Date(string="Request Date",default=fields.Date.context_today,help="date of current maintenance request")
|
||||
cost = fields.Float(string="Renew Cost", )
|
||||
date = fields.Date(string="Request Date", default=fields.Date.context_today,
|
||||
help="date of current maintenance request")
|
||||
user_id = fields.Many2one('res.users', string='Responsible', required=False, default=lambda self: self.env.user)
|
||||
end_date = fields.Date(string="End Date")
|
||||
new_date = fields.Date(string="New End Date")
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id)
|
||||
branch_id = fields.Many2one('hr.department', string="Branch")
|
||||
account_id = fields.Many2one('account.account', string="Account")
|
||||
invoice_id = fields.Many2one('account.move', string="Invoice", copy=False)
|
||||
partner_id = fields.Many2one('res.partner', string="Service Provider")
|
||||
tax_id = fields.Many2one('account.tax', string='Tax', ondelete='restrict')
|
||||
penalty_cost = fields.Float()
|
||||
edit_access = fields.Boolean(compute="get_access",)
|
||||
edit_access = fields.Boolean(compute="get_access", )
|
||||
|
||||
def get_access(self):
|
||||
for rec in self:
|
||||
rec.edit_access = False
|
||||
if rec.state == 'confirm' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
if rec.state == 'confirm' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
rec.edit_access = True
|
||||
|
||||
|
||||
@api.onchange('vehicle_id')
|
||||
def get_fleet_data(self):
|
||||
if self.vehicle_id:
|
||||
|
|
@ -67,14 +67,13 @@ class FormRenew(models.Model):
|
|||
invoice = self.env['account.move'].sudo().create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
'name': 'Fleet Service Cost Invoice ',
|
||||
# 'account_id': self.partner_id.property_account_payable_id.id,
|
||||
'branch_id': self.vehicle_id.branch_id.id,
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date': datetime.now().today(),
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'quantity': 1,
|
||||
'price_unit': self.cost+self.penalty_cost,
|
||||
'price_unit': self.cost + self.penalty_cost,
|
||||
# 'move_id': invoice.id,
|
||||
'name': 'Fleet Form Renew Cost',
|
||||
'account_id': self.account_id.id,
|
||||
|
|
@ -93,6 +92,10 @@ class FormRenew(models.Model):
|
|||
self.invoice_id = invoice.id
|
||||
# invoice.sudo().action_invoice_open()
|
||||
|
||||
def set_to_draft(self):
|
||||
for rec in self:
|
||||
rec.state = 'draft'
|
||||
|
||||
def action_confirm(self):
|
||||
for rec in self:
|
||||
rec.state = 'confirm'
|
||||
|
|
@ -110,4 +113,3 @@ class FormRenew(models.Model):
|
|||
def action_cancel(self):
|
||||
for rec in self:
|
||||
rec.state = 'cancel'
|
||||
|
||||
|
|
|
|||
|
|
@ -21,60 +21,64 @@ class FleetMaintenance(models.Model):
|
|||
else:
|
||||
raise ValidationError(_("You Need To Configurate Account Details"))
|
||||
return res
|
||||
|
||||
|
||||
name = fields.Char(string="Name")
|
||||
next_request_date = fields.Date(string="Next Request Date")
|
||||
date = fields.Date(string=" Request Date", default=fields.Date.context_today)
|
||||
next_odometer = fields.Float(string="Next Odometer")
|
||||
next_odometer = fields.Float(string="Next Odometer", compute='get_old_odometer', store=True)
|
||||
odometer = fields.Float(string="Odometer")
|
||||
type = fields.Selection([('corrective', 'Corrective'), ('preventive', 'Preventive')], string='Maintenance Type', default="corrective")
|
||||
state = fields.Selection([('draft', 'Draft'),
|
||||
type = fields.Selection([('corrective', 'Corrective'), ('preventive', 'Preventive')], string='Maintenance Type',
|
||||
default="corrective")
|
||||
state = fields.Selection([('draft', 'Draft'),
|
||||
('confirm', 'Confirm'),
|
||||
('approve', 'Approve'),
|
||||
('paid', 'Paid'),
|
||||
('refused', 'Refuse'),
|
||||
('cancel', 'Cancel'),
|
||||
], string='state', default="draft")
|
||||
], string='state', default="draft")
|
||||
vehicle_id = fields.Many2one('fleet.vehicle', string="Vehicle")
|
||||
license_plate = fields.Char(required=True, related='vehicle_id.license_plate', store=True,
|
||||
)
|
||||
employee_id = fields.Many2one('hr.employee', string="Driver" )
|
||||
quotation_ids = fields.One2many('fleet.quotation','request_id',string="Quotations")
|
||||
service_ids = fields.One2many('fleet.quotation.service','request_id',string="Quotations")
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id )
|
||||
license_plate = fields.Char(required=True, related='vehicle_id.license_plate')
|
||||
employee_id = fields.Many2one('hr.employee', string="Driver")
|
||||
quotation_ids = fields.One2many('fleet.quotation', 'request_id', string="Quotations")
|
||||
service_ids = fields.One2many('fleet.quotation.service', 'request_id', string="Quotations")
|
||||
branch_id = fields.Many2one('hr.department', string="Branch")
|
||||
# log_id = fields.Many2one('fleet.vehicle.log.services', string="Service Log")
|
||||
total_cost = fields.Float( string="Total Cost", compute="get_cost",store=True )
|
||||
total1 = fields.Float(string="Total",compute="get_total",store=True )
|
||||
total_cost = fields.Float(string="Total Cost", compute="get_cost", store=True)
|
||||
total1 = fields.Float(string="Total", compute="get_total", store=True)
|
||||
account_id = fields.Many2one('account.account', string="Account")
|
||||
invoice_id = fields.Many2one('account.move', string="Invoice", copy=False)
|
||||
line_id = fields.Many2one('fleet.service.line.config', string="Line", copy=False)
|
||||
reason = fields.Text(string="Reject Reason", tracking=True,)
|
||||
reason = fields.Text(string="Reject Reason", tracking=True, )
|
||||
tax_id = fields.Many2one('account.tax', string='Tax', ondelete='restrict')
|
||||
user_id = fields.Many2one('res.users', string='Responsible', required=False, default=lambda self: self.env.user)
|
||||
edit_access = fields.Boolean(compute="get_access",)
|
||||
edit_access = fields.Boolean(compute="get_access", )
|
||||
|
||||
@api.onchange('vehicle_id')
|
||||
def get_old_odometer(self):
|
||||
for rec in self:
|
||||
rec.next_odometer = rec.vehicle_id.odometer
|
||||
|
||||
def get_access(self):
|
||||
for rec in self:
|
||||
rec.edit_access = False
|
||||
if rec.state == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
if rec.state == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
rec.edit_access = True
|
||||
|
||||
@api.depends('service_ids')
|
||||
def get_total(self):
|
||||
for rec in self:
|
||||
if rec.service_ids:
|
||||
rec.total1 = sum(rec.service_ids.mapped('qty'))
|
||||
|
||||
rec.total1 = sum(rec.service_ids.mapped('qty'))
|
||||
|
||||
def create_invoice(self):
|
||||
partner = self.quotation_ids.filtered(lambda r:r.approve == True).mapped('partner_id')
|
||||
partner = self.quotation_ids.filtered(lambda r: r.approve == True).mapped('partner_id')
|
||||
if not partner:
|
||||
raise ValidationError(_("You NEED To ADD And Approve Quotation Lines"))
|
||||
amount = sum(self.quotation_ids.filtered(lambda r:r.approve == True).mapped('cost'))
|
||||
amount = sum(self.quotation_ids.filtered(lambda r: r.approve == True).mapped('cost'))
|
||||
invoice = self.env['account.move'].sudo().create({
|
||||
'partner_id': partner[0].id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
'name': 'Fleet Service Cost Invoice ',
|
||||
# 'name': 'Fleet Service Cost Invoice ',
|
||||
# 'account_id': partner[0].property_account_payable_id.id,
|
||||
'branch_id': self.vehicle_id.branch_id.id,
|
||||
'move_type': 'in_invoice',
|
||||
|
|
@ -100,11 +104,11 @@ class FleetMaintenance(models.Model):
|
|||
self.invoice_id = invoice.id
|
||||
# invoice.sudo().action_invoice_open()
|
||||
|
||||
@api.depends('quotation_ids','quotation_ids.approve')
|
||||
@api.depends('quotation_ids', 'quotation_ids.approve')
|
||||
def get_cost(self):
|
||||
for rec in self:
|
||||
if rec.quotation_ids.filtered(lambda r:r.approve == True):
|
||||
rec.total_cost = sum(rec.quotation_ids.filtered(lambda r:r.approve == True).mapped('cost'))
|
||||
if rec.quotation_ids.filtered(lambda r: r.approve == True):
|
||||
rec.total_cost = sum(rec.quotation_ids.filtered(lambda r: r.approve == True).mapped('cost'))
|
||||
|
||||
@api.onchange('vehicle_id')
|
||||
def get_vehcile_date(self):
|
||||
|
|
@ -115,21 +119,23 @@ class FleetMaintenance(models.Model):
|
|||
|
||||
def action_confirm(self):
|
||||
for rec in self:
|
||||
record = rec.quotation_ids.sudo().filtered(lambda r: r.approve == True)
|
||||
if not record:
|
||||
raise ValidationError(_("You Need Approve Quotation First"))
|
||||
rec.sudo().state = 'confirm'
|
||||
|
||||
def action_approve(self):
|
||||
for rec in self:
|
||||
record = rec.quotation_ids.sudo().filtered(lambda r: r.approve == True)
|
||||
if not record:
|
||||
raise ValidationError(_("You Need Approve Quotation First"))
|
||||
rec.state = 'approve'
|
||||
rec.vehicle_id.next_request_date = rec.next_request_date
|
||||
|
||||
|
||||
def action_refuse(self):
|
||||
for rec in self:
|
||||
rec.state = 'refused'
|
||||
|
||||
def set_to_draft(self):
|
||||
for rec in self:
|
||||
rec.state = 'draft'
|
||||
|
||||
def action_paid(self):
|
||||
for rec in self:
|
||||
|
|
@ -140,17 +146,18 @@ class FleetMaintenance(models.Model):
|
|||
for rec in self:
|
||||
rec.state = 'cancel'
|
||||
|
||||
|
||||
class FleetQuotation(models.Model):
|
||||
_name = 'fleet.quotation'
|
||||
_description = 'Fleet Quotation'
|
||||
|
||||
cost = fields.Float(string="Cost")
|
||||
offer = fields.Binary(string="Offer Attachment")
|
||||
partner_id = fields.Many2one('res.partner',string="Partner")
|
||||
partner_id = fields.Many2one('res.partner', string="Partner")
|
||||
approve = fields.Boolean()
|
||||
request_id = fields.Many2one('fleet.maintenance' )
|
||||
request_id = fields.Many2one('fleet.maintenance')
|
||||
reason = fields.Text(string="Reject Reason")
|
||||
state = fields.Selection(related='request_id.state',store=True)
|
||||
state = fields.Selection(related='request_id.state', store=True)
|
||||
edit_access = fields.Boolean(compute="get_access", )
|
||||
|
||||
def get_access(self):
|
||||
|
|
@ -159,7 +166,6 @@ class FleetQuotation(models.Model):
|
|||
if rec.state == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
rec.edit_access = True
|
||||
|
||||
|
||||
def action_approve(self):
|
||||
rec = self.request_id.quotation_ids.filtered(lambda r: r.approve)
|
||||
print("YYYYYYYYYYYY", rec)
|
||||
|
|
@ -172,7 +178,7 @@ class FleetQuotation(models.Model):
|
|||
form_view_id = self.env.ref("odex_fleet.wizard_reject_reason_fleet_wiz_form").id
|
||||
return {
|
||||
'name': _("Reject Reason"),
|
||||
|
||||
|
||||
'view_mode': 'form',
|
||||
'res_model': 'reject.reason.fleet.wiz',
|
||||
'views': [(form_view_id, 'form')],
|
||||
|
|
@ -181,6 +187,7 @@ class FleetQuotation(models.Model):
|
|||
'context': {'default_request_id': self.id},
|
||||
}
|
||||
|
||||
|
||||
class FleetQuotationService(models.Model):
|
||||
_name = 'fleet.quotation.service'
|
||||
_description = 'Fleet Service'
|
||||
|
|
@ -189,13 +196,10 @@ class FleetQuotationService(models.Model):
|
|||
cost = fields.Float(string="Cost")
|
||||
number = fields.Float(string="Number")
|
||||
total = fields.Float(string="Total", compute='_compute_total', readonly=True)
|
||||
service_id = fields.Many2one('fleet.service.type',string="Service")
|
||||
service_id = fields.Many2one('fleet.service.type', string="Service")
|
||||
request_id = fields.Many2one('fleet.maintenance')
|
||||
|
||||
@api.onchange('number', 'qty')
|
||||
def _compute_total(self):
|
||||
for r in self:
|
||||
r.total = r.number * r.qty
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,24 +5,27 @@ from datetime import timedelta
|
|||
from dateutil.relativedelta import relativedelta
|
||||
import math
|
||||
|
||||
|
||||
class FleetBranch(models.Model):
|
||||
_inherit = 'res.branch'
|
||||
|
||||
state_id = fields.Many2one('res.country.state', string="State", )
|
||||
|
||||
|
||||
|
||||
class Partner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
car_owner = fields.Boolean( string="Car Owner", )
|
||||
car_owner = fields.Boolean(string="Car Owner", )
|
||||
|
||||
|
||||
class FleetVehicle(models.Model):
|
||||
_inherit = 'fleet.vehicle'
|
||||
|
||||
owner_id = fields.Many2one('res.partner',string="Owner")
|
||||
insurance_companies_id = fields.Many2one('insurance.companies',string="Insurance Companies")
|
||||
employee_id = fields.Many2one('hr.employee',string="Driver")
|
||||
driver_id = fields.Many2one(related='employee_id.user_id.partner_id',store=True,string="Driver")
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id )
|
||||
owner_id = fields.Many2one('res.partner', string="Owner")
|
||||
insurance_companies_id = fields.Many2one('insurance.companies', string="Insurance Companies")
|
||||
employee_id = fields.Many2one('hr.employee', string="Driver")
|
||||
driver_id = fields.Many2one(related='employee_id.user_id.partner_id', store=True, string="Driver")
|
||||
branch_id = fields.Many2one('hr.department', string="Branch", )
|
||||
states = fields.Many2one('res.country.state', string="State", )
|
||||
old_branch_id = fields.Many2one('res.branch', string="Old Branch", )
|
||||
license_end = fields.Date(string="License End")
|
||||
|
|
@ -39,25 +42,25 @@ class FleetVehicle(models.Model):
|
|||
insurance_attachment = fields.Binary(string="Insurance Docs")
|
||||
installment_number = fields.Char(string="Installment Number")
|
||||
fuel_consumption = fields.Float(string="Fuel consumption")
|
||||
installment_ids = fields.One2many('insurance.installment','fleet_id',string="Installment")
|
||||
service_ids = fields.One2many('fleet.service.line.config','fleet_id',string="Services")
|
||||
installment_ids = fields.One2many('insurance.installment', 'fleet_id', string="Installment")
|
||||
service_ids = fields.One2many('fleet.service.line.config', 'fleet_id', string="Services")
|
||||
next_request_date = fields.Date(string="Next Maintenance Date")
|
||||
fuel_type = fields.Many2one('fuel.price','Fuel Type', help='Fuel Used by the vehicle')
|
||||
fuel_type = fields.Many2one('fuel.price', 'Fuel Type', help='Fuel Used by the vehicle')
|
||||
model_id = fields.Many2one('fleet.vehicle.model', string="Model Type", required=True, help='Model of the vehicle')
|
||||
location = fields.Char(string="Work Location" ,help='Location of the vehicle (garage, ...)')
|
||||
location = fields.Char(string="Work Location", help='Location of the vehicle (garage, ...)')
|
||||
car_category = fields.Many2one('car.category', 'Car Category')
|
||||
# man_company = fields.Many2one('manufacture.company', 'Manufacture Company')
|
||||
man_company = fields.Many2one(related='model_id.man_company_id')
|
||||
fleet_type_id = fields.Many2one(related='model_id.fleet_type_id', string="Fleet Type", )
|
||||
form_renew_cost = fields.Float(related='model_id.fleet_type_id.amount',string="Form Renew Cost")
|
||||
transmission_id = fields.Many2one('transmission.setting',string="Transmission")
|
||||
insurance_cost = fields.Float(string="Insurance Cost" ,compute ="get_insurance_cost",store = True,readonly = False)
|
||||
department_id = fields.Many2one('hr.department',string="Department",compute = "get_department_id" , store = True)
|
||||
form_renew_cost = fields.Float(related='model_id.fleet_type_id.amount', string="Form Renew Cost")
|
||||
transmission_id = fields.Many2one('transmission.setting', string="Transmission")
|
||||
insurance_cost = fields.Float(string="Insurance Cost", compute="get_insurance_cost", store=True, readonly=False)
|
||||
department_id = fields.Many2one('hr.department', string="Department", compute="get_department_id", store=True)
|
||||
project_id = fields.Many2one('project.project', string='Project')
|
||||
|
||||
@api.depends('employee_id')
|
||||
def get_department_id(self):
|
||||
for rec in self :
|
||||
for rec in self:
|
||||
if rec.employee_id:
|
||||
rec.department_id = rec.employee_id.department_id
|
||||
|
||||
|
|
@ -78,66 +81,68 @@ class FleetVehicle(models.Model):
|
|||
form = self.company_id.form
|
||||
check = self.company_id.check
|
||||
installment = self.company_id.installment
|
||||
if car_license >0:
|
||||
if car_license > 0:
|
||||
date = date + relativedelta(days=car_license)
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('license_end','<=',str(date))])
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('license_end', '<=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.car_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
if insurance>0:
|
||||
if insurance > 0:
|
||||
date = date + relativedelta(days=+int(insurance))
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('insurance_end_date', '>=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.insurance_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
|
||||
if form>0:
|
||||
if form > 0:
|
||||
date = date + relativedelta(days=+int(form))
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('form_end', '>=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.form_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
if check>0:
|
||||
if check > 0:
|
||||
date = date + relativedelta(days=+int(check))
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('check_end', '>=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.check_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
if operation>0:
|
||||
if operation > 0:
|
||||
date = date + relativedelta(days=+int(operation))
|
||||
fleet = self.env['fleet.vehicle'].sudo().search([('operation_card_end', '>=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.operation_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
if installment >0:
|
||||
if installment > 0:
|
||||
date = date + relativedelta(days=car_license)
|
||||
fleet = self.env['insurance.installment'].sudo().search([('date','<=',str(date))])
|
||||
fleet = self.env['insurance.installment'].sudo().search([('date', '<=', str(date))])
|
||||
for f in fleet:
|
||||
template = self.env.ref('odex_fleet.installment_expiration_email_template', False)
|
||||
template.send_mail(f.id)
|
||||
|
||||
@api.onchange('insurance_start_date','insurance_end_date')
|
||||
@api.constrains('insurance_start_date','insurance_end_date')
|
||||
@api.onchange('insurance_start_date', 'insurance_end_date')
|
||||
@api.constrains('insurance_start_date', 'insurance_end_date')
|
||||
def check_data(self):
|
||||
if self.insurance_start_date and self.insurance_end_date and self.insurance_start_date > self.insurance_end_date:
|
||||
raise UserError(_('Insurance Start Date must be less than or equal Insurance End Date '))
|
||||
|
||||
|
||||
class FleetType(models.Model):
|
||||
_name = 'fleet.type'
|
||||
_description = 'Fleet Type'
|
||||
|
||||
|
||||
name = fields.Char(string="Name")
|
||||
amount = fields.Float(string="Renew Amount")
|
||||
|
||||
|
||||
class FuelPrice(models.Model):
|
||||
_name = 'fuel.price'
|
||||
_description = 'Fuel Price'
|
||||
_rec_name = 'fuel_type'
|
||||
|
||||
fuel_type = fields.Many2one('product.product', string='Fuel Type',help='Fuel Used by the vehicle')
|
||||
fuel_type = fields.Many2one('product.product', string='Fuel Type', help='Fuel Used by the vehicle')
|
||||
price = fields.Float(string="Price")
|
||||
uom_id = fields.Many2one(related='fuel_type.uom_id',string='Unit of Measure', readonly=True)
|
||||
uom_id = fields.Many2one(related='fuel_type.uom_id', string='Unit of Measure', readonly=True)
|
||||
|
||||
|
||||
class CarCtegory(models.Model):
|
||||
_name = 'car.category'
|
||||
|
|
@ -146,10 +151,12 @@ class CarCtegory(models.Model):
|
|||
|
||||
car_category = fields.Char('Car Category')
|
||||
|
||||
|
||||
class FleetVehicleModelBrand(models.Model):
|
||||
_inherit = 'fleet.vehicle.model.brand'
|
||||
man_company_id = fields.Many2one('manufacture.company')
|
||||
|
||||
|
||||
class FleetVehicleModel(models.Model):
|
||||
_inherit = 'fleet.vehicle.model'
|
||||
|
||||
|
|
@ -165,6 +172,7 @@ class ManufactureCompany(models.Model):
|
|||
man_company = fields.Char('Manufacture Company')
|
||||
brand_ids = fields.Many2many('fleet.vehicle.model.brand')
|
||||
|
||||
|
||||
class TransmissionType(models.Model):
|
||||
_name = 'transmission.setting'
|
||||
_description = 'Trnsmission Setting'
|
||||
|
|
@ -172,6 +180,7 @@ class TransmissionType(models.Model):
|
|||
|
||||
transmission = fields.Char('Transmission')
|
||||
|
||||
|
||||
class InsuranceInstallment(models.Model):
|
||||
_name = 'insurance.installment'
|
||||
_description = 'Insurance Installment'
|
||||
|
|
@ -180,14 +189,13 @@ class InsuranceInstallment(models.Model):
|
|||
date = fields.Date(string="Date")
|
||||
amount = fields.Float(string="Amount")
|
||||
paid = fields.Date(string="Paid")
|
||||
fleet_id = fields.Many2one('fleet.vehicle',string="Fleet")
|
||||
|
||||
fleet_id = fields.Many2one('fleet.vehicle', string="Fleet")
|
||||
|
||||
|
||||
# class FleetVehicleCost(models.Model):
|
||||
# _inherit = 'fleet.vehicle.cost'
|
||||
|
||||
|
||||
|
||||
|
||||
# branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id)
|
||||
# number = fields.Float(string="Number")
|
||||
# total = fields.Float(string="Total", compute='_compute_total',readonly=True)
|
||||
|
|
@ -198,7 +206,6 @@ class InsuranceInstallment(models.Model):
|
|||
# r.total = r.number * r.amount
|
||||
|
||||
|
||||
|
||||
# @api.onchange('vehicle_id')
|
||||
# def get_branch(self):
|
||||
# if self.vehicle_id:
|
||||
|
|
@ -218,35 +225,32 @@ class FleetVehicleCost(models.Model):
|
|||
('services', 'Services'),
|
||||
('fuel', 'Fuel'),
|
||||
('other', 'Other')
|
||||
], 'Category of the cost', default="other", help='For internal purpose only', required=True)
|
||||
], 'Category of the cost', default="other", help='For internal purpose only', required=True)
|
||||
parent_id = fields.Many2one('fleet.vehicle.cost', 'Parent', help='Parent cost to this current cost')
|
||||
service_id = fields.Many2one('fleet.vehicle.log.services', 'Service', help='Service cost to this current cost')
|
||||
cost_ids = fields.One2many('fleet.vehicle.cost', 'parent_id', 'Included Services', copy=True)
|
||||
odometer_id = fields.Many2one('fleet.vehicle.odometer', 'Odometer', help='Odometer measure of the vehicle at the moment of this log')
|
||||
odometer_id = fields.Many2one('fleet.vehicle.odometer', 'Odometer',
|
||||
help='Odometer measure of the vehicle at the moment of this log')
|
||||
odometer = fields.Float(compute="_get_odometer", inverse='_set_odometer', string='Odometer Value',
|
||||
help='Odometer measure of the vehicle at the moment of this log')
|
||||
help='Odometer measure of the vehicle at the moment of this log')
|
||||
odometer_unit = fields.Selection(related='vehicle_id.odometer_unit', string="Unit", readonly=True)
|
||||
date = fields.Date(help='Date when the cost has been executed')
|
||||
contract_id = fields.Many2one('fleet.vehicle.log.contract', 'Contract', help='Contract attached to this cost')
|
||||
auto_generated = fields.Boolean('Automatically Generated', readonly=True)
|
||||
description = fields.Char("Cost Description")
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id)
|
||||
branch_id = fields.Many2one('hr.department', string="Branch", default=lambda self: self.env.user.branch_id)
|
||||
number = fields.Float(string="Number")
|
||||
total = fields.Float(string="Total", compute='_compute_total',readonly=True)
|
||||
total = fields.Float(string="Total", compute='_compute_total', readonly=True)
|
||||
|
||||
@api.onchange('number','amount')
|
||||
@api.onchange('number', 'amount')
|
||||
def _compute_total(self):
|
||||
for r in self:
|
||||
r.total = r.number * r.amount
|
||||
|
||||
|
||||
|
||||
@api.onchange('vehicle_id')
|
||||
def get_branch(self):
|
||||
if self.vehicle_id:
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
|
||||
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
|
||||
def _get_odometer(self):
|
||||
for record in self:
|
||||
|
|
@ -285,7 +289,6 @@ class FleetVehicleCost(models.Model):
|
|||
return super(FleetVehicleCost, self).create(data)
|
||||
|
||||
|
||||
|
||||
class FleetVehicleLogServices(models.Model):
|
||||
_inherit = 'fleet.vehicle.log.services'
|
||||
|
||||
|
|
@ -303,50 +306,62 @@ class FleetVehicleLogServices(models.Model):
|
|||
raise ValidationError(_("You Need To Configurate Account Details"))
|
||||
return res
|
||||
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id )
|
||||
branch_id = fields.Many2one('hr.department', string="Branch")
|
||||
account_id = fields.Many2one('account.account', string="Account")
|
||||
tax_id = fields.Many2one('account.tax', string='Tax', ondelete='restrict')
|
||||
invoice_id = fields.Many2one('account.move', string="Invoice", copy=False)
|
||||
partner_id = fields.Many2one('res.partner', string="Service Provider")
|
||||
partner_id = fields.Many2one('res.partner', string="Service Provider", required=1)
|
||||
request_id = fields.Many2one('fleet.maintenance', string="Maintenance Request")
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('confirm', 'Confirm'),
|
||||
('approve', 'Approved'),
|
||||
('invoiced', 'Invoiced'),
|
||||
('refused', 'Refused'),
|
||||
('cancel', 'Cancel'),
|
||||
|
||||
], default='draft',related="status")
|
||||
|
||||
('confirm', 'Confirm'),
|
||||
('approve', 'Approved'),
|
||||
('invoiced', 'Invoiced'),
|
||||
('refused', 'Refused'),
|
||||
('cancel', 'Cancel'),
|
||||
|
||||
], default='draft', related="status")
|
||||
|
||||
status = fields.Selection([('draft', 'Draft'),
|
||||
('confirm', 'Confirm'),
|
||||
('approve', 'Approved'),
|
||||
('invoiced', 'Invoiced'),
|
||||
('refused', 'Refused'),
|
||||
('cancel', 'Cancel'),
|
||||
], default='draft')
|
||||
edit_access = fields.Boolean(compute="get_access",)
|
||||
('confirm', 'Confirm'),
|
||||
('approve', 'Approved'),
|
||||
('invoiced', 'Invoiced'),
|
||||
('refused', 'Refused'),
|
||||
('cancel', 'Cancel'),
|
||||
], default='draft')
|
||||
edit_access = fields.Boolean(compute="get_access", )
|
||||
user_id = fields.Many2one('res.users', string='Responsible', required=False, default=lambda self: self.env.user)
|
||||
cost_subtype_id = fields.Many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost')
|
||||
cost_ids = fields.One2many('fleet.vehicle.cost', 'service_id', 'Included Services', copy=True)
|
||||
employee_id = fields.Many2one('hr.employee',string="Driver")
|
||||
employee_id = fields.Many2one('hr.employee', string="Driver")
|
||||
service_type_id = fields.Many2one(
|
||||
'fleet.service.type', 'Service Type', required=False,
|
||||
default=lambda self: self.env.ref('fleet.type_service_service_8', raise_if_not_found=False),
|
||||
)
|
||||
|
||||
def copy(self, default=None):
|
||||
default = dict(default or {})
|
||||
default.update({
|
||||
'status': 'draft',
|
||||
})
|
||||
return super(FleetVehicleLogServices, self).copy(default)
|
||||
|
||||
@api.onchange('odometer')
|
||||
def onchange_odometer(self):
|
||||
for rec in self :
|
||||
if rec.odometer < rec.vehicle_id.odometer :
|
||||
for rec in self:
|
||||
if rec.odometer < rec.vehicle_id.odometer:
|
||||
raise ValidationError(_("odometer should be more than current odometer"))
|
||||
|
||||
def get_access(self):
|
||||
for rec in self:
|
||||
rec.edit_access = False
|
||||
if rec.status == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
if rec.status == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
rec.edit_access = True
|
||||
|
||||
def set_to_draft(self):
|
||||
for rec in self:
|
||||
rec.status = 'draft'
|
||||
|
||||
def action_confirm(self):
|
||||
self.sudo().status = 'confirm'
|
||||
|
||||
|
|
@ -363,7 +378,7 @@ class FleetVehicleLogServices(models.Model):
|
|||
@api.onchange('vehicle_id')
|
||||
def get_branch(self):
|
||||
if self.vehicle_id:
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
self.odometer = self.vehicle_id.odometer
|
||||
self.employee_id = self.vehicle_id.employee_id
|
||||
|
||||
|
|
@ -371,7 +386,7 @@ class FleetVehicleLogServices(models.Model):
|
|||
invoice = self.env['account.move'].sudo().create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
'name': 'Fleet Service Cost Invoice ',
|
||||
# 'name': 'Fleet Service Cost Invoice ',
|
||||
# 'account_id': self.partner_id.property_account_payable_id.id,
|
||||
'branch_id': self.vehicle_id.branch_id.id,
|
||||
'move_type': 'in_invoice',
|
||||
|
|
@ -398,21 +413,22 @@ class FleetVehicleLogServices(models.Model):
|
|||
# invoice.sudo().action_invoice_open()
|
||||
self.sudo().status = 'invoiced'
|
||||
|
||||
|
||||
@api.onchange('cost_ids')
|
||||
def get_amount_total(self):
|
||||
for rec in self:
|
||||
rec.amount = sum(rec.cost_ids.mapped('total'))
|
||||
|
||||
|
||||
class FleetVehicleLogContract(models.Model):
|
||||
_inherit = 'fleet.vehicle.log.contract'
|
||||
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id )
|
||||
branch_id = fields.Many2one('hr.department', string="Branch")
|
||||
|
||||
@api.onchange('vehicle_id')
|
||||
def get_branch(self):
|
||||
if self.vehicle_id:
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
|
||||
|
||||
class FleetVehicleLogFuel(models.Model):
|
||||
_name = 'fleet.vehicle.log.fuel'
|
||||
|
|
@ -428,7 +444,8 @@ class FleetVehicleLogFuel(models.Model):
|
|||
'cost_subtype_id': service and service.id or False,
|
||||
'cost_type': 'fuel'
|
||||
})
|
||||
rec = self.env['fleet.account.config'].sudo().search([('type','=','fuel'),('state','=','confirm')],limit=1)
|
||||
rec = self.env['fleet.account.config'].sudo().search([('type', '=', 'fuel'), ('state', '=', 'confirm')],
|
||||
limit=1)
|
||||
if rec and self.env.user.has_group("odex25_fleet_account_custom.integration_with_account"):
|
||||
res['account_id'] = rec.account_id.id
|
||||
res['tax_id'] = rec.tax_id.id
|
||||
|
|
@ -436,21 +453,22 @@ class FleetVehicleLogFuel(models.Model):
|
|||
print("pass")
|
||||
# pass
|
||||
else:
|
||||
raise ValidationError(_("You Need To Configurate Account Details"))
|
||||
pass
|
||||
# raise ValidationError(_("You Need To Configurate Account Details"))
|
||||
return res
|
||||
|
||||
|
||||
liter = fields.Float()
|
||||
price_per_liter = fields.Float()
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser', domain="['|',('customer_rank','>',0),('employee','=',True)]")
|
||||
purchaser_id = fields.Many2one('res.partner', 'Purchaser',
|
||||
domain="['|',('customer_rank','>',0),('employee','=',True)]")
|
||||
inv_ref = fields.Char('Invoice Reference', size=64)
|
||||
vendor_id = fields.Many2one('res.partner', 'Vendor', domain="[('supplier_rank','=',True)]")
|
||||
notes = fields.Text()
|
||||
cost_id = fields.Many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade')
|
||||
branch_id = fields.Many2one('res.branch', string="Branch", default=lambda self: self.env.user.branch_id)
|
||||
branch_id = fields.Many2one('hr.department', string="Branch")
|
||||
account_id = fields.Many2one('account.account', string="Account")
|
||||
tax_id = fields.Many2one('account.tax', string='Tax', ondelete='restrict')
|
||||
invoice_id = fields.Many2one('account.move', string="Invoice",copy=False)
|
||||
invoice_id = fields.Many2one('account.move', string="Invoice", copy=False)
|
||||
partner_id = fields.Many2one('res.partner', string="Service Provider")
|
||||
fuel_type = fields.Many2one(related='vehicle_id.fuel_type')
|
||||
state = fields.Selection(selection=[('draft', 'Draft'),
|
||||
|
|
@ -459,23 +477,23 @@ class FleetVehicleLogFuel(models.Model):
|
|||
('invoiced', 'Invoiced'),
|
||||
('refused', 'Refused'),
|
||||
('cancel', 'Cancel'),
|
||||
], default='draft')
|
||||
], default='draft')
|
||||
amount = fields.Float('Total Untax')
|
||||
liter = fields.Float()
|
||||
price_tax = fields.Float(string='Tax')
|
||||
total_price_tax = fields.Float(string='Total', )
|
||||
price_per_liter = fields.Float()
|
||||
cal_type = fields.Selection(selection=[('total', 'Total'),('liter','Liter')],string="Calculation Type",default='liter')
|
||||
edit_access = fields.Boolean(compute="get_access",)
|
||||
cal_type = fields.Selection(selection=[('total', 'Total'), ('liter', 'Liter')], string="Calculation Type",
|
||||
default='liter')
|
||||
edit_access = fields.Boolean(compute="get_access", )
|
||||
user_id = fields.Many2one('res.users', string='Responsible', required=False, default=lambda self: self.env.user)
|
||||
employee_id = fields.Many2one('hr.employee',string="Driver")
|
||||
employee_id = fields.Many2one('hr.employee', string="Driver")
|
||||
|
||||
# we need to keep this field as a related with store=True because the graph view doesn't support
|
||||
# (1) to address fields from inherited table
|
||||
# (2) fields that aren't stored in database
|
||||
cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True)
|
||||
|
||||
|
||||
@api.onchange('liter', 'price_per_liter', 'amount')
|
||||
def _onchange_liter_price_amount(self):
|
||||
# need to cast in float because the value receveid from web client maybe an integer (Javascript and JSON do not
|
||||
|
|
@ -495,40 +513,40 @@ class FleetVehicleLogFuel(models.Model):
|
|||
elif amount > 0 and price_per_liter > 0 and round(amount / price_per_liter, 2) != liter:
|
||||
self.liter = round(amount / price_per_liter, 2)
|
||||
|
||||
|
||||
|
||||
def get_access(self):
|
||||
for rec in self:
|
||||
rec.edit_access = False
|
||||
if rec.state == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
if rec.state == 'approve' and self.env.user.has_group('odex_fleet.fleet_group_account'):
|
||||
rec.edit_access = True
|
||||
|
||||
@api.onchange('cal_type','price_per_liter','liter','total_price_tax')
|
||||
def set_to_draft(self):
|
||||
for rec in self:
|
||||
rec.state = 'draft'
|
||||
|
||||
@api.onchange('cal_type', 'price_per_liter', 'liter', 'total_price_tax')
|
||||
def _get_total(self):
|
||||
for rec in self:
|
||||
|
||||
|
||||
if rec.cal_type == 'total':
|
||||
taxes = rec.tax_id.compute_all(rec.price_per_liter, None, 1, product=None,
|
||||
partner=None)
|
||||
val = round(sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),2)
|
||||
taxes = rec.tax_id.compute_all(rec.price_per_liter, None, 1, product=None,
|
||||
partner=None)
|
||||
val = round(sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])), 2)
|
||||
pice_tax = rec.price_per_liter + val
|
||||
liter = rec.total_price_tax / pice_tax if val and rec.price_per_liter > 0 else 0
|
||||
new_taxes = rec.tax_id.compute_all(rec.price_per_liter, None, liter, product=None,
|
||||
partner=None)
|
||||
partner=None)
|
||||
tax = sum(t.get('amount', 0.0) for t in new_taxes.get('taxes', []))
|
||||
rec.price_tax = tax
|
||||
amount = rec.total_price_tax - rec.price_tax
|
||||
rec.liter = liter if liter>0 else 0
|
||||
rec.amount = amount if amount>0 else 0
|
||||
rec.liter = liter if liter > 0 else 0
|
||||
rec.amount = amount if amount > 0 else 0
|
||||
else:
|
||||
taxes = rec.tax_id.compute_all(rec.price_per_liter, None,rec.liter, product=None,
|
||||
taxes = rec.tax_id.compute_all(rec.price_per_liter, None, rec.liter, product=None,
|
||||
partner=None)
|
||||
tax = round(sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),2)
|
||||
rec.price_tax = tax if tax>0 else 0
|
||||
tax = round(sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])), 2)
|
||||
rec.price_tax = tax if tax > 0 else 0
|
||||
rec.amount = rec.liter * rec.price_per_liter
|
||||
rec.total_price_tax = round(rec.amount+ rec.price_tax,2)
|
||||
|
||||
|
||||
rec.total_price_tax = round(rec.amount + rec.price_tax, 2)
|
||||
|
||||
# def get_account_data(self):
|
||||
# print("in herere============")
|
||||
|
|
@ -539,7 +557,7 @@ class FleetVehicleLogFuel(models.Model):
|
|||
# else:
|
||||
# raise ValidationError(_("You Need To Configurate Account Details"))
|
||||
|
||||
@api.constrains('odometer','price_per_liter')
|
||||
@api.constrains('odometer', 'price_per_liter')
|
||||
def odometer_check(self):
|
||||
for rec in self:
|
||||
if rec.odometer <= 0:
|
||||
|
|
@ -570,30 +588,27 @@ class FleetVehicleLogFuel(models.Model):
|
|||
self.purchaser_id = self.vehicle_id.driver_id.id
|
||||
|
||||
self.price_per_liter = self.vehicle_id.fuel_type.price or 0
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
self.branch_id = self.vehicle_id.branch_id.id if self.vehicle_id.branch_id else False
|
||||
self.odometer_unit = self.vehicle_id.odometer_unit
|
||||
self.employee_id = self.vehicle_id.employee_id
|
||||
|
||||
|
||||
|
||||
|
||||
def create_invoice(self):
|
||||
invoice = self.env['account.move'].sudo().create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'currency_id':self.env.user.company_id.currency_id.id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
'name': 'Fuel Cost Invoice ',
|
||||
'journal_id':2,
|
||||
'journal_id': 2,
|
||||
# 'account_id': self.partner_id.property_account_payable_id.id,
|
||||
'branch_id': self.vehicle_id.branch_id.id,
|
||||
'move_type': 'in_invoice',
|
||||
'invoice_date':datetime.now().today(),
|
||||
'invoice_date': datetime.now().today(),
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'quantity': self.liter if self.cal_type== 'liter' else 1,
|
||||
'price_unit': self.price_per_liter if self.cal_type== 'liter' else self.amount,
|
||||
'quantity': self.liter if self.cal_type == 'liter' else 1,
|
||||
'price_unit': self.price_per_liter if self.cal_type == 'liter' else self.amount,
|
||||
# 'move_id': invoice.id,
|
||||
'name': 'Fuel Cost',
|
||||
'account_id': self.account_id.id,
|
||||
'tax_ids': [(6, 0, [self.tax_id.id])],
|
||||
'tax_ids': [(6, 0, [self.tax_id.id])],
|
||||
'product_id': self.fuel_type.fuel_type.id,
|
||||
})]
|
||||
})
|
||||
|
|
@ -609,7 +624,7 @@ class FleetVehicleLogFuel(models.Model):
|
|||
# })
|
||||
self.sudo().invoice_id = invoice.id
|
||||
invoice.sudo()._compute_amount()
|
||||
# invoice.sudo().action_invoice_open()
|
||||
# invoice.sudo().action_invoice_open()
|
||||
self.sudo().state = 'invoiced'
|
||||
date = fields.Date.context_today(self)
|
||||
data = {'value': self.odometer, 'date': date, 'vehicle_id': self.vehicle_id.id}
|
||||
|
|
@ -621,46 +636,47 @@ class FleetServiceConfig(models.Model):
|
|||
_description = 'Fleet Serive Line'
|
||||
|
||||
fleet_id = fields.Many2one('fleet.vehicle')
|
||||
service_ids = fields.Many2many('fleet.service.type',string="Service")
|
||||
date = fields.Date(string="Next Request Date",help="Next Request Date Of Maintenance Request")
|
||||
service_ids = fields.Many2many('fleet.service.type', string="Service")
|
||||
date = fields.Date(string="Next Request Date", help="Next Request Date Of Maintenance Request")
|
||||
next_odometer = fields.Float(string="Next Odometer")
|
||||
odometer = fields.Float(string="Next Odometer",help="Determine the current mileage value to submit a maintenance request")
|
||||
odometer = fields.Float(string="Next Odometer",
|
||||
help="Determine the current mileage value to submit a maintenance request")
|
||||
type = fields.Selection(selection=[('date', 'Date'), ('odometer', 'Odometer')],
|
||||
string="Type")
|
||||
string="Type")
|
||||
|
||||
@api.onchange('type','odometer')
|
||||
@api.onchange('type', 'odometer')
|
||||
def get_vals(self):
|
||||
for rec in self:
|
||||
if rec.type == 'odometer':
|
||||
rec.get_next_odometer()
|
||||
|
||||
|
||||
def get_next_odometer(self):
|
||||
for rec in self:
|
||||
rec.next_odometer = rec.fleet_id.odometer + rec.odometer
|
||||
|
||||
@api.model
|
||||
def fleet_maintenance_cron(self):
|
||||
date = self.env['fleet.service.line.config'].sudo().search([('type','=','date'),('date','=',str(datetime.now().date()))])
|
||||
date = self.env['fleet.service.line.config'].sudo().search(
|
||||
[('type', '=', 'date'), ('date', '=', str(datetime.now().date()))])
|
||||
odo = self.env['fleet.service.line.config'].sudo().search([('type', '=', 'odometer'),
|
||||
])
|
||||
odo = odo.filtered(lambda r:r.fleet_id.odometer >= r.next_odometer)
|
||||
print("FDDDDDDDDDDDDDDDDDDDDd",str(datetime.now().date()),date,odo.mapped('fleet_id.odometer'))
|
||||
])
|
||||
odo = odo.filtered(lambda r: r.fleet_id.odometer >= r.next_odometer)
|
||||
print("FDDDDDDDDDDDDDDDDDDDDd", str(datetime.now().date()), date, odo.mapped('fleet_id.odometer'))
|
||||
self.create_request(date)
|
||||
self.create_request(odo)
|
||||
|
||||
def create_request(self,data):
|
||||
def create_request(self, data):
|
||||
for d in data:
|
||||
self.env['fleet.maintenance'].sudo().create({
|
||||
'name':"Preventive Maintenance",
|
||||
'type':'preventive',
|
||||
'vehicle_id':d.fleet_id.id,
|
||||
'branch_id':d.fleet_id.branch_id.id,
|
||||
'odometer':d.fleet_id.odometer,
|
||||
'license_plate':d.fleet_id.license_plate,
|
||||
'line_id':d.id,
|
||||
'employee_id':d.fleet_id.employee_id.id if d.fleet_id.employee_id else False,
|
||||
'service_ids':[(0,0,{'service_id':l.id}) for l in d.service_ids]
|
||||
'name': "Preventive Maintenance",
|
||||
'type': 'preventive',
|
||||
'vehicle_id': d.fleet_id.id,
|
||||
'branch_id': d.fleet_id.branch_id.id,
|
||||
'odometer': d.fleet_id.odometer,
|
||||
'license_plate': d.fleet_id.license_plate,
|
||||
'line_id': d.id,
|
||||
'employee_id': d.fleet_id.employee_id.id if d.fleet_id.employee_id else False,
|
||||
'service_ids': [(0, 0, {'service_id': l.id}) for l in d.service_ids]
|
||||
})
|
||||
if d.type == 'odometer':
|
||||
d.get_next_odometer()
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ fleet.fleet_vehicle_log_contract_access_right_user,fleet_vehicle_log_contract_ac
|
|||
fleet_vehicle_log_contract_access_right_user_hr,fleet_vehicle_log_contract_access_right_hr,fleet.model_fleet_vehicle_log_contract,fleet_group_hr,1,1,1,1
|
||||
fleet_vehicle_log_contract_access_right_user_hr_off,fleet_vehicle_log_contract_access_right_hr_off,fleet.model_fleet_vehicle_log_contract,fleet_group_hr_officer,1,0,1,0
|
||||
fleet_vehicle_log_line,fleet_vehicle_log_line,model_fleet_service_line_config,,1,1,1,0
|
||||
fleet_vehicle_log_line_quotation,fleet_vehicle_log_line_quotation,model_fleet_quotation,,1,1,1,0
|
||||
fleet_vehicle_log_line_quotation_ser,fleet_vehicle_log_line_quotation_ser,model_fleet_quotation_service,,1,1,1,0
|
||||
fleet_vehicle_log_line_quotation,fleet_vehicle_log_line_quotation,model_fleet_quotation,,1,1,1,1
|
||||
fleet_vehicle_log_line_quotation_ser,fleet_vehicle_log_line_quotation_ser,model_fleet_quotation_service,,1,1,1,1
|
||||
fleet_vehicle_access_right_general,fleet_vehicle_access_right_general,fleet.model_fleet_vehicle,,1,0,0,0
|
||||
fleet_vehicle_access_right_acc,fleet_vehicle_access_right_general,fleet.model_fleet_vehicle,fleet_group_account,1,1,0,0
|
||||
fleet_vehicle_access_right_hr_off,fleet_vehicle_access_right_general,fleet.model_fleet_vehicle,fleet_group_hr_officer,1,1,0,0
|
||||
|
|
|
|||
|
|
|
@ -41,6 +41,11 @@
|
|||
<field name="implied_ids" eval="[(4, ref('fleet_group_supervisor')),(4, ref('fleet.fleet_group_manager')),(4, ref('fleet_group_hr')),
|
||||
(4, ref('fleet_group_account'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="fleet_group_draft" model="res.groups">
|
||||
<field name="name">Set To Draft</field>
|
||||
<field name="category_id" ref="fleet.module_fleet_category"/>
|
||||
</record>
|
||||
<record id="fleet_group_gm" model="res.groups">
|
||||
<field name="name">GM</field>
|
||||
<field name="implied_ids" eval="[(4, ref('fleet_group_vice_gm')),(4, ref('base.group_user'))]"/>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <menuitem name="Departments" parent="fleet.menu_root" id="vehicles_infractions" sequence="2"/>-->
|
||||
<menuitem action="driver_department_action" name="Departments" parent="fleet.fleet_configuration" id="driver_department_menu"/>
|
||||
<!-- <menuitem name="Departments" parent="fleet.menu_root" id="vehicles_infractions" sequence="2" active="False"/>-->
|
||||
<!-- <menuitem action="driver_department_action" name="Departments" parent="fleet.fleet_configuration" id="driver_department_menu"/>-->
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
<button name="action_refuse" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_gm" string="Refuse" type="object" class="oe_highlight" states="confirm"/>
|
||||
<button name="action_paid" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" string="Paid" type="object" class="oe_highlight" states="approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_gm,odex_fleet.fleet_group_vice_gm" string="Cancel" type="object" class="oe_highlight" states="draft,confirm,approve"/>
|
||||
<button name="set_to_draft" groups="odex_fleet.fleet_group_draft" type="object" states="refused,cancel" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
@ -55,13 +56,13 @@
|
|||
</page>
|
||||
<page string="Quotations">
|
||||
<field name="quotation_ids" nolabel="1" attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)]}">
|
||||
<tree editable="bottom">
|
||||
<tree editable="bottom" delete="1">
|
||||
<field name="partner_id" required="1"/>
|
||||
<field name="cost" required="1"/>
|
||||
<field name="offer" required="1"/>
|
||||
<field name="reason" attrs="{'invisible': [('approve', '=',True)],'readonly':True}" force_save="1"/>
|
||||
<button name="action_approve" string="Approve" type="object" class="oe_highlight" attrs="{'invisible': ['|',('approve', '=', True),('edit_access', '!=', True),('state','!=','confirm')]}"/>
|
||||
<button name="action_reject" string="Reject" type="object" class="oe_highlight" attrs="{'invisible': ['|',('approve', '=', False),('edit_access', '!=', True),('state','!=','confirm')]}"/>
|
||||
<button name="action_approve" string="Approve" type="object" class="oe_highlight" attrs="{'invisible': ['|',('approve', '=', True),('edit_access', '!=', True),('state','!=','draft')]}"/>
|
||||
<button name="action_reject" string="Reject" type="object" class="oe_highlight" attrs="{'invisible': ['|',('approve', '=', False),('edit_access', '!=', True),('state','!=','draft')]}"/>
|
||||
<field name="approve" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="edit_access" invisible="1"/>
|
||||
|
|
@ -129,7 +130,7 @@
|
|||
<menuitem action="fleet.fleet_vehicle_odometer_action" parent="fleet_maintenance_root" id="fleet.fleet_vehicle_odometer_menu" groups="fleet.fleet_group_user" sequence="2"/>
|
||||
<menuitem action="fleet_vehicle_log_fuel_action" parent="fleet_maintenance_root" id="fleet_vehicle_log_fuel_menu" groups="fleet.fleet_group_user,fleet_group_account" sequence="3"/>
|
||||
<menuitem action="fleet.fleet_vehicle_log_services_action" parent="fleet_maintenance_root" id="fleet.fleet_vehicle_log_services_menu" groups="fleet.fleet_group_user,fleet_group_account" sequence="4"/>
|
||||
<menuitem action="fleet_vehicle_costs_action" parent="fleet_maintenance_root" id="fleet_vehicle_costs_menu" groups="fleet.fleet_group_user,fleet_group_account" sequence="5"/>
|
||||
<!-- <menuitem action="fleet_vehicle_costs_action" parent="fleet_maintenance_root" id="fleet_vehicle_costs_menu" groups="fleet.fleet_group_user,fleet_group_account" sequence="5"/>-->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<button name="action_approve" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_supervisor" type="object" states="draft" class="oe_highlight" string="Cancel"/>
|
||||
<button name="action_refuse" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Refuse"/>
|
||||
<button name="set_to_draft" groups="odex_fleet.fleet_group_draft" type="object" states="refused,cancel" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
@ -35,7 +36,7 @@
|
|||
</group>
|
||||
<group col="4" colspan="2" string="Account Details">
|
||||
<field name="branch_id" attrs="{'readonly':[('invoice_id','!=',False)]}"/>
|
||||
<field name="partner_id" attrs="{'readonly':[('invoice_id','!=',False)]}"/>
|
||||
<field name="partner_id" attrs="{'readonly':[('invoice_id','!=',False)]}" required="1"/>
|
||||
<field name="account_id" readonly="1" force_save="1" required="1"/>
|
||||
<field name="tax_id" readonly="1" force_save="1" required="1"/> <field name="invoice_id" readonly="1" force_save="1"/>
|
||||
<field name="user_id" readonly="1" force_save="1"/>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<menuitem name="Fleet" id="fleet.menu_root" sequence="115" web_icon="fleet,static/description/icon.png"/>
|
||||
<menuitem name="Vehicles" parent="fleet.menu_root" id="fleet.fleet_vehicles" sequence="2" groups="fleet_group_hr_officer,fleet.fleet_group_user"/>
|
||||
<menuitem name="Fleet" id="fleet.menu_root" sequence="115" web_icon="fleet,static/description/icon.png"/>
|
||||
<menuitem name="Vehicles" parent="fleet.menu_root" id="fleet.fleet_vehicles" sequence="2"
|
||||
groups="fleet_group_hr_officer,fleet.fleet_group_user"/>
|
||||
|
||||
<menuitem name="Configuration" parent="fleet.menu_root" id="fleet.fleet_configuration" sequence="100" groups="fleet.fleet_group_user,fleet_group_hr_officer,fleet_group_account"/>
|
||||
<menuitem name="Configuration" parent="fleet.menu_root" id="fleet.fleet_configuration" sequence="100"
|
||||
groups="fleet.fleet_group_user,fleet_group_hr_officer,fleet_group_account"/>
|
||||
<!-- Vehicle-->
|
||||
<record id='fleet_vehicle_cost_view_tree' model='ir.ui.view'>
|
||||
<field name="name">fleet.vehicle.cost.tree</field>
|
||||
|
|
@ -30,12 +32,16 @@
|
|||
<div>
|
||||
<strong>
|
||||
<field name="vehicle_id"/>
|
||||
<span class="pull-right"><field name="date"/></span>
|
||||
<span class="pull-right">
|
||||
<field name="date"/>
|
||||
</span>
|
||||
</strong>
|
||||
</div>
|
||||
<div>
|
||||
<field name="cost_subtype_id"/>
|
||||
<span class="pull-right"><field name="amount"/></span>
|
||||
<span class="pull-right">
|
||||
<field name="amount"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
|
@ -73,7 +79,7 @@
|
|||
<field name="name">fleet.vehicle.cost.pivot</field>
|
||||
<field name="model">fleet.vehicle.cost</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Vehicles costs" >
|
||||
<pivot string="Vehicles costs">
|
||||
<field name="vehicle_id" type="row"/>
|
||||
<field name="cost_type" type="col"/>
|
||||
<field name="amount" type="measure"/>
|
||||
|
|
@ -97,8 +103,8 @@
|
|||
<field name="name">fleet.vehicle.cost.search</field>
|
||||
<field name="model">fleet.vehicle.cost</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Vehicles costs" >
|
||||
<field name="vehicle_id" />
|
||||
<search string="Vehicles costs">
|
||||
<field name="vehicle_id"/>
|
||||
<field name="cost_subtype_id"/>
|
||||
<field name="date"/>
|
||||
<field name="parent_id"/>
|
||||
|
|
@ -106,11 +112,13 @@
|
|||
<filter name="parent_true" domain="[('parent_id','!=',False)]" string="Indicative Costs"/>
|
||||
<group expand="1" string="Group By">
|
||||
<filter name="groupby_cost_type" context="{'group_by': 'cost_type'}" string="Cost Type"/>
|
||||
<filter name="groupby_cost_subtype_id" context="{'group_by': 'cost_subtype_id'}" string="Cost Subtype"/>
|
||||
<filter name="groupby_cost_subtype_id" context="{'group_by': 'cost_subtype_id'}"
|
||||
string="Cost Subtype"/>
|
||||
<filter name="groupby_vehicle_id" context="{'group_by': 'vehicle_id'}" string="Vehicle"/>
|
||||
<filter name="groupby_parent_id" context="{'group_by': 'parent_id'}" string="Parent"/>
|
||||
<separator/>
|
||||
<filter name="groupby_date" context="{'group_by': 'date:month'}" string="Month" help="Vehicle Costs by Month"/>
|
||||
<filter name="groupby_date" context="{'group_by': 'date:month'}" string="Month"
|
||||
help="Vehicle Costs by Month"/>
|
||||
<filter name="groupby_year" context="{'group_by': 'date:year'}" string="Year"/>
|
||||
</group>
|
||||
</search>
|
||||
|
|
@ -125,7 +133,7 @@
|
|||
<sheet>
|
||||
<group col="2" string="Cost Details">
|
||||
<group>
|
||||
<field name="vehicle_id" />
|
||||
<field name="vehicle_id"/>
|
||||
<field name="cost_subtype_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="description"/>
|
||||
|
|
@ -141,9 +149,9 @@
|
|||
</record>
|
||||
|
||||
<record id="fleet_vehicle_costs_view_graph" model="ir.ui.view">
|
||||
<field name="name">fleet.vehicle.cost.graph</field>
|
||||
<field name="model">fleet.vehicle.cost</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name">fleet.vehicle.cost.graph</field>
|
||||
<field name="model">fleet.vehicle.cost</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Costs Per Month" stacked="True">
|
||||
<field name="date" type="row"/>
|
||||
<field name="vehicle_id" type="col"/>
|
||||
|
|
@ -155,21 +163,24 @@
|
|||
<record id='fleet_vehicle_costs_action' model='ir.actions.act_window'>
|
||||
<field name="name">Vehicle Costs</field>
|
||||
<field name="res_model">fleet.vehicle.cost</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,kanban,form,graph</field>
|
||||
<field name="context">{"search_default_parent_false" : True, "search_default_groupby_vehicle_id" : True,}</field>
|
||||
<field name="context">{"search_default_parent_false" : True, "search_default_groupby_vehicle_id" : True,}
|
||||
</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new cost.
|
||||
</p><p>
|
||||
Odoo helps you managing the costs for your different
|
||||
vehicles. Costs are created automatically from services,
|
||||
contracts (fixed or recurring) and fuel logs.
|
||||
</p>
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new cost.
|
||||
</p>
|
||||
<p>
|
||||
Odoo helps you managing the costs for your different
|
||||
vehicles. Costs are created automatically from services,
|
||||
contracts (fixed or recurring) and fuel logs.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fleet_vehicle_costs_action" parent="fleet.fleet_vehicles" id="fleet_vehicle_costs_menu" groups="fleet.fleet_group_manager"/>
|
||||
<!-- <menuitem action="fleet_vehicle_costs_action" parent="fleet.fleet_vehicles" id="fleet_vehicle_costs_menu"-->
|
||||
<!-- groups="fleet.fleet_group_manager"/>-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="odex_view_fleet_vehicle_form">
|
||||
|
|
@ -181,71 +192,73 @@
|
|||
|
||||
<sheet>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="open_assignation_logs"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-history">
|
||||
<field name="history_count" widget="statinfo" string="Drivers History"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-book"
|
||||
context="{'xml_id':'fleet_vehicle_log_contract_action'}"
|
||||
help="show the contract for this vehicle">
|
||||
<field name="contract_count" widget="statinfo" string="Contracts"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-wrench"
|
||||
context="{'xml_id':'fleet_vehicle_log_services_action'}"
|
||||
help="show the services logs for this vehicle" >
|
||||
<field name="service_count" widget="statinfo" string="Services"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-tachometer"
|
||||
context="{'xml_id':'fleet_vehicle_odometer_action'}"
|
||||
help="show the odometer logs for this vehicle"
|
||||
attrs="{'invisible': [('vehicle_type', '!=', 'car')]}">
|
||||
<field name="odometer_count" widget="statinfo" string="Odometer"/>
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="image_128" widget='image' class="oe_avatar"/>
|
||||
<div class="oe_title">
|
||||
<label for="model_id" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="model_id" placeholder="e.g. Model S"/>
|
||||
</h1>
|
||||
<label for="license_plate" class="oe_edit_only"/>
|
||||
<h2>
|
||||
<field name="license_plate" class="oe_inline" placeholder="e.g. PAE 326"/>
|
||||
</h2>
|
||||
<label for="tag_ids" class="oe_edit_only"/>
|
||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
|
||||
</div>
|
||||
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="open_assignation_logs"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-history">
|
||||
<field name="history_count" widget="statinfo" string="Drivers History"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-book"
|
||||
context="{'xml_id':'fleet_vehicle_log_contract_action'}"
|
||||
help="show the contract for this vehicle">
|
||||
<field name="contract_count" widget="statinfo" string="Contracts"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-wrench"
|
||||
context="{'xml_id':'fleet_vehicle_log_services_action'}"
|
||||
help="show the services logs for this vehicle">
|
||||
<field name="service_count" widget="statinfo" string="Services"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-tachometer"
|
||||
context="{'xml_id':'fleet_vehicle_odometer_action'}"
|
||||
help="show the odometer logs for this vehicle"
|
||||
attrs="{'invisible': [('vehicle_type', '!=', 'car')]}">
|
||||
<field name="odometer_count" widget="statinfo" string="Odometer"/>
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="image_128" widget='image' class="oe_avatar"/>
|
||||
<div class="oe_title">
|
||||
<label for="model_id" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="model_id" placeholder="e.g. Model S"/>
|
||||
</h1>
|
||||
<label for="license_plate" class="oe_edit_only"/>
|
||||
<h2>
|
||||
<field name="license_plate" class="oe_inline" placeholder="e.g. PAE 326"/>
|
||||
</h2>
|
||||
<label for="tag_ids" class="oe_edit_only"/>
|
||||
<field name="tag_ids" widget="many2many_tags"
|
||||
options="{'color_field': 'color', 'no_create_edit': True}"/>
|
||||
</div>
|
||||
<group col="4" colspan="2" string="General Properties">
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="vehicle_type" invisible="1"/>
|
||||
<field name="states"/>
|
||||
<field name="branch_id" domain="[('state_id', '=', states)]"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="owner_id" domain="[('car_owner','=',True)]"/>
|
||||
<field name="fleet_type_id" readonly="1"/>
|
||||
<field name="fleet_type_id" readonly="1"/>
|
||||
<field name="car_category"/>
|
||||
<field name="man_company" readonly="1"/>
|
||||
<field name="license_end"/>
|
||||
<field name="serial_number"/>
|
||||
<field name="computer_number"/>
|
||||
<field name="employee_id" readonly="1" force_save="1"/>
|
||||
<field name="location" />
|
||||
<field name="location"/>
|
||||
<field name="department_id" readonly="1" force_save="1"/>
|
||||
<field name="project_id" readonly="1" force_save="1" invisible="1"/>
|
||||
<field name="vin_sn" />
|
||||
<field name="vin_sn"/>
|
||||
<field name="model_year"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<label for="odometer"/>
|
||||
|
|
@ -258,20 +271,20 @@
|
|||
<!-- <field name="residual_value"/>-->
|
||||
</group>
|
||||
<group col="4" colspan="2" string="Additional Properties">
|
||||
<field name="seats" />
|
||||
<field name="doors" />
|
||||
<field name="color" />
|
||||
<field name="car_weight" />
|
||||
<field name="seats"/>
|
||||
<field name="doors"/>
|
||||
<field name="color"/>
|
||||
<field name="car_weight"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Insurance Information">
|
||||
<group col="4" colspan="2">
|
||||
<field name="insurance_number" />
|
||||
<field name="insurance_start_date" />
|
||||
<field name="insurance_number"/>
|
||||
<field name="insurance_start_date"/>
|
||||
<field name="insurance_end_date"/>
|
||||
<field name="insurance_attachment" />
|
||||
<field name="installment_number" />
|
||||
<field name="insurance_cost" />
|
||||
<field name="insurance_attachment"/>
|
||||
<field name="installment_number"/>
|
||||
<field name="insurance_cost"/>
|
||||
</group>
|
||||
<field name="installment_ids" nolabel="1">
|
||||
<tree editable="bottom">
|
||||
|
|
@ -284,20 +297,23 @@
|
|||
<page string="Engine Options">
|
||||
<group col="4" colspan="2">
|
||||
<field name="transmission_id" required="1"/>
|
||||
<field name="fuel_type" required="1" />
|
||||
<label for="co2" invisible="1"/>
|
||||
<field name="fuel_type" required="1"/>
|
||||
<label for="co2" invisible="1"/>
|
||||
<div class="o_row" name="co2" invisible="1">
|
||||
<field name="co2" /><span>g/km</span>
|
||||
<field name="co2"/>
|
||||
<span>g/km</span>
|
||||
</div>
|
||||
<field name="horsepower" invisible="1"/>
|
||||
<field name="horsepower_tax" invisible="1" />
|
||||
<label for="power" invisible="1"/>
|
||||
<div class="o_row" invisible="1">
|
||||
<field name="power"/><span>kW</span>
|
||||
<field name="horsepower" invisible="1"/>
|
||||
<field name="horsepower_tax" invisible="1"/>
|
||||
<label for="power" invisible="1"/>
|
||||
<div class="o_row" invisible="1">
|
||||
<field name="power"/>
|
||||
<span>kW</span>
|
||||
</div>
|
||||
<label for="fuel_consumption"/>
|
||||
<div class="o_row">
|
||||
<field name="fuel_consumption"/><span>Km</span>
|
||||
<field name="fuel_consumption"/>
|
||||
<span>Km</span>
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
|
|
@ -317,7 +333,7 @@
|
|||
<tree editable="bottom">
|
||||
<field name="service_ids" required="1" widget="many2many_tags"/>
|
||||
<field name="type" required="1"/>
|
||||
<field name="date" attrs="{'invisible': [('type','=','odometer')],
|
||||
<field name="date" attrs="{'invisible': [('type','=','odometer')],
|
||||
'required': [('type','!=','odometer')]}"/>
|
||||
<field name="odometer" attrs="{'invisible': [('type','!=','odometer')],
|
||||
'required': [('type','=','odometer')]}"/>
|
||||
|
|
@ -358,8 +374,8 @@
|
|||
<field name="model">fleet.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Type">
|
||||
<field name="name" />
|
||||
<field name="amount" />
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -367,24 +383,28 @@
|
|||
<record id='fleet_vehicle_amount_action' model='ir.actions.act_window'>
|
||||
<field name="name">Vehicle Type</field>
|
||||
<field name="res_model">fleet.type</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new type.
|
||||
</p><p>
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fleet_vehicle_amount_action"
|
||||
name="Vehicle Type" parent="fleet.fleet_configuration" id="fleet_type_menu" sequence="100" groups="fleet.fleet_group_user" />
|
||||
<menuitem action="fleet_vehicle_amount_action"
|
||||
name="Vehicle Type" parent="fleet.fleet_configuration" id="fleet_type_menu" sequence="100"
|
||||
groups="fleet.fleet_group_user"/>
|
||||
|
||||
<menuitem id="res_states_menu" name="States" sequence="1"
|
||||
parent="fleet.fleet_configuration" groups="fleet.fleet_group_user,fleet_group_hr_officer" action="base.action_country_state" />
|
||||
parent="fleet.fleet_configuration" groups="fleet.fleet_group_user,fleet_group_hr_officer"
|
||||
action="base.action_country_state"/>
|
||||
|
||||
<menuitem id="res_branches_menu" name="Branch"
|
||||
parent="fleet.fleet_configuration" groups="fleet_group_supervisor,fleet_group_hr_officer" action="branch.branch_action_res_branch" sequence="2"/>
|
||||
parent="fleet.fleet_configuration" groups="fleet_group_supervisor,fleet_group_hr_officer"
|
||||
action="branch.branch_action_res_branch" sequence="2"/>
|
||||
|
||||
<!-- fuel type-->
|
||||
<record id='fleet_fuel_price_view_form' model='ir.ui.view'>
|
||||
|
|
@ -413,8 +433,8 @@
|
|||
<field name="model">fuel.price</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fuel Price">
|
||||
<field name="fuel_type" />
|
||||
<field name="price" />
|
||||
<field name="fuel_type"/>
|
||||
<field name="price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -422,20 +442,22 @@
|
|||
<record id='fuel_price_action' model='ir.actions.act_window'>
|
||||
<field name="name">Fuel Price</field>
|
||||
<field name="res_model">fuel.price</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Fuel Price.
|
||||
</p><p>
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fuel_price_action"
|
||||
name="Fuel Price" parent="fleet.fleet_configuration" id="fuel_price_menu" groups="fleet.fleet_group_user,fleet_group_account" sequence="100" />
|
||||
<menuitem action="fuel_price_action"
|
||||
name="Fuel Price" parent="fleet.fleet_configuration" id="fuel_price_menu"
|
||||
groups="fleet.fleet_group_user,fleet_group_account" sequence="100"/>
|
||||
|
||||
<!-- Car Category -->
|
||||
<!-- Car Category -->
|
||||
<record id='fleet_car_category_view_form' model='ir.ui.view'>
|
||||
<field name="name">fleet.vehicle.car.category.model.form</field>
|
||||
<field name="model">car.category</field>
|
||||
|
|
@ -457,7 +479,7 @@
|
|||
<field name="model">car.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Car Category">
|
||||
<field name="car_category" />
|
||||
<field name="car_category"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -466,18 +488,20 @@
|
|||
<record id='car_category_action' model='ir.actions.act_window'>
|
||||
<field name="name">Car Category</field>
|
||||
<field name="res_model">car.category</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Car Category.
|
||||
</p><p>
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="car_category_action"
|
||||
name="Car Category" parent="fleet.fleet_configuration" id="car_category_menu" groups="fleet.fleet_group_user" sequence="101"/>
|
||||
<menuitem action="car_category_action"
|
||||
name="Car Category" parent="fleet.fleet_configuration" id="car_category_menu"
|
||||
groups="fleet.fleet_group_user" sequence="101"/>
|
||||
|
||||
<!-- Manufacture Company -->
|
||||
<record id='fleet_man_company_view_form' model='ir.ui.view'>
|
||||
|
|
@ -502,7 +526,7 @@
|
|||
<field name="model">manufacture.company</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Manufacture Company">
|
||||
<field name="man_company" />
|
||||
<field name="man_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -511,19 +535,21 @@
|
|||
<record id='man_company_action' model='ir.actions.act_window'>
|
||||
<field name="name">Manufacture Company</field>
|
||||
<field name="res_model">manufacture.company</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Manufacture Company.
|
||||
</p><p>
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="man_company_action"
|
||||
name="Manufacture Company" parent="fleet.fleet_configuration" id="man_company_menu" groups="fleet.fleet_group_user" sequence="101"/>
|
||||
<!-- Transmission Type -->
|
||||
<menuitem action="man_company_action"
|
||||
name="Manufacture Company" parent="fleet.fleet_configuration" id="man_company_menu"
|
||||
groups="fleet.fleet_group_user" sequence="101"/>
|
||||
<!-- Transmission Type -->
|
||||
<record id='fleet_transmission_view_form' model='ir.ui.view'>
|
||||
<field name="name">fleet.vehicle.transmission.setting.model.form</field>
|
||||
<field name="model">transmission.setting</field>
|
||||
|
|
@ -545,7 +571,7 @@
|
|||
<field name="model">transmission.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Transmission Type">
|
||||
<field name="transmission" />
|
||||
<field name="transmission"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -554,52 +580,54 @@
|
|||
<record id='transmission_setting_action' model='ir.actions.act_window'>
|
||||
<field name="name">Transmission Type</field>
|
||||
<field name="res_model">transmission.setting</field>
|
||||
|
||||
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new transmission .
|
||||
</p><p>
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="transmission_setting_action"
|
||||
name="Transmission Type" parent="fleet.fleet_configuration" id="transmission_setting_menu" groups="fleet.fleet_group_user" sequence="102"/>
|
||||
<menuitem action="transmission_setting_action"
|
||||
name="Transmission Type" parent="fleet.fleet_configuration" id="transmission_setting_menu"
|
||||
groups="fleet.fleet_group_user" sequence="102"/>
|
||||
|
||||
|
||||
<record id='odex_fleet_vehicle_model_brand_view_form' model='ir.ui.view'>
|
||||
<field name="name">odex.fleet.vehicle.model.brand.form</field>
|
||||
<field name="model">fleet.vehicle.model.brand</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_model_brand_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<group>
|
||||
<field name="man_company_id" />
|
||||
<field name="name">odex.fleet.vehicle.model.brand.form</field>
|
||||
<field name="model">fleet.vehicle.model.brand</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_model_brand_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<group>
|
||||
<field name="man_company_id"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id='odex_fleet_vehicle_model_view_form' model='ir.ui.view'>
|
||||
<field name="name">odex.fleet.vehicle.model.form</field>
|
||||
<field name="model">fleet.vehicle.model</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_model_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="brand_id" position="after">
|
||||
<group>
|
||||
<group>
|
||||
<field name="fleet_type_id"/>
|
||||
<field name="man_company_id" readonly="1" />
|
||||
</group>
|
||||
</record>
|
||||
<record id='odex_fleet_vehicle_model_view_form' model='ir.ui.view'>
|
||||
<field name="name">odex.fleet.vehicle.model.form</field>
|
||||
<field name="model">fleet.vehicle.model</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_model_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="brand_id" position="after">
|
||||
<group>
|
||||
<group>
|
||||
<field name="fleet_type_id"/>
|
||||
<field name="man_company_id" readonly="1"/>
|
||||
</group>
|
||||
|
||||
|
||||
</group>
|
||||
</field>
|
||||
</group>
|
||||
</field>
|
||||
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
<!-- Branch-->
|
||||
<record id="fleet_branch_form_view" model="ir.ui.view">
|
||||
<field name="name">fleet.branch.inherit</field>
|
||||
|
|
@ -620,7 +648,7 @@
|
|||
<field name="name">Car Owner</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
|
||||
|
||||
<field name="domain">[]</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="domain">[('car_owner','=',True)]</field>
|
||||
|
|
@ -629,9 +657,11 @@
|
|||
</record>
|
||||
|
||||
<!-- -->
|
||||
<menuitem action="action_partner_owner_form" groups="fleet.fleet_group_user" parent="fleet.fleet_vehicles" sequence="3" id="fleet_vehicle_owner_menu"/>
|
||||
<!-- <menuitem action="action_partner_owner_form" groups="fleet.fleet_group_user" parent="fleet.fleet_vehicles"-->
|
||||
<!-- sequence="3" id="fleet_vehicle_owner_menu"/>-->
|
||||
<!-- -->
|
||||
<menuitem action="fleet.fleet_vehicle_action" parent="fleet.fleet_vehicles" id="fleet.fleet_vehicle_menu" groups="fleet.fleet_group_user" sequence="2"/>
|
||||
<menuitem action="fleet.fleet_vehicle_action" parent="fleet.fleet_vehicles" id="fleet.fleet_vehicle_menu"
|
||||
groups="fleet.fleet_group_user" sequence="2"/>
|
||||
|
||||
|
||||
<!-- LOg-->
|
||||
|
|
@ -640,14 +670,23 @@
|
|||
<field name="name">odex.fleet.vehicle.log.form</field>
|
||||
<field name="model">fleet.vehicle.log.fuel</field>
|
||||
<field name="arch" type="xml">
|
||||
<form >
|
||||
|
||||
<form>
|
||||
|
||||
<header>
|
||||
<button name="create_invoice" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object" states="approve" class="oe_highlight" string="Create Invoice"/>
|
||||
<button name="action_confirm" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object" states="draft" class="oe_highlight" string="Confirm"/>
|
||||
<button name="action_approve" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_supervisor" type="object" states="draft" class="oe_highlight" string="Cancel"/>
|
||||
<button name="action_refuse" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Refuse"/>
|
||||
<button name="create_invoice"
|
||||
groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object"
|
||||
states="approve" class="oe_highlight" string="Create Invoice"/>
|
||||
<button name="action_confirm"
|
||||
groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object"
|
||||
states="draft" class="oe_highlight" string="Confirm"/>
|
||||
<button name="action_approve" groups="odex_fleet.fleet_group_gm" type="object" states="confirm"
|
||||
class="oe_highlight" string="Approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_supervisor" type="object"
|
||||
states="draft" class="oe_highlight" string="Cancel"/>
|
||||
<button name="action_refuse" groups="odex_fleet.fleet_group_gm" type="object" states="confirm"
|
||||
class="oe_highlight" string="Refuse"/>
|
||||
<button name="set_to_draft" groups="odex_fleet.fleet_group_draft" type="object" states="refused,cancel"
|
||||
class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
|
||||
|
|
@ -656,21 +695,25 @@
|
|||
<group string="Vehicle Details">
|
||||
<field name="vehicle_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="fuel_type" readonly="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="employee_id" />
|
||||
<field name="employee_id"/>
|
||||
</group>
|
||||
<group string="Refueling Details">
|
||||
<field name="cal_type" attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="liter" attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="price_per_liter" attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="cal_type"
|
||||
attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="liter"
|
||||
attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="price_per_liter"
|
||||
attrs="{'readonly': [('state', '!=', 'draft'),('edit_access', '!=', True)],'required':True}"/>
|
||||
<field name="price_tax" readonly="1" force_save="1"/>
|
||||
<field name="amount" readonly="1" force_save="1"/>
|
||||
<field name="total_price_tax" force_save="1" attrs="{'readonly':['|',('cal_type','!=','total'),('state','!=','draft'),('edit_access', '!=', True)]}"/>
|
||||
<field name="total_price_tax" force_save="1"
|
||||
attrs="{'readonly':['|',('cal_type','!=','total'),('state','!=','draft'),('edit_access', '!=', True)]}"/>
|
||||
</group>
|
||||
<group string="Account Details">
|
||||
<field name="branch_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="partner_id" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="account_id" required="1" readonly="1" force_save="1"/>
|
||||
<field name="tax_id" required="1" readonly="1" force_save="1"/>
|
||||
<field name="account_id" required="1" readonly="1" force_save="1"/>
|
||||
<field name="tax_id" required="1" readonly="1" force_save="1"/>
|
||||
<field name="invoice_id" readonly="1" force_save="1"/>
|
||||
<field name="inv_ref"/>
|
||||
</group>
|
||||
|
|
@ -685,13 +728,14 @@
|
|||
</group>
|
||||
<group string="Additional Details">
|
||||
<field name="date" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="purchaser_id" required="0" invisible="1" />
|
||||
<field name="edit_access" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
|
||||
<field name="purchaser_id" required="0" invisible="1"/>
|
||||
<field name="edit_access" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<field name="notes" placeholder="Write here any other information" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="notes" placeholder="Write here any other information"
|
||||
attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
</sheet>
|
||||
|
||||
</form>
|
||||
|
|
@ -699,45 +743,47 @@
|
|||
|
||||
</record>
|
||||
|
||||
|
||||
<record id='fleet_vehicle_log_fuel_view_tree' model='ir.ui.view'>
|
||||
<field name="name">fleet.vehicle.log.fuel.tree</field>
|
||||
<field name="model">fleet.vehicle.log.fuel</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fuel Logs">
|
||||
<field name="date" />
|
||||
<field name="vehicle_id" />
|
||||
<field name="purchaser_id" />
|
||||
<field name="inv_ref" invisible="1"/>
|
||||
<field name="vendor_id" invisible="1"/>
|
||||
<field name="odometer" />
|
||||
<field name="odometer_unit" />
|
||||
<field name="liter" />
|
||||
<field name="state" />
|
||||
<field name="price_per_liter" invisible="1"/>
|
||||
<field name="amount" sum="Price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id='fleet_vehicle_log_fuel_action' model='ir.actions.act_window'>
|
||||
<field name="name">Vehicles Fuel Logs</field>
|
||||
<field name="res_model">fleet.vehicle.log.fuel</field>
|
||||
|
||||
<field name="view_mode">tree,kanban,form,graph</field>
|
||||
<field name="context">{"search_default_groupby_vehicle" : True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new fuel log.
|
||||
</p><p>
|
||||
Here you can add refuelling entries for all vehicles. You can
|
||||
also filter logs of a particular vehicle using the search
|
||||
field.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<record id='fleet_vehicle_log_fuel_view_tree' model='ir.ui.view'>
|
||||
<field name="name">fleet.vehicle.log.fuel.tree</field>
|
||||
<field name="model">fleet.vehicle.log.fuel</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fuel Logs">
|
||||
<field name="date"/>
|
||||
<field name="vehicle_id"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="inv_ref" invisible="1"/>
|
||||
<field name="vendor_id" invisible="1"/>
|
||||
<field name="odometer"/>
|
||||
<field name="odometer_unit"/>
|
||||
<field name="liter"/>
|
||||
<field name="state"/>
|
||||
<field name="price_per_liter" invisible="1"/>
|
||||
<field name="amount" sum="Price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fleet_vehicle_log_fuel_action" parent="fleet.fleet_vehicles" id="fleet_vehicle_log_fuel_menu" />
|
||||
<record id='fleet_vehicle_log_fuel_action' model='ir.actions.act_window'>
|
||||
<field name="name">Vehicles Fuel Logs</field>
|
||||
<field name="res_model">fleet.vehicle.log.fuel</field>
|
||||
|
||||
<field name="view_mode">tree,kanban,form,graph</field>
|
||||
<field name="context">{"search_default_groupby_vehicle" : True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new fuel log.
|
||||
</p>
|
||||
<p>
|
||||
Here you can add refuelling entries for all vehicles. You can
|
||||
also filter logs of a particular vehicle using the search
|
||||
field.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fleet_vehicle_log_fuel_action" parent="fleet.fleet_vehicles"
|
||||
id="fleet_vehicle_log_fuel_menu"/>
|
||||
|
||||
<!-- service log-->
|
||||
|
||||
|
|
@ -746,67 +792,84 @@
|
|||
<field name="model">fleet.vehicle.log.services</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_log_services_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form" position="replace">
|
||||
<form>
|
||||
<field name="active" invisible="1" />
|
||||
<field name="state" invisible="1" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
<header>
|
||||
<button name="create_invoice" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object" states="approve" class="oe_highlight" string="Create Invoice"/>
|
||||
<button name="action_confirm" groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor" type="object" states="draft" class="oe_highlight" string="Confirm"/>
|
||||
<button name="action_approve" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_supervisor" type="object" states="draft" class="oe_highlight" string="Cancel"/>
|
||||
<button name="action_refuse" groups="odex_fleet.fleet_group_gm" type="object" states="confirm" class="oe_highlight" string="Refuse"/>
|
||||
<field name="status" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group col="2">
|
||||
<group string="Services Details">
|
||||
<field name="vehicle_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="cost_subtype_id" attrs="{'readonly':[('state','!=','draft')]}" string="Service Type" domain="['|',('category','=','service'),('category','=','both')]" required="1"/>
|
||||
<field name="amount" attrs="{'readonly':[('state','!=','draft'),('edit_access', '!=', True)]}"/>
|
||||
<xpath expr="//form" position="replace">
|
||||
<form>
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<header>
|
||||
<button name="create_invoice"
|
||||
groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor"
|
||||
type="object" states="approve" class="oe_highlight" string="Create Invoice"/>
|
||||
<button name="action_confirm"
|
||||
groups="odex_fleet.fleet_group_account,odex_fleet.fleet_group_supervisor"
|
||||
type="object" states="draft" class="oe_highlight" string="Confirm"/>
|
||||
<button name="action_approve" groups="odex_fleet.fleet_group_gm" type="object"
|
||||
states="confirm" class="oe_highlight" string="Approve"/>
|
||||
<button name="action_cancel" groups="odex_fleet.fleet_group_supervisor" type="object"
|
||||
states="draft" class="oe_highlight" string="Cancel"/>
|
||||
<button name="action_refuse" groups="odex_fleet.fleet_group_gm" type="object"
|
||||
states="confirm" class="oe_highlight" string="Refuse"/>
|
||||
<button name="set_to_draft" groups="odex_fleet.fleet_group_draft" type="object"
|
||||
states="refused,cancel" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="status" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group col="2">
|
||||
<group string="Services Details">
|
||||
<field name="vehicle_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="cost_subtype_id" attrs="{'readonly':[('state','!=','draft')]}"
|
||||
string="Service Type"
|
||||
domain="['|',('category','=','service'),('category','=','both')]"
|
||||
required="1"/>
|
||||
<field name="amount"
|
||||
attrs="{'readonly':[('state','!=','draft'),('edit_access', '!=', True)]}"/>
|
||||
</group>
|
||||
<group string="Account Details">
|
||||
<field name="branch_id"/>
|
||||
<field name="partner_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="account_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="invoice_id" readonly="1" force_save="1"/>
|
||||
</group>
|
||||
<group string="Odometer Details">
|
||||
<label for="odometer"/>
|
||||
<div class="o_row">
|
||||
<field name="odometer" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="odometer_unit" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Account Details">
|
||||
<field name="branch_id"/>
|
||||
<field name="partner_id" attrs="{'readonly':[('state','!=','draft')]}" />
|
||||
<field name="account_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="invoice_id" readonly="1" force_save="1"/>
|
||||
<group col="2">
|
||||
<group string="Additional Details">
|
||||
<field name="date" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="purchaser_id" required="0" invisible="1"/>
|
||||
<field name="vendor_id" required="0" invisible="1"/>
|
||||
<!-- <field name="service_type_id" /> -->
|
||||
<field name="inv_ref" required="0" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="edit_access" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Odometer Details">
|
||||
<label for="odometer"/>
|
||||
<div class="o_row">
|
||||
<field name="odometer" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="odometer_unit" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group string="Additional Details">
|
||||
<field name="date" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="purchaser_id" required="0" invisible="1"/>
|
||||
<field name="vendor_id" required="0" invisible="1"/>
|
||||
<!-- <field name="service_type_id" /> -->
|
||||
<field name="inv_ref" required="0" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="edit_access" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group string="Included Services">
|
||||
<field name="cost_ids" required="1" nolabel="1" attrs="{'readonly':[('state','!=','draft'),('edit_access', '!=', True)]}">
|
||||
<tree string="Included Services" editable="bottom">
|
||||
<field name="cost_subtype_id" required="1" string="Service" domain="[('category','=','service')]"/>
|
||||
<field name="number" required="1"/>
|
||||
<field name="amount" required="1" sum="Price" string="Indicative Cost"/>
|
||||
<field name="total" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="Notes">
|
||||
<field nolabel="1" attrs="{'readonly':[('state','!=','draft')]}" name="notes" placeholder="Write here any other information related to the service completed."/>
|
||||
</group>
|
||||
</sheet>
|
||||
<group string="Included Services">
|
||||
<field name="cost_ids" required="1" nolabel="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('edit_access', '!=', True)]}">
|
||||
<tree string="Included Services" editable="bottom">
|
||||
<field name="cost_subtype_id" required="1" string="Service"
|
||||
domain="[('category','=','service')]"/>
|
||||
<field name="number" required="1"/>
|
||||
<field name="amount" required="1" sum="Price" string="Indicative Cost"/>
|
||||
<field name="total" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="Notes">
|
||||
<field nolabel="1" attrs="{'readonly':[('state','!=','draft')]}" name="notes"
|
||||
placeholder="Write here any other information related to the service completed."/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</xpath>
|
||||
|
||||
|
|
@ -815,26 +878,43 @@
|
|||
</record>
|
||||
|
||||
<record id='odex_fleet_vehicle_log_services_view_tree' model='ir.ui.view'>
|
||||
<field name="name">odex.vehicle.log.services.tree</field>
|
||||
<field name="model">fleet.vehicle.log.services</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_log_services_view_tree"/>
|
||||
<field name="name">odex.vehicle.log.services.tree</field>
|
||||
<field name="model">fleet.vehicle.log.services</field>
|
||||
<field name="inherit_id" ref="fleet.fleet_vehicle_log_services_view_tree"/>
|
||||
|
||||
<field name="arch" type="xml">
|
||||
<field name="inv_ref" position="after" >
|
||||
<field name="state" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="inv_ref" position="after">
|
||||
<field name="state"/>
|
||||
</field>
|
||||
<field name="purchaser_id" position="replace">
|
||||
<field name="employee_id"/>
|
||||
</field>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
<field name="service_type_id" position="replace">
|
||||
<field name="cost_subtype_id"/>
|
||||
</field>
|
||||
|
||||
<field name="vendor_id" position="replace">
|
||||
<field name="partner_id"/>
|
||||
</field>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- menu overwrite-->
|
||||
<menuitem action="fleet.fleet_vehicle_model_action" groups="fleet.fleet_group_user" parent="fleet.fleet_configuration" id="fleet.fleet_vehicle_model_menu" sequence="1"/>
|
||||
<menuitem action="fleet.fleet_vehicle_model_brand_action" groups="fleet.fleet_group_user" parent="fleet.fleet_configuration" id="fleet.fleet_vehicle_model_brand_menu" sequence="2"/>
|
||||
|
||||
<menuitem action="fleet.fleet_vehicle_log_contract_action" parent="fleet.fleet_vehicles" id="fleet.fleet_vehicle_log_contract_menu" groups="fleet.fleet_group_user,fleet_group_hr_officer"/>
|
||||
<menuitem action="fleet.fleet_vehicle_service_types_action" parent="fleet.fleet_configuration" groups="fleet.fleet_group_user" id="fleet.fleet_vehicle_service_types_menu" sequence="3"/>
|
||||
<menuitem id="fleet.fleet_vehicle_tag_menu" parent="fleet.fleet_configuration" action="fleet.fleet_vehicle_tag_action" groups="fleet.fleet_group_user" sequence="112"/>
|
||||
<menuitem action="fleet.fleet_vehicle_model_action" groups="fleet.fleet_group_user"
|
||||
parent="fleet.fleet_configuration" id="fleet.fleet_vehicle_model_menu" sequence="1"/>
|
||||
<menuitem action="fleet.fleet_vehicle_model_brand_action" groups="fleet.fleet_group_user"
|
||||
parent="fleet.fleet_configuration" id="fleet.fleet_vehicle_model_brand_menu" sequence="2"/>
|
||||
|
||||
<menuitem action="fleet.fleet_vehicle_log_contract_action" parent="fleet.fleet_vehicles"
|
||||
id="fleet.fleet_vehicle_log_contract_menu" groups="fleet.fleet_group_user,fleet_group_hr_officer"
|
||||
active="False"/>
|
||||
<menuitem action="fleet.fleet_vehicle_service_types_action" parent="fleet.fleet_configuration"
|
||||
groups="fleet.fleet_group_user" id="fleet.fleet_vehicle_service_types_menu" sequence="3"/>
|
||||
<menuitem id="fleet.fleet_vehicle_tag_menu" parent="fleet.fleet_configuration"
|
||||
action="fleet.fleet_vehicle_tag_action" groups="fleet.fleet_group_user" sequence="112"/>
|
||||
|
||||
|
||||
</data>
|
||||
|
|
|
|||
Loading…
Reference in New Issue