From 3b63b3a4d74de82bf07a95629ef1e76cac2bcfb1 Mon Sep 17 00:00:00 2001 From: shreya thakrar Date: Tue, 17 Dec 2019 06:13:55 +0000 Subject: [PATCH] [IMP] account: add kanban view for the 'Generated Documents' This commits adds kanban view for the 'Generated Documents' for better readability on mobile devices. Also, for consistency, this commit adds 'Upload' button on the invoice kanban view as well. Task-ID: 2152183 --- addons/account/__manifest__.py | 2 +- addons/account/models/account_journal.py | 4 ++-- .../{bills_tree_upload.js => bills_upload.js} | 23 +++++++++++++++++++ ...pload_views.xml => bills_upload_views.xml} | 8 +++++++ addons/account/views/account.xml | 2 +- addons/account/views/account_move_views.xml | 2 +- 6 files changed, 36 insertions(+), 5 deletions(-) rename addons/account/static/src/js/{bills_tree_upload.js => bills_upload.js} (84%) rename addons/account/static/src/xml/{bills_tree_upload_views.xml => bills_upload_views.xml} (76%) diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 1617407b2af..7ed8cc554d6 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -84,7 +84,7 @@ You could use this simplified accounting in case you work with an (external) acc "static/src/xml/account_payment.xml", 'static/src/xml/account_resequence.xml', "static/src/xml/account_report_backend.xml", - "static/src/xml/bills_tree_upload_views.xml", + "static/src/xml/bills_upload_views.xml", 'static/src/xml/account_journal_activity.xml', 'static/src/xml/grouped_view_widget.xml', 'static/src/xml/tax_group.xml', diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index 295c63d2b5f..c38d4ab3967 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -670,8 +670,8 @@ class AccountJournal(models.Model): }) else: action_vals.update({ - 'views': [[False, "tree"], [False, "form"]], - 'view_mode': 'tree,form', + 'views': [[False, "tree"], [False, "kanban"], [False, "form"]], + 'view_mode': 'tree, kanban, form', }) return action_vals diff --git a/addons/account/static/src/js/bills_tree_upload.js b/addons/account/static/src/js/bills_upload.js similarity index 84% rename from addons/account/static/src/js/bills_tree_upload.js rename to addons/account/static/src/js/bills_upload.js index 2894b86844a..7b0a3fa3f9f 100644 --- a/addons/account/static/src/js/bills_tree_upload.js +++ b/addons/account/static/src/js/bills_upload.js @@ -86,6 +86,29 @@ odoo.define('account.bills.tree', function (require) { viewRegistry.add('account_tree', BillsListView); }); +odoo.define('account.bills.kanban', function (require) { + var KanbanController = require('web.KanbanController'); + var KanbanView = require('web.KanbanView'); + var UploadBillMixin = require('account.upload.bill.mixin'); + var viewRegistry = require('web.view_registry'); + + var BillsKanbanController = KanbanController.extend(UploadBillMixin, { + buttons_template: 'BillsKanbanView.buttons', + events: _.extend({}, KanbanController.prototype.events, { + 'click .o_button_upload_bill': '_onUpload', + 'change .o_vendor_bill_upload .o_form_binary_form': '_onAddAttachment', + }), + }); + + var BillsKanbanView = KanbanView.extend({ + config: _.extend({}, KanbanView.prototype.config, { + Controller: BillsKanbanController, + }), + }); + + viewRegistry.add('account_bills_kanban', BillsKanbanView); +}); + odoo.define('account.dashboard.kanban', function (require) { "use strict"; var core = require('web.core'); diff --git a/addons/account/static/src/xml/bills_tree_upload_views.xml b/addons/account/static/src/xml/bills_upload_views.xml similarity index 76% rename from addons/account/static/src/xml/bills_tree_upload_views.xml rename to addons/account/static/src/xml/bills_upload_views.xml index 32505e1206c..9decd5ad7fd 100644 --- a/addons/account/static/src/xml/bills_tree_upload_views.xml +++ b/addons/account/static/src/xml/bills_upload_views.xml @@ -20,4 +20,12 @@ + + + + + + diff --git a/addons/account/views/account.xml b/addons/account/views/account.xml index c0aa006db4c..9d6dab2778e 100644 --- a/addons/account/views/account.xml +++ b/addons/account/views/account.xml @@ -28,7 +28,7 @@ -