Browse Source

[ADD] foundations for new balance common report wizard

pull/367/head
Thomas Rehn 9 years ago
committed by Jordi Ballester
parent
commit
0415bc47b5
  1. 4
      account_financial_report_qweb/__openerp__.py
  2. 16
      account_financial_report_qweb/views/report_menus.xml
  3. 1
      account_financial_report_qweb/wizard/__init__.py
  4. 62
      account_financial_report_qweb/wizard/balance_common_wizard.py
  5. 100
      account_financial_report_qweb/wizard/balance_common_wizard_view.xml

4
account_financial_report_qweb/__openerp__.py

@ -10,15 +10,19 @@
OCA Financial Reports
""",
'author': 'Camptocamp SA,'
'initOS GmbH,'
'Odoo Community Association (OCA)',
'website': 'http://www.camptocamp.com',
'depends': [
'account',
# 'date_range',
],
'data': [
'wizard/aged_partner_balance_wizard_view.xml',
'wizard/ledger_report_wizard_view.xml',
'report_menus.xml',
'wizard/balance_common_wizard_view.xml',
'views/report_menus.xml',
],
'test': [
],

16
account_financial_report_qweb/views/report_menus.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem icon="STOCK_PRINT" name="Balance Sheet Wizards"
parent="account.menu_finance_reports"
groups="account.group_account_manager,account.group_account_user" id="menu_account_balance_common"/>
<menuitem icon="STOCK_PRINT" name="Partner Balance"
parent="menu_account_balance_common" action="action_account_partner_balance_wizard_view"
groups="account.group_account_manager,account.group_account_user" id="menu_account_partner_balance_report"/>
<menuitem icon="STOCK_PRINT" name="Trial Balance"
parent="menu_account_balance_common" action="action_account_trial_balance_wizard_view"
groups="account.group_account_manager,account.group_account_user" id="menu_account_trial_balance_report"/>
</data>
</openerp>

1
account_financial_report_qweb/wizard/__init__.py

@ -4,3 +4,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import aged_partner_balance_wizard
from . import ledger_report_wizard
from . import balance_common_wizard

62
account_financial_report_qweb/wizard/balance_common_wizard.py

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
# Author: Thomas Rehn, Guewen Baconnier
# Copyright 2016 initOS GmbH, camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class AccountBalanceCommonWizard(models.TransientModel):
"""Will launch some balance report wizards and pass required args"""
_inherit = "account.common.account.report"
_name = "account.common.balance.report"
_description = "Common Balance Report"
@api.model
def _get_account_ids(self):
context = self.env.context or {}
res = False
if context.get('active_model', False) == 'account.account' \
and context.get('active_ids', False):
res = context['active_ids']
return res
account_ids = fields.Many2many(
comodel_name='account.account',
string='Filter on accounts',
help="Only selected accounts will be printed. Leave empty to \
print all accounts.",
default=_get_account_ids
)
# date_range = fields.Many2one(
# comodel_name='date.range',
# string='Date Range',
# )
# comparison_date_range = fields.Many2one(
# comodel_name='date.range',
# string='Date Range',
# )
comparison_date_start = fields.Datetime(
string='Start Date'
)
comparison_date_end = fields.Datetime(
string='End Date'
)
partner_ids = fields.Many2many(
comodel_name='res.partner',
string='Filter on partner',
help="Only selected partners will be printed. \
Leave empty to print all partners."
)
debit_credit = fields.Boolean(
string='Display Debit/Credit Columns',
help="This option allows you to get more details about the way your "
"balances are computed. Because it is space consuming, "
"we do not allow to use it while doing a comparison."
)
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountBalanceCommonWizard, self).pre_print_report(
cr, uid, ids, data, context)
return data

100
account_financial_report_qweb/wizard/balance_common_wizard_view.xml

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_balance_common_wizard_view" model="ir.ui.view">
<field name="name">Balance Common Wizard</field>
<field name="model">account.common.balance.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<field name="company_id" position="before">
<separator string="Partner Balance" colspan="4"/>
<label nolabel="1" colspan="4" string="This report is an analysis done by a partner, It is a PDF report containing one line per partner representing the cumulative credit balance"/>
</field>
<!--<field name="company_id" position='attributes'>
<attribute name="colspan">4</attribute>
<attribute name="invisible">0</attribute>
<attribute name="readonly">0</attribute>
</field>-->
<field name="company_id" position='replace'>
<group name="main_info">
<field name="company_id" readonly="0"/>
</group>
</field>
<field name="target_move" position="after">
<!--<field name="date_range"/>-->
<newline/>
</field>
<field name="date_to" position="after">
<newline/>
<field name="debit_credit"/>
</field>
<footer position="before">
<notebook>
<page string="Accounts Filters" name="accounts">
<separator string="Print only" colspan="4"/>
<field name="account_ids" colspan="4" nolabel="1" domain="[('type', 'in', ['receivable', 'payable'])]">
<tree>
<field name="code"/>
<field name="name"/>
<field name="user_type_id"/>
<field name="company_id"/>
</tree>
</field>
</page>
<page string="Partners Filters" name="accounts">
<separator string="Print only" colspan="4"/>
<field name="partner_ids" colspan="4" nolabel="1"/>
</page>
<page string="Comparison" name="comparison">
<group>
<!--<field name="comparison_date_range"/>-->
<field name="comparison_date_start"/>
<field name="comparison_date_end"/>
</group>
</page>
</notebook>
</footer>
<field name="journal_ids" position="attributes">
<attribute name="invisible">True</attribute>
</field>
</data>
</field>
</record>
<record id="action_account_partner_balance_wizard_view" model="ir.actions.act_window">
<field name="name">Partner Balance</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.common.balance.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_balance_common_wizard_view"/>
<field name="target">new</field>
<field name="context">{'balance_common': 'partner_balance'}</field>
</record>
<record id="action_account_trial_balance_wizard_view" model="ir.actions.act_window">
<field name="name">Trial Balance</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.common.balance.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_balance_common_wizard_view"/>
<field name="target">new</field>
<field name="context">{'balance_common': 'trial_balance'}</field>
</record>
<record model="ir.values" id="action_account_balance_common_wizard_view_values">
<field name="model_id" ref="account.model_account_account"/>
<field name="name">Partner Balance</field>
<field name="key2">client_print_multi</field>
<field name="value"
eval="'ir.actions.act_window,' +str(ref('action_account_partner_balance_wizard_view'))"/>
<field name="key">action</field>
<field name="model">account.account</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save