new api and conventions
parent
0eb262edfc
commit
129adaf283
|
@ -1,28 +1,11 @@
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Author: Guewen Baconnier, Leonardo Pistone
|
||||||
#
|
# © 2011-2016 Camptocamp
|
||||||
# Author: Guewen Baconnier
|
|
||||||
# Copyright Camptocamp SA 2011
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
from openerp.osv import fields, orm
|
from openerp import fields, models, api
|
||||||
|
|
||||||
|
|
||||||
class AccountPartnerBalanceWizard(orm.TransientModel):
|
class AccountPartnerBalanceWizard(models.TransientModel):
|
||||||
|
|
||||||
"""Will launch partner balance report and pass required args"""
|
"""Will launch partner balance report and pass required args"""
|
||||||
|
|
||||||
|
@ -30,34 +13,29 @@ class AccountPartnerBalanceWizard(orm.TransientModel):
|
||||||
_name = "partner.balance.webkit"
|
_name = "partner.balance.webkit"
|
||||||
_description = "Partner Balance Report"
|
_description = "Partner Balance Report"
|
||||||
|
|
||||||
_columns = {
|
result_selection = fields.Selection(
|
||||||
'result_selection': fields.selection(
|
|
||||||
[('customer', 'Receivable Accounts'),
|
[('customer', 'Receivable Accounts'),
|
||||||
('supplier', 'Payable Accounts'),
|
('supplier', 'Payable Accounts'),
|
||||||
('customer_supplier', 'Receivable and Payable Accounts')],
|
('customer_supplier', 'Receivable and Payable Accounts')],
|
||||||
"Partner's", required=True),
|
"Partner's", required=True, default='customer_supplier')
|
||||||
'partner_ids': fields.many2many(
|
partner_ids = fields.Many2many(
|
||||||
'res.partner', string='Filter on partner',
|
'res.partner', string='Filter on partner',
|
||||||
help="Only selected partners will be printed. \
|
help="Only selected partners will be printed. "
|
||||||
Leave empty to print all partners."),
|
"Leave empty to print all partners.")
|
||||||
}
|
|
||||||
|
|
||||||
_defaults = {
|
@api.multi
|
||||||
'result_selection': 'customer_supplier',
|
def pre_print_report(self, data):
|
||||||
}
|
self.ensure_one()
|
||||||
|
|
||||||
def pre_print_report(self, cr, uid, ids, data, context=None):
|
data = super(AccountPartnerBalanceWizard, self).pre_print_report(data)
|
||||||
data = super(AccountPartnerBalanceWizard, self).\
|
vals = self.read(['result_selection', 'partner_ids'])[0]
|
||||||
pre_print_report(cr, uid, ids, data, context)
|
|
||||||
vals = self.read(cr, uid, ids,
|
|
||||||
['result_selection', 'partner_ids'],
|
|
||||||
context=context)[0]
|
|
||||||
data['form'].update(vals)
|
data['form'].update(vals)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _print_report(self, cursor, uid, ids, data, context=None):
|
@api.multi
|
||||||
|
def _print_report(self, data):
|
||||||
# we update form with display account value
|
# we update form with display account value
|
||||||
data = self.pre_print_report(cursor, uid, ids, data, context=context)
|
data = self.pre_print_report(data)
|
||||||
|
|
||||||
return {'type': 'ir.actions.report.xml',
|
return {'type': 'ir.actions.report.xml',
|
||||||
'report_name': 'account.account_report_partner_balance_webkit',
|
'report_name': 'account.account_report_partner_balance_webkit',
|
||||||
|
|
Loading…
Reference in New Issue