From dcab4afda48b54b16a0f1ac36b26b66177ca3c4a Mon Sep 17 00:00:00 2001 From: fwi-odoo Date: Tue, 19 Jul 2016 10:20:41 +0200 Subject: [PATCH] [MOV] account_check_printing: merge account_journal dashboard methods and views into account_journal --- addons/account_check_printing/__openerp__.py | 1 - .../account_check_printing/models/__init__.py | 1 - .../models/account_journal.py | 29 +++++++++++++++ .../models/account_journal_dashboard.py | 35 ------------------- .../views/account_journal_dashboard_views.xml | 24 ------------- .../views/account_journal_views.xml | 21 +++++++++++ 6 files changed, 50 insertions(+), 61 deletions(-) delete mode 100644 addons/account_check_printing/models/account_journal_dashboard.py delete mode 100644 addons/account_check_printing/views/account_journal_dashboard_views.xml diff --git a/addons/account_check_printing/__openerp__.py b/addons/account_check_printing/__openerp__.py index 93ce80a6ea7..c65c51d7c38 100644 --- a/addons/account_check_printing/__openerp__.py +++ b/addons/account_check_printing/__openerp__.py @@ -13,7 +13,6 @@ The check settings are located in the accounting journals configuration page. 'depends': ['account'], 'data': [ 'data/account_check_printing_data.xml', - 'views/account_journal_dashboard_views.xml', 'views/account_journal_views.xml', 'views/account_payment_views.xml', 'wizard/print_prenumbered_checks_views.xml' diff --git a/addons/account_check_printing/models/__init__.py b/addons/account_check_printing/models/__init__.py index 9c4ae23a06d..b07a9ea0961 100644 --- a/addons/account_check_printing/models/__init__.py +++ b/addons/account_check_printing/models/__init__.py @@ -2,5 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import account_journal -import account_journal_dashboard import account_payment diff --git a/addons/account_check_printing/models/account_journal.py b/addons/account_check_printing/models/account_journal.py index 7470787d322..7764eb288eb 100644 --- a/addons/account_check_printing/models/account_journal.py +++ b/addons/account_check_printing/models/account_journal.py @@ -76,3 +76,32 @@ class AccountJournal(models.Model): bank_journal.write({ 'outbound_payment_method_ids': [(4, check_printing.id, None)], }) + + @api.multi + def get_journal_dashboard_datas(self): + domain_checks_to_print = [ + ('journal_id', '=', self.id), + ('payment_method_id.code', '=', 'check_printing'), + ('state', '=', 'posted') + ] + return dict( + super(AccountJournal, self).get_journal_dashboard_datas(), + num_checks_to_print=len(self.env['account.payment'].search(domain_checks_to_print)) + ) + + @api.multi + def action_checks_to_print(self): + return { + 'name': _('Checks to Print'), + 'type': 'ir.actions.act_window', + 'view_mode': 'list,form,graph', + 'res_model': 'account.payment', + 'context': dict( + self.env.context, + search_default_checks_to_send=1, + journal_id=self.id, + default_journal_id=self.id, + default_payment_type='outbound', + default_payment_method_id=self.env.ref('account_check_printing.account_payment_method_check').id, + ), + } diff --git a/addons/account_check_printing/models/account_journal_dashboard.py b/addons/account_check_printing/models/account_journal_dashboard.py deleted file mode 100644 index 3b1fc1b93cc..00000000000 --- a/addons/account_check_printing/models/account_journal_dashboard.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -from openerp import models, api, _ - -class account_journal(models.Model): - _inherit = "account.journal" - - @api.multi - def get_journal_dashboard_datas(self): - domain_checks_to_print = [ - ('journal_id', '=', self.id), - ('payment_method_id.code', '=', 'check_printing'), - ('state','=','posted') - ] - return dict( - super(account_journal, self).get_journal_dashboard_datas(), - num_checks_to_print=len(self.env['account.payment'].search(domain_checks_to_print)) - ) - - @api.multi - def action_checks_to_print(self): - return { - 'name': _('Checks to Print'), - 'type': 'ir.actions.act_window', - 'view_mode': 'list,form,graph', - 'res_model': 'account.payment', - 'context': dict( - self.env.context, - search_default_checks_to_send=1, - journal_id=self.id, - default_journal_id=self.id, - default_payment_type='outbound', - default_payment_method_id=self.env.ref('account_check_printing.account_payment_method_check').id, - ), - } diff --git a/addons/account_check_printing/views/account_journal_dashboard_views.xml b/addons/account_check_printing/views/account_journal_dashboard_views.xml deleted file mode 100644 index 8ce220b7eee..00000000000 --- a/addons/account_check_printing/views/account_journal_dashboard_views.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - account.journal.dashboard.kanban.inherited - account.journal - - - - - - - - - diff --git a/addons/account_check_printing/views/account_journal_views.xml b/addons/account_check_printing/views/account_journal_views.xml index 9f180bb099b..8aaed6a59b4 100644 --- a/addons/account_check_printing/views/account_journal_views.xml +++ b/addons/account_check_printing/views/account_journal_views.xml @@ -1,6 +1,27 @@ + + account.journal.dashboard.kanban.inherited + account.journal + + + + + + + + account.journal.form.inherited account.journal