Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Facing problem finding profit and loss query, Can any one help me?

By
samba
on 9/8/14, 2:13 AM 978 views

I want to change the profit and loss query in openerp. Because i am planing to get the business units profit and loss report. I am tracing the each transaction using analytic account. The basic profit and loss not giving the reports based on analytic account. we are planing to get those. I have tried allot to find the profit and loss query. In my point of view what my final job is to add one more condition to profit and loss query, which filters the result based on Analytic account. Can any one tell me where i have to add this condition?

I am trying like this... I have activated "developer mode". The name of "print" button in profit and loss scren is "check_report" I have find this function in the file path is addons/accounts/wizard/account_financial_report.py The model of profit and loss is "accounting.report" inherited from "account.common.report". Can any one explain these two functions,

*************************************************************************************************************

def _build_comparison_context(self, cr, uid, ids, data, context=None):
        if context is None:
            context = {}
        result = {}
        result['fiscalyear'] = 'fiscalyear_id_cmp' in data['form'] and data['form']['fiscalyear_id_cmp'] or False
        result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
        result['chart_account_id'] = 'chart_account_id' in data['form'] and data['form']['chart_account_id'] or False
        result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
        if data['form']['filter_cmp'] == 'filter_date':
            result['date_from'] = data['form']['date_from_cmp']
            result['date_to'] = data['form']['date_to_cmp']
        elif data['form']['filter_cmp'] == 'filter_period':
            if not data['form']['period_from_cmp'] or not data['form']['period_to_cmp']:
                raise osv.except_osv(_('Error!'),_('Select a starting and an ending period'))
            result['period_from'] = data['form']['period_from_cmp']
            result['period_to'] = data['form']['period_to_cmp']
        return result

  ***************************************************************************************************************

  def check_report(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        res = super(accounting_report, self).check_report(cr, uid, ids, context=context)
        data = {}
        data['form'] = self.read(cr, uid, ids, ['account_report_id', 'date_from_cmp',  'date_to_cmp',  'fiscalyear_id_cmp', 'journal_ids', 'period_from_cmp', 'period_to_cmp',  'filter_cmp',  'chart_account_id', 'target_move'], context=context)[0]
        for field in ['fiscalyear_id_cmp', 'chart_account_id', 'period_from_cmp', 'period_to_cmp', 'account_report_id']:
            if isinstance(data['form'][field], tuple):
                data['form'][field] = data['form'][field][0]
        comparison_context = self._build_comparison_context(cr, uid, ids, data, context=context)
        res['datas']['form']['comparison_context'] = comparison_context
        return res

******************************************************************************************************************

As per my knowledge these two functions for get the wizard data perfectly to res variable. How the profit and loss report come out?  Where is the query to get that report?.

Don't ask the same question again... https://www.odoo.com/forum/help-1/question/how-can-i-change-profit-and-loss-report-query-62055. Think of a new title!

Matt Taylor
on 9/9/14, 12:13 PM
0
samba
On 9/9/14, 10:02 AM
0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 9/11/14, 10:53 AM

I am trying like this... I have activated "developer mode". The name of "print" button in profit and loss scren is "check_report" I have find this function in the file path is addons/accounts/wizard/account_financial_report.py The model of profit and loss is "accounting.report" inherited from "account.common.report". Can any one explain these two functions, ************************************************************************************************************* def _build_comparison_context(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} result['fiscalyear'] = 'fiscalyear_id_cmp' in data['form'] and data['form']['fiscalyear_id_cmp'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['chart_account_id'] = 'chart_account_id' in data['form'] and data['form']['chart_account_id'] or False result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' if data['form']['filter_cmp'] == 'filter_date': result['date_from'] = data['form']['date_from_cmp'] result['date_to'] = data['form']['date_to_cmp'] elif data['form']['filter_cmp'] == 'filter_period': if not data['form']['period_from_cmp'] or not data['form']['period_to_cmp']: raise osv.except_osv(_('Error!'),_('Select a starting and an ending period')) result['period_from'] = data['form']['period_from_cmp'] result['period_to'] = data['form']['period_to_cmp'] return result *************************************************************************************************************** def check_report(self, cr, uid, ids, context=None): if context is None: context = {} res = super(accounting_report, self).check_report(cr, uid, ids, context=context) data = {} data['form'] = self.read(cr, uid, ids, ['account_report_id', 'date_from_cmp', 'date_to_cmp', 'fiscalyear_id_cmp', 'journal_ids', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'chart_account_id', 'target_move'], context=context)[0] for field in ['fiscalyear_id_cmp', 'chart_account_id', 'period_from_cmp', 'period_to_cmp', 'account_report_id']: if isinstance(data['form'][field], tuple): data['form'][field] = data['form'][field][0] comparison_context = self._build_comparison_context(cr, uid, ids, data, context=context) res['datas']['form']['comparison_context'] = comparison_context return res ****************************************************************************************************************** As per my knowledge these two functions for get the wizard data perfectly to res variable. How the profit and loss report come out? Where is the query to get that report?.

samba
on 9/12/14, 3:45 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 9/8/14, 2:13 AM
Seen: 978 times
Last updated: 3/16/15, 8:10 AM