updates in fleet
This commit is contained in:
parent
8b04f0b061
commit
5ffa1de716
|
|
@ -37,11 +37,12 @@ class FormRenew(models.Model):
|
|||
|
||||
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")
|
||||
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")
|
||||
|
|
@ -55,7 +56,6 @@ class FormRenew(models.Model):
|
|||
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,7 +67,6 @@ 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',
|
||||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class FleetMaintenance(models.Model):
|
|||
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',
|
||||
|
|
@ -130,6 +130,9 @@ class FleetMaintenance(models.Model):
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class FleetVehicle(models.Model):
|
|||
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 )
|
||||
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")
|
||||
|
|
@ -122,14 +122,15 @@ class FleetVehicle(models.Model):
|
|||
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'
|
||||
|
|
@ -139,6 +140,7 @@ class FuelPrice(models.Model):
|
|||
price = fields.Float(string="Price")
|
||||
uom_id = fields.Many2one(related='fuel_type.uom_id', string='Unit of Measure', readonly=True)
|
||||
|
||||
|
||||
class CarCtegory(models.Model):
|
||||
_name = 'car.category'
|
||||
_description = 'Car Category'
|
||||
|
|
@ -146,10 +148,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 +169,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 +177,7 @@ class TransmissionType(models.Model):
|
|||
|
||||
transmission = fields.Char('Transmission')
|
||||
|
||||
|
||||
class InsuranceInstallment(models.Model):
|
||||
_name = 'insurance.installment'
|
||||
_description = 'Insurance Installment'
|
||||
|
|
@ -182,12 +188,11 @@ class InsuranceInstallment(models.Model):
|
|||
paid = fields.Date(string="Paid")
|
||||
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 +203,6 @@ class InsuranceInstallment(models.Model):
|
|||
# r.total = r.number * r.amount
|
||||
|
||||
|
||||
|
||||
# @api.onchange('vehicle_id')
|
||||
# def get_branch(self):
|
||||
# if self.vehicle_id:
|
||||
|
|
@ -222,7 +226,8 @@ class FleetVehicleCost(models.Model):
|
|||
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')
|
||||
odometer_unit = fields.Selection(related='vehicle_id.odometer_unit', string="Unit", readonly=True)
|
||||
|
|
@ -230,7 +235,7 @@ class FleetVehicleCost(models.Model):
|
|||
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)
|
||||
|
||||
|
|
@ -239,15 +244,11 @@ class FleetVehicleCost(models.Model):
|
|||
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
|
||||
|
||||
|
||||
|
||||
def _get_odometer(self):
|
||||
for record in self:
|
||||
if record.odometer_id:
|
||||
|
|
@ -285,7 +286,6 @@ class FleetVehicleCost(models.Model):
|
|||
return super(FleetVehicleCost, self).create(data)
|
||||
|
||||
|
||||
|
||||
class FleetVehicleLogServices(models.Model):
|
||||
_inherit = 'fleet.vehicle.log.services'
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ 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)
|
||||
|
|
@ -335,6 +335,7 @@ class FleetVehicleLogServices(models.Model):
|
|||
'fleet.service.type', 'Service Type', required=False,
|
||||
default=lambda self: self.env.ref('fleet.type_service_service_8', raise_if_not_found=False),
|
||||
)
|
||||
|
||||
@api.onchange('odometer')
|
||||
def onchange_odometer(self):
|
||||
for rec in self:
|
||||
|
|
@ -347,6 +348,10 @@ class FleetVehicleLogServices(models.Model):
|
|||
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.state = 'draft'
|
||||
|
||||
def action_confirm(self):
|
||||
self.sudo().status = 'confirm'
|
||||
|
||||
|
|
@ -371,7 +376,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,22 +403,23 @@ 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
|
||||
|
||||
|
||||
class FleetVehicleLogFuel(models.Model):
|
||||
_name = 'fleet.vehicle.log.fuel'
|
||||
_description = 'Fuel log for vehicles'
|
||||
|
|
@ -428,7 +434,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
|
||||
|
|
@ -439,15 +446,15 @@ class FleetVehicleLogFuel(models.Model):
|
|||
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)
|
||||
|
|
@ -465,7 +472,8 @@ class FleetVehicleLogFuel(models.Model):
|
|||
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')
|
||||
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")
|
||||
|
|
@ -475,7 +483,6 @@ class FleetVehicleLogFuel(models.Model):
|
|||
# (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,14 +502,16 @@ 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'):
|
||||
rec.edit_access = True
|
||||
|
||||
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:
|
||||
|
|
@ -528,8 +537,6 @@ class FleetVehicleLogFuel(models.Model):
|
|||
rec.amount = rec.liter * rec.price_per_liter
|
||||
rec.total_price_tax = round(rec.amount + rec.price_tax, 2)
|
||||
|
||||
|
||||
|
||||
# def get_account_data(self):
|
||||
# print("in herere============")
|
||||
# rec = self.env['fleet.account.config'].sudo().search([('type','=','fuel'),('state','=','confirm')],limit=1)
|
||||
|
|
@ -574,9 +581,6 @@ class FleetVehicleLogFuel(models.Model):
|
|||
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,
|
||||
|
|
@ -624,7 +628,8 @@ class FleetServiceConfig(models.Model):
|
|||
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")
|
||||
|
||||
|
|
@ -640,7 +645,8 @@ class FleetServiceConfig(models.Model):
|
|||
|
||||
@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)
|
||||
|
|
@ -663,4 +669,3 @@ class FleetServiceConfig(models.Model):
|
|||
})
|
||||
if d.type == 'odometer':
|
||||
d.get_next_odometer()
|
||||
|
||||
|
|
|
|||
|
|
@ -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'))]"/>
|
||||
|
|
|
|||
|
|
@ -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" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
|
|||
|
|
@ -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" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
@ -35,9 +36,9 @@
|
|||
</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="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="partner_id" attrs="{'readonly':[('invoice_id','!=',False)]}" required="1"/>
|
||||
<field name="account_id" readonly="0" force_save="1" required="1"/>
|
||||
<field name="tax_id" readonly="0" force_save="1" required="1"/> <field name="invoice_id" readonly="1" force_save="1"/>
|
||||
<field name="user_id" readonly="1" force_save="1"/>
|
||||
<field name="edit_access" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
<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="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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -157,11 +165,13 @@
|
|||
<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>
|
||||
</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.
|
||||
|
|
@ -215,7 +225,8 @@
|
|||
<field name="odometer_count" widget="statinfo" string="Odometer"/>
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<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"/>
|
||||
|
|
@ -227,14 +238,15 @@
|
|||
<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}"/>
|
||||
<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="vehicle_type" invisible="1"/>
|
||||
<field name="states"/>
|
||||
<field name="branch_id" domain="[('state_id', '=', states)]"/>
|
||||
<field name="owner_id" domain="[('car_owner','=',True)]"/>
|
||||
<field name="branch_id"/>
|
||||
<!-- <field name="owner_id" domain="[('car_owner','=',True)]" required="1"/>-->
|
||||
<field name="fleet_type_id" readonly="1"/>
|
||||
<field name="car_category"/>
|
||||
<field name="man_company" readonly="1"/>
|
||||
|
|
@ -287,17 +299,20 @@
|
|||
<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="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>
|
||||
|
|
@ -372,13 +387,15 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new type.
|
||||
</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" />
|
||||
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" />-->
|
||||
|
|
@ -427,13 +444,15 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Fuel Price.
|
||||
</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" />
|
||||
name="Fuel Price" parent="fleet.fleet_configuration" id="fuel_price_menu"
|
||||
groups="fleet.fleet_group_user,fleet_group_account" sequence="100"/>
|
||||
|
||||
<!-- Car Category -->
|
||||
<record id='fleet_car_category_view_form' model='ir.ui.view'>
|
||||
|
|
@ -471,13 +490,15 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Car Category.
|
||||
</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"/>
|
||||
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'>
|
||||
|
|
@ -516,7 +537,8 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new Manufacture Company.
|
||||
</p><p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -559,13 +581,15 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new transmission .
|
||||
</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"/>
|
||||
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'>
|
||||
|
|
@ -631,7 +655,8 @@
|
|||
<!-- -->
|
||||
<!-- <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-->
|
||||
|
|
@ -643,11 +668,20 @@
|
|||
<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"
|
||||
class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="state" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
|
||||
|
|
@ -659,12 +693,16 @@
|
|||
<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')]}"/>
|
||||
|
|
@ -691,7 +729,8 @@
|
|||
|
||||
</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>
|
||||
|
|
@ -729,7 +768,8 @@
|
|||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new fuel log.
|
||||
</p><p>
|
||||
</p>
|
||||
<p>
|
||||
Here you can add refuelling entries for all vehicles. You can
|
||||
also filter logs of a particular vehicle using the search
|
||||
field.
|
||||
|
|
@ -737,7 +777,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="fleet_vehicle_log_fuel_action" parent="fleet.fleet_vehicles" id="fleet_vehicle_log_fuel_menu" />
|
||||
<menuitem action="fleet_vehicle_log_fuel_action" parent="fleet.fleet_vehicles"
|
||||
id="fleet_vehicle_log_fuel_menu"/>
|
||||
|
||||
<!-- service log-->
|
||||
|
||||
|
|
@ -752,11 +793,20 @@
|
|||
<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="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" class="oe_highlight" string="Set To Draft"/>
|
||||
<field name="status" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
@ -764,8 +814,12 @@
|
|||
<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)]}"/>
|
||||
<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"/>
|
||||
|
|
@ -776,7 +830,8 @@
|
|||
<group string="Odometer Details">
|
||||
<label for="odometer"/>
|
||||
<div class="o_row">
|
||||
<field name="odometer" required="1" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="odometer" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="odometer_unit" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
</div>
|
||||
</group>
|
||||
|
|
@ -794,9 +849,11 @@
|
|||
</group>
|
||||
|
||||
<group string="Included Services">
|
||||
<field name="cost_ids" required="1" nolabel="1" attrs="{'readonly':[('state','!=','draft'),('edit_access', '!=', True)]}">
|
||||
<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="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"/>
|
||||
|
|
@ -804,7 +861,8 @@
|
|||
</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."/>
|
||||
<field nolabel="1" attrs="{'readonly':[('state','!=','draft')]}" name="notes"
|
||||
placeholder="Write here any other information related to the service completed."/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
|
|
@ -829,12 +887,16 @@
|
|||
|
||||
|
||||
<!-- 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_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_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