diff --git a/addons/fleet/__manifest__.py b/addons/fleet/__manifest__.py index 78653f91181552243f5066378c9883482c24bee8..813df720eb118d6a6ad546cbbf506deff61f5141 100644 --- a/addons/fleet/__manifest__.py +++ b/addons/fleet/__manifest__.py @@ -38,6 +38,7 @@ Main Features 'views/fleet_board_view.xml', 'views/mail_activity_views.xml', 'views/res_config_settings_views.xml', + 'views/assets.xml', 'data/fleet_cars_data.xml', 'data/fleet_data.xml', 'data/mail_data.xml', diff --git a/addons/fleet/static/src/js/fleet_kanban.js b/addons/fleet/static/src/js/fleet_kanban.js new file mode 100644 index 0000000000000000000000000000000000000000..e731146a26c2f30ed3f34abfc4c5bcf1a352a43e --- /dev/null +++ b/addons/fleet/static/src/js/fleet_kanban.js @@ -0,0 +1,20 @@ +odoo.define('fleet.fleet_kanban', function (require) { + 'use strict'; + + const KanbanRecord = require('web.KanbanRecord'); + + KanbanRecord.include({ + + /** + * @override + * @private + */ + _openRecord() { + if (this.modelName === 'fleet.vehicle.model.brand' && this.$(".oe_kanban_fleet_model").length) { + this.$('.oe_kanban_fleet_model').first().click(); + } else { + this._super.apply(this, arguments); + } + }, + }); +}); diff --git a/addons/fleet/views/assets.xml b/addons/fleet/views/assets.xml index 74c4a4954e07d7c9c7bcfea2a163da18880e3b81..97ce5f93e1905d8de5b77afaf2ee040f2a945c8f 100644 --- a/addons/fleet/views/assets.xml +++ b/addons/fleet/views/assets.xml @@ -3,6 +3,7 @@ <template id="assets_backend" inherit_id="web.assets_backend"> <xpath expr="script[last()]" position="after"> <script type="text/javascript" src="/fleet/static/src/js/fleet_form.js"/> + <script type="text/javascript" src="/fleet/static/src/js/fleet_kanban.js"/> </xpath> </template> </odoo> diff --git a/addons/fleet/views/fleet_vehicle_cost_views.xml b/addons/fleet/views/fleet_vehicle_cost_views.xml index 5c2a2ef7dd0b265295346444651fd2a176e8e44a..2bcacb487967907e8ac59888d72b0126fc365d92 100644 --- a/addons/fleet/views/fleet_vehicle_cost_views.xml +++ b/addons/fleet/views/fleet_vehicle_cost_views.xml @@ -107,7 +107,8 @@ </strong> </div> <div> - <field name="start_date"/> - <field name="expiration_date"/> + <t t-if="new Date(record.expiration_date.raw_value) < (new Date())" t-set="expiration_class" t-value="'oe_kanban_text_red'"/> + <span t-att-class="expiration_class"><field name="start_date"/> - <field name="expiration_date"/></span> </div> <div> <field name="insurer_id" widget="res_partner_many2one"/> @@ -222,8 +223,8 @@ <field name="purchaser_id"/> <label for="odometer"/> <div class="o_row"> - <field name="odometer"/> - <field name="odometer_unit"/> + <field name="odometer" class="oe_inline"/> + <field name="odometer_unit" class="pl-1 pl-sm-0"/> </div> </group> </group> @@ -281,8 +282,10 @@ <div class="o_kanban_record_headings pl-2 pr-2"> <div class="text-truncate o_kanban_record_title"> <strong> - <span class="float-right"><field name="date"/></span> <field name="vehicle_id"/> + <span t-attf-class="float-right badge #{['todo', 'running'].indexOf(record.state.raw_value) > -1 ? 'badge-secondary' : ['cancelled'].indexOf(record.state.raw_value) > -1 ? 'badge-danger' : 'badge-success'}"> + <field name="state"/> + </span> </strong> </div> <div class="text-truncate"> @@ -292,6 +295,7 @@ </div> <div class="text-truncate"> <field name="purchaser_id"/> + <span class="float-right"><field name="date"/></span> </div> <div class="text-truncate"> <field name="vendor_id"/> diff --git a/addons/fleet/views/fleet_vehicle_model_views.xml b/addons/fleet/views/fleet_vehicle_model_views.xml index e6a194ccba011b5104dc4f6779ca902074bf64a5..5f29756530f70a4363379015ea10501eb9b4aaf5 100644 --- a/addons/fleet/views/fleet_vehicle_model_views.xml +++ b/addons/fleet/views/fleet_vehicle_model_views.xml @@ -141,27 +141,33 @@ <field name="name">fleet.vehicle.model.brandkanban</field> <field name="model">fleet.vehicle.model.brand</field> <field name="arch" type="xml"> - <kanban> + <kanban default_order="name"> <field name="id"/> <field name="name" /> <templates> <t t-name="kanban-box"> <div class="oe_kanban_vignette oe_semantic_html_override oe_kanban_global_click"> - <a type="open" href="#" class="o_kanban_image oe_kanban_action"> - <img alt="Open" t-att-src="kanban_image('fleet.vehicle.model.brand', 'image_128', record.id.raw_value)" class="img-fluid" style="width:100px;"/> - </a> + <div class="o_dropdown_kanban dropdown"> + <a class="dropdown-toggle o-no-caret btn" role="button" data-toggle="dropdown" href="#" aria-label="Dropdown menu" title="Dropdown menu"> + <span class="fa fa-ellipsis-v"/> + </a> + <div class="dropdown-menu" role="menu"> + <a role="menuitem" type="open" class="dropdown-item">Properties</a> + </div> + </div> + <div class="o_kanban_image"> + <img alt="img" t-att-src="kanban_image('fleet.vehicle.model.brand', 'image_128', record.id.raw_value)" class="o_image_64_max" height="52"/> + </div> <div class="oe_kanban_details"> <h4 class="oe_partner_heading"> <a type="open" class="o_kanban_record_title"> <field name="name"/> </a> </h4> - </div> - <div class="o_kanban_button"> - <a type="object" name="action_brand_model" class="oe_kanban_action oe_kanban_action_a"> - <field name="model_count"/> - MODELS - </a> + <div> + <a type="object" name="action_brand_model" class="oe_kanban_fleet_model"/> + <field name="model_count"/> MODELS + </div> </div> </div> </t> diff --git a/addons/fleet/views/fleet_vehicle_views.xml b/addons/fleet/views/fleet_vehicle_views.xml index f987be4a47e44863f0dd57dc56a71a2d3b6c2bd2..f6cd3997696215a3dab4902dd1690858bcba8a71 100644 --- a/addons/fleet/views/fleet_vehicle_views.xml +++ b/addons/fleet/views/fleet_vehicle_views.xml @@ -309,10 +309,15 @@ <form string="Odometer Logs"> <sheet> <group> - <field name="vehicle_id"/> - <field name="value" class="oe_inline"/> - <field name="unit" class="oe_inline"/> - <field name="date" /> + <group> + <field name="vehicle_id"/> + <label for="value"/> + <div class="o_row"> + <field name="value" class="oe_inline"/> + <field name="unit" class="ml-2"/> + </div> + <field name="date"/> + </group> </group> </sheet> </form> @@ -343,12 +348,12 @@ <div t-attf-class="oe_kanban_global_click"> <div> <strong> - <field name="vehicle_id" widget="res_partner_many2one"/> + <field name="vehicle_id"/> <span class="float-right"><field name="date"/></span> </strong> </div> <div> - <span><field name="driver_id" widget="res_partner_many2one"/></span> + <span><field name="driver_id"/></span> <span class="float-right"><field name="value"/> Km</span> </div> </div> diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 23d4a3de3fa4db30145b065dabc7237cbff928fd..a82dc9d9100c482986c39cdb890f7f87c613a1fb 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -972,16 +972,16 @@ </table> </form> <t t-name="GraphView.buttons"> - <div class="btn-group" role="toolbar" aria-label="Main actions"/> - <div class="btn-group" role="toolbar" aria-label="Change graph"> + <div class="btn-group mb-2 mb-sm-auto" role="toolbar" aria-label="Main actions"/> + <div class="btn-group o_graph_align mb-2 mb-sm-auto" role="toolbar" aria-label="Change graph"> <button class="btn btn-secondary fa fa-bar-chart-o o_graph_button" title="Bar Chart" aria-label="Bar Chart" data-mode="bar"/> <button class="btn btn-secondary fa fa-area-chart o_graph_button" title="Line Chart" aria-label="Line Chart" data-mode="line"/> <button class="btn btn-secondary fa fa-pie-chart o_graph_button" title="Pie Chart" aria-label="Pie Chart" data-mode="pie"/> </div> - <div class="btn-group" role="toolbar" aria-label="Change graph"> + <div class="btn-group o_stack_align mb-2 mb-sm-auto" role="toolbar" aria-label="Change graph"> <button class="btn btn-secondary fa fa-database o_graph_button" title="Stacked" aria-label="Stacked" data-mode="stack"/> </div> - <div class="btn-group" role="toolbar" aria-label="Sort graph"> + <div class="btn-group o_sort_align mb-2 mb-sm-auto" role="toolbar" aria-label="Sort graph"> <button class="btn btn-secondary fa fa-sort-amount-desc o_graph_button" title="Descending" aria-label="Descending" data-order="desc"/> <button class="btn btn-secondary fa fa-sort-amount-asc o_graph_button" title="Ascending" aria-label="Ascending" data-order="asc"/> </div>