Merge pull request #44 from guewen/aged-balance-filters
Aged balance report: the only sensible filter is by end periodpull/59/head
commit
c9483f543c
|
@ -1516,3 +1516,8 @@ msgstr ""
|
||||||
msgid "{'required': [('filter', '=', 'filter_opening')]}"
|
msgid "{'required': [('filter', '=', 'filter_opening')]}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1320,3 +1320,8 @@ msgstr ""
|
||||||
#: field:trial.balance.webkit,comp2_filter:0
|
#: field:trial.balance.webkit,comp2_filter:0
|
||||||
msgid "Compare By"
|
msgid "Compare By"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -1320,3 +1320,8 @@ msgstr ""
|
||||||
#: field:trial.balance.webkit,comp2_filter:0
|
#: field:trial.balance.webkit,comp2_filter:0
|
||||||
msgid "Compare By"
|
msgid "Compare By"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -1367,3 +1367,8 @@ msgstr "¡Valor haber o debe erróneo en el asiento contable!"
|
||||||
#: field:trial.balance.webkit,comp2_filter:0
|
#: field:trial.balance.webkit,comp2_filter:0
|
||||||
msgid "Compare By"
|
msgid "Compare By"
|
||||||
msgstr "Comparar por"
|
msgstr "Comparar por"
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr "Al final de"
|
||||||
|
|
|
@ -1580,3 +1580,8 @@ msgstr ""
|
||||||
#: view:trial.balance.webkit:account_financial_report_webkit.account_trial_balance_view_webkit
|
#: view:trial.balance.webkit:account_financial_report_webkit.account_trial_balance_view_webkit
|
||||||
msgid "{'required': [('filter', '=', 'filter_opening')]}"
|
msgid "{'required': [('filter', '=', 'filter_opening')]}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr "À fin de"
|
||||||
|
|
|
@ -1366,3 +1366,8 @@ msgstr "Valore di credito o debito errato nella registrazione contabile!"
|
||||||
#: field:trial.balance.webkit,comp2_filter:0
|
#: field:trial.balance.webkit,comp2_filter:0
|
||||||
msgid "Compare By"
|
msgid "Compare By"
|
||||||
msgstr "Confronta per"
|
msgstr "Confronta per"
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -1320,3 +1320,8 @@ msgstr ""
|
||||||
#: field:trial.balance.webkit,comp2_filter:0
|
#: field:trial.balance.webkit,comp2_filter:0
|
||||||
msgid "Compare By"
|
msgid "Compare By"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report_webkit
|
||||||
|
#: view:account.aged.trial.balance.webkit:account_financial_report_webkit.account_aged_trial_balance_webkit
|
||||||
|
msgid "At the end of"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
!python {model: account.account}: |
|
!python {model: account.account}: |
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
ctx={}
|
ctx={}
|
||||||
data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)}
|
data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year),
|
||||||
|
'fiscalyear_id': ref('account.data_fiscalyear'),
|
||||||
|
'period_to': ref('account.period_12')}
|
||||||
from openerp.tools import test_reports
|
from openerp.tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
||||||
|
|
||||||
|
@ -16,7 +18,8 @@
|
||||||
ctx={}
|
ctx={}
|
||||||
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
||||||
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
||||||
'amount_currency': True, 'result_selection': 'customer_supplier'}
|
'amount_currency': True, 'result_selection': 'customer_supplier',
|
||||||
|
'period_to': ref('account.period_12')}
|
||||||
from openerp.tools import test_reports
|
from openerp.tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
||||||
|
|
||||||
|
@ -29,7 +32,8 @@
|
||||||
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
||||||
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
||||||
'amount_currency': True, 'result_selection': 'customer_supplier',
|
'amount_currency': True, 'result_selection': 'customer_supplier',
|
||||||
'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]}
|
'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')],
|
||||||
|
'period_to': ref('account.period_12')}
|
||||||
from openerp.tools import test_reports
|
from openerp.tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
||||||
|
|
||||||
|
@ -42,19 +46,6 @@
|
||||||
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
||||||
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
||||||
'amount_currency': True, 'result_selection': 'customer_supplier',
|
'amount_currency': True, 'result_selection': 'customer_supplier',
|
||||||
'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')}
|
'filter': 'filter_period', 'period_to': ref('account.period_12')}
|
||||||
from openerp.tools import test_reports
|
|
||||||
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
|
||||||
|
|
||||||
-
|
|
||||||
In order to test the PDF Aged Partner Balance Report webkit wizard I will print report with filters on dates
|
|
||||||
-
|
|
||||||
!python {model: account.account}: |
|
|
||||||
from datetime import datetime
|
|
||||||
ctx={}
|
|
||||||
data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'),
|
|
||||||
'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted',
|
|
||||||
'amount_currency': True, 'result_selection': 'customer_supplier',
|
|
||||||
'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)}
|
|
||||||
from openerp.tools import test_reports
|
from openerp.tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from openerp.osv import orm
|
from datetime import date
|
||||||
|
from openerp.osv import orm, fields
|
||||||
|
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DATE_FORMAT
|
||||||
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
|
||||||
class AccountAgedTrialBalance(orm.TransientModel):
|
class AccountAgedTrialBalance(orm.TransientModel):
|
||||||
|
@ -31,6 +34,55 @@ class AccountAgedTrialBalance(orm.TransientModel):
|
||||||
_name = "account.aged.trial.balance.webkit"
|
_name = "account.aged.trial.balance.webkit"
|
||||||
_description = "Aged partner balanced"
|
_description = "Aged partner balanced"
|
||||||
|
|
||||||
|
def _get_current_fiscalyear(self, cr, uid, context=None):
|
||||||
|
user_obj = self.pool['res.users']
|
||||||
|
company = user_obj.browse(cr, uid, uid, context=context).company_id
|
||||||
|
fyear_obj = self.pool['account.period']
|
||||||
|
today = date.today().strftime(DATE_FORMAT)
|
||||||
|
fyear_ids = fyear_obj.search(
|
||||||
|
cr, uid,
|
||||||
|
[('date_start', '>=', today),
|
||||||
|
('date_stop', '<=', today),
|
||||||
|
('company_id', '=', company.id)],
|
||||||
|
limit=1,
|
||||||
|
context=context)
|
||||||
|
if fyear_ids:
|
||||||
|
return fyear_ids[0]
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'filter': fields.selection(
|
||||||
|
[('filter_period', 'Periods')],
|
||||||
|
"Filter by",
|
||||||
|
required=True),
|
||||||
|
'fiscalyear_id': fields.many2one(
|
||||||
|
'account.fiscalyear',
|
||||||
|
'Fiscal Year',
|
||||||
|
required=True),
|
||||||
|
'period_to': fields.many2one('account.period', 'End Period',
|
||||||
|
required=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'filter': 'filter_period',
|
||||||
|
'fiscalyear_id': _get_current_fiscalyear,
|
||||||
|
}
|
||||||
|
|
||||||
|
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False,
|
||||||
|
period_id=False, date_to=False, until_date=False,
|
||||||
|
context=None):
|
||||||
|
res = super(AccountAgedTrialBalance, self).onchange_fiscalyear(
|
||||||
|
cr, uid, ids, fiscalyear=fiscalyear, period_id=period_id,
|
||||||
|
date_to=date_to, until_date=until_date, context=context
|
||||||
|
)
|
||||||
|
filters = self.onchange_filter(cr, uid, ids, filter='filter_period',
|
||||||
|
fiscalyear_id=fiscalyear,
|
||||||
|
context=context)
|
||||||
|
res['value'].update({
|
||||||
|
'period_from': filters['value']['period_from'],
|
||||||
|
'period_to': filters['value']['period_to'],
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
|
||||||
def _print_report(self, cr, uid, ids, data, context=None):
|
def _print_report(self, cr, uid, ids, data, context=None):
|
||||||
# we update form with display account value
|
# we update form with display account value
|
||||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||||
|
|
|
@ -42,14 +42,17 @@
|
||||||
<field name="fiscalyear_id" position="attributes">
|
<field name="fiscalyear_id" position="attributes">
|
||||||
<attribute name="on_change">onchange_fiscalyear(fiscalyear_id, period_to, date_to, until_date)</attribute>
|
<attribute name="on_change">onchange_fiscalyear(fiscalyear_id, period_to, date_to, until_date)</attribute>
|
||||||
</field>
|
</field>
|
||||||
<field name="date_to" position="attributes">
|
<field name="filter" position="attributes">
|
||||||
<attribute name="on_change">onchange_date_to(fiscalyear_id, period_to, date_to, until_date)</attribute>
|
<attribute name="invisible">True</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="period_from" position="attributes">
|
||||||
|
<attribute name="invisible">True</attribute>
|
||||||
</field>
|
</field>
|
||||||
<field name="period_to" position="attributes">
|
<field name="period_to" position="attributes">
|
||||||
<attribute name="on_change">onchange_period_to(fiscalyear_id, period_to, date_to, until_date)</attribute>
|
<attribute name="on_change">onchange_period_to(fiscalyear_id, period_to, date_to, until_date)</attribute>
|
||||||
</field>
|
</field>
|
||||||
<field name="period_from" position="attributes">
|
<field name="period_to" position="attributes">
|
||||||
<attribute name="domain">[('fiscalyear_id', '=', fiscalyear_id), ('special', '=', False)]</attribute>
|
<attribute name="String">At the end of</attribute>
|
||||||
</field>
|
</field>
|
||||||
<field name="period_to" position="attributes">
|
<field name="period_to" position="attributes">
|
||||||
<attribute name="domain">[('fiscalyear_id', '=', fiscalyear_id), ('special', '=', False)]</attribute>
|
<attribute name="domain">[('fiscalyear_id', '=', fiscalyear_id), ('special', '=', False)]</attribute>
|
||||||
|
|
Loading…
Reference in New Issue