Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledger_report into lp:openerp-ccorp-addons/6.1.
Requested reviews: CLEARCORP drivers (clearcorp-drivers) For more details, see: https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledger_report/+merge/163957 [ADD] Add module that create the general partner ledger report [FIX] Fix the account report library. Improve the get_move_lines method -- https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledger_report/+merge/163957 Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons/6.1.
=== added directory 'account_general_ledger_report' === added file 'account_general_ledger_report/__init__.py' --- account_general_ledger_report/__init__.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/__init__.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Addons modules by CLEARCORP S.A. +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). +# +# 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/>. +# +############################################################################## + +import report +import wizard \ No newline at end of file === added file 'account_general_ledger_report/__openerp__.py' --- account_general_ledger_report/__openerp__.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/__openerp__.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Addons modules by CLEARCORP S.A. +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). +# +# 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/>. +# +############################################################################## + +{ + 'name': 'General Partner Webkit Report', + 'version': '1.0', + 'url': 'http://launchpad.net/openerp-ccorp-addons', + 'author': 'ClearCorp S.A.', + 'website': 'http://clearcorp.co.cr', + 'category': 'Accounting & Finance', + 'complexity': 'normal', + 'description': """This module modifies the general ledger report""", + 'depends': [ + 'account', + 'account_webkit_report_library', + 'account_financial_report_webkit', + ], + 'init_xml': [], + 'demo_xml': [], + 'update_xml': ['report/report.xml', + 'wizard/account_general_ledger_report_wizard.xml', + 'report_menus.xml',], + 'license': 'AGPL-3', + 'installable': True, + 'active': False, +} \ No newline at end of file === added directory 'account_general_ledger_report/report' === added file 'account_general_ledger_report/report/__init__.py' --- account_general_ledger_report/report/__init__.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/report/__init__.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Addons modules by CLEARCORP S.A. +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). +# +# 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/>. +# +############################################################################## + +import account_general_ledger_report === added file 'account_general_ledger_report/report/account_general_ledger_report.mako' --- account_general_ledger_report/report/account_general_ledger_report.mako 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/report/account_general_ledger_report.mako 2013-05-15 14:27:49 +0000 @@ -0,0 +1,160 @@ +<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <link rel='stylesheet' href='addons/account_webkit_report_library/webkit_headers/main.css' /> + <style> + ${css} + </style> + </head> + <body> + <div class="table header"> + <div class="table-row"> + <div class="table-cell logo">${helper.embed_logo_by_name('internal_reports_logo', height=100)|n}</div> + <br/> + <div class="table-cell text"> + <p class="title">${_('General Ledger Report ')}</p> + </div> + </div> + </div> + <% + chart_account = get_chart_account_id(data) + fiscalyear = get_fiscalyear(data) + filter = get_filter(data) + %> + <div class="table list"> + <div class="table-header"> + <div class="table-row labels no-wrap"> + <div class="table-cell first-column" style="width: 70px">${_('Chart of Accounts: ')}<br/>${chart_account.name}</div> + <div class="table-cell" style="width: 70px">${_('Fiscal Year: ')}<br/>${fiscalyear.name}</div> + <div class="table-cell" style="width: 70px">${_('Filter by: ')}<br/> + %if filter == 'filter_date': + <% + start_date = get_start_date(data) + stop_date = get_stop_date(data) + %> + ${_('Dates: ')}<br/> + ${formatLang(start_date, date=True) if start_date else u'' } - ${formatLang(stop_date, date=True) if start_date else u'' } + %elif filter == 'filter_period': + <% + start_period = get_start_period(data) + stop_period = get_end_period(data) + %> + ${_('Period: ')}<br/> + ${start_period.name if start_period else u''} - ${stop_period.name if stop_period else u'' } + %else: + ${_('No filter')} + %endif + </div> + <div class="table-cell" style="width: 70px">${_('Accounts: ')}<br/> + %if accounts(data): + %for account in accounts(data): + ${(account.code) + ','}<br/> + %endfor + %else: + ${_('All')} + %endif + </div> + <div class="table-cell" style="width: 70px">${_('Target moves: ')}<br/>${ display_target_move(data) }</div> + </div> + </div> + </div> + <% + account_lines, account_balance, account_conciliation = get_data(cr, uid, data) + %> + %for account, move_lines in account_lines.items(): + <% + count = 1 + cumul_balance_ant = 0 + cumul_balance_ac = 0 + amount_total_debit = amount_total_credit = amount_total_acum = 0.0 + %> + <br/><br/> + <div class="table header"> + <div class="table-row"> + <div class="table-cell text"> + <p class="subtitle">${account.code +' - ' +account.name}</p> + <p class="subtitle">${_('Initial balance:')} ${formatLang(account_balance[account.id]['balance'])}</p> + </div> + </div> + </div> + <div class="table list"> + <div class="table-header"> + <div class="table-row labels no-wrap"> + <div class="table-cell first-column" style="width: 70px">${_('Date')}</div> + <div class="table-cell" style="width: 70px">${_('Period')}</div> + <div class="table-cell" style="width: 70px">${_('Entry')}</div> + <div class="table-cell" style="width: 70px">${_('Journal')}</div> + <div class="table-cell" style="width: 100px">${_('Partner')}</div> + <div class="table-cell" style="width: 100px">${_('Label')}</div> + %if len(account_conciliation) > 0: + <div class="table-cell" style="width: 70px">${_('Reconcile')}</div> + %endif + <div class="table-cell" style="width: 80px">${_('Debit')}</div> + <div class="table-cell" style="width: 80px">${_('Credit')}</div> + <div class="table-cell amount last-column" style="width: 80px">${_('Cumul. Bal.')}</div> + </div> + </div> + <div class="table-body"> + %for line in move_lines: + <% + move_names = extract_name_move(cr, uid, move_lines) + + amount_total_debit += line.debit + amount_total_credit += line.credit + %> + <div class="table-row ${row_even and 'even' or 'odd'}"> + <div class="table-cell first-column" style="width: 70px">${formatLang(line.date, date=True)}</div> + <div class="table-cell" style="width: 70px">${line.period_id.name or ''}</div> + <div class="table-cell" style="width: 70px">${move_names[line.id]}</div> + <div class="table-cell" style="width: 70px">${line.journal_id.name}</div> + <div class="table-cell" style="width: 100px">${line.partner_id.name or ''}</div> + <div class="table-cell" style="width: 100px">${line.name or ''}</div> + %if len(account_conciliation) > 0: + <div class="table-cell" style="width: 70px"> + %for conciliation in account_conciliation[account.id][line.id]: + ${conciliation or ''} + %endfor + </div> + %endif + <div class="table-cell amount" style="width: 80px">${formatLang(line.debit)}</div> + <div class="table-cell amount" style="width: 80px">${formatLang(line.credit)}</div> + %if count == 1: + <% + cumul_balance_ant = account_balance[account.id]['balance'] + %> + <div class="table-cell amount last-column" style="width: 80px">${formatLang(cumul_balance_ant)}</div> + <% count +=1 %> + %else: + <% + cumul_balance_ac = cumul_balance_ant + line.debit - line.credit + cumul_balance_ant = cumul_balance_ac + %> + <div class="table-cell amount last-column" style="width: 80px">${formatLang(cumul_balance_ac)}</div> + <% count +=1 %> + %endif + + </div> + %endfor + <div class="table-row spacer"> + <div class="table-cell"> </div> + </div> + <div class="table-row subtotal"> + <div class="table-cell first-column"> </div> + <div class="table-cell"> </div> + <div class="table-cell"> </div> + <div class="table-cell"> </div> + <div class="table-cell"> </div> + <div class="table-cell"> </div> + <div class="table-cell">${_('TOTAL')}</div> + <div class="table-cell amount" >${formatLang(amount_total_debit)}</div> + <div class="table-cell amount" >${formatLang(amount_total_credit)}</div> + <div class="table-cell amount last-column" >${formatLang(cumul_balance_ac)}</div> + </div> + <% + amount_total_debit = amount_total_credit = 0.0 + %> + </div> + </div> + %endfor + </body> +</html> === added file 'account_general_ledger_report/report/account_general_ledger_report.py' --- account_general_ledger_report/report/account_general_ledger_report.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/report/account_general_ledger_report.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,302 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved +# d$ +# +# 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.addons.account_financial_report_webkit.report.common_reports import CommonReportHeaderWebkit +import pooler +from report import report_sxw + +class GeneralLedgerReportWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): + + def __init__(self, cursor, uid, name, context): + super(GeneralLedgerReportWebkit, self).__init__(cursor, uid, name, context=context) + self.pool = pooler.get_pool(self.cr.dbname) + self.cursor = self.cr + + self.localcontext.update({ + 'cr': cursor, + 'uid': uid, + 'get_data':self.get_data, + 'get_chart_account_id':self._get_chart_account_id_br, + 'get_fiscalyear':self.get_fiscalyear_br, + 'get_filter': self._get_filter, + 'get_start_period':self.get_start_period_br, + 'get_end_period':self.get_end_period_br, + 'get_start_date':self._get_date_from, + 'get_stop_date':self._get_date_to, + 'accounts': self._get_accounts_br, + 'display_target_move': self._get_display_target_move, + 'extract_name_move': self.extract_name_move, + }) + + def get_data(self, cr, uid, data): + filter_data = [] + account_list = [] + account_selected = [] + conciliation_lines = [] + + account_lines = {} + account_balance = {} + account_conciliation = {} + account_move_line_con = {} + + library_obj = self.pool.get('account.webkit.report.library') + + filter_type = self._get_form_param('filter', data, default='filter_no') + chart_account = self._get_chart_account_id_br(data) + + if filter_type == 'filter_date': + start_date = self._get_form_param('date_from', data) + stop_date = self._get_form_param('date_to', data) + + filter_data.append(start_date) + filter_data.append(stop_date) + + elif filter_type == 'filter_period': + + start_period = self.get_start_period_br(data) #return the period object + stop_period = self.get_end_period_br(data) + + filter_data.append(start_period) + filter_data.append(stop_period) + + else: + filter_type = '' + + fiscalyear = self.get_fiscalyear_br(data) + target_move = self._get_form_param('target_move', data, default='all') + + #From the wizard can select specific account, extract this accounts + account_selected = data['form']['account_ids'] + + #Prepare the account_id list. + if account_selected == []: + account_list_ids = library_obj.get_account_child_ids(cr, uid, chart_account.id) #get all the accounts in the chart_account_id + account_list_obj = self.pool.get('account.account').browse(cr, uid, account_list_ids) + for account in account_list_obj: + conciliation_lines = [] + if account.type != 'view': + #Get the move_lines for each account. + move_lines = library_obj.get_move_lines(cr, uid, + [account.id], + filter_type=filter_type, + filter_data=filter_data, + fiscalyear=fiscalyear, + target_move=target_move, + order_by='asc') + if account.id not in account_lines.keys(): + account_lines[account] = move_lines + + #Reconcile -> show reconcile in the mako. + ''' + First, if the account permit reconcile (reconcile == True), add to the dictionary. + If the account don't allow the reconcile, search if the lines have reconcile_id or partial_reconcile_id + If the account allow the reconcile or the lines have reconcile_id or partial_reconcile_id, add in the dictionary + and show in the mako the column "Reconcile" + + the final result is: + {account_id: {line.id: [conciliation_name]}} + ''' + #1. If the account have reconcile, add to the dictionary + if account.reconcile and account.id not in account_conciliation: + account_conciliation[account.id] = [] + + #Search if the move_lines have partial or reconcile id + for line in move_lines: + if line.reconcile_id and line.reconcile_id.name != '': + conciliation_lines.append(line.reconcile_id.name) + + elif line.reconcile_partial_id and line.reconcile_partial_id.name != '': + str_name = 'P' + line.reconcile_id.name + conciliation_lines.append(str_name) + + #Add the line.id and the name of the conciliation. + if len(conciliation_lines) > 0: + account_move_line_con[line.id] = conciliation_lines + + #Clean the name of the conciliation + conciliation_lines = [] + + #After the search in each lines, add the dictionary (key: line.id, value: conciliation_name) + #with account.id (key of the principal dictionary) and match the account_id with the conciliation name. + if account.id in account_conciliation.keys(): + account_conciliation[account.id] = account_move_line_con + + elif account.id not in account_conciliation.keys() and len(account_move_line_con) > 0: + account_conciliation[account.id] = account_move_line_con + + #Get the initial_balance for the account + for account in account_list_obj: + if account.type != 'view': + account_list.append(account.id) + + if filter_type == 'filter_date': + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + start_date = start_date, + stop_date = stop_date, + chart_account_id = chart_account.id, + filter_type=filter_type) + elif filter_type == 'filter_period': + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + start_period_id = start_period.id, + end_period_id = stop_period.id, + chart_account_id = chart_account.id, + filter_type=filter_type) + else: + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + chart_account_id = chart_account.id, + filter_type=filter_type) + else: + account_list_ids = library_obj.get_account_child_ids(cr, uid, account_selected) #get all the accounts in the chart_account_id + account_list_obj = self.pool.get('account.account').browse(cr, uid, account_list_ids) + for account in account_list_obj: + if account.type != 'view': + move_lines = library_obj.get_move_lines(cr, uid, + [account.id], + filter_type=filter_type, + filter_data=filter_data, + fiscalyear=fiscalyear, + target_move=target_move, + order_by='asc') + + if account.id not in account_lines.keys(): + account_lines[account] = move_lines + + #Reconcile -> show reconcile in the mako. + ''' + First, if the account permit reconcile (reconcile == True), add to the dictionary. + If the account don't allow the reconcile, search if the lines have reconcile_id or partial_reconcile_id + If the account allow the reconcile or the lines have reconcile_id or partial_reconcile_id, add in the dictionary + and show in the mako the column "Reconcile" + + the final result is: + {account_id: {line.id: [conciliation_name]}} + ''' + #1. If the account have reconcile, add to the dictionary + if account.reconcile and account.id not in account_conciliation: + account_conciliation[account.id] = [] + + #Search if the move_lines have partial or reconcile id + for line in move_lines: + if line.reconcile_id and line.reconcile_id.name != '': + conciliation_lines.append(line.reconcile_id.name) + + elif line.reconcile_partial_id and line.reconcile_partial_id.name != '': + str_name = 'P' + line.reconcile_id.name + conciliation_lines.append(str_name) + + #Add the line.id and the name of the conciliation. + if len(conciliation_lines) > 0: + account_move_line_con[line.id] = conciliation_lines + + #Clean the name of the conciliation + conciliation_lines = [] + + #After the search in each lines, add the dictionary (key: line.id, value: conciliation_name) + #with account.id (key of the principal dictionary) and match the account_id with the conciliation name. + if account.id in account_conciliation.keys(): + account_conciliation[account.id] = account_move_line_con + + elif account.id not in account_conciliation.keys() and len(account_move_line_con) > 0: + account_conciliation[account.id] = account_move_line_con + + #Get the initial_balance for the account + for account in account_list_obj: + if account.type != 'view': + account_list.append(account.id) + + if filter_type == 'filter_date': + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + start_date = start_date, + stop_date = stop_date, + chart_account_id = chart_account.id, + filter_type=filter_type) + elif filter_type == 'filter_period': + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + start_period_id = start_period.id, + end_period_id = stop_period.id, + chart_account_id = chart_account.id, + filter_type=filter_type) + else: + account_balance = library_obj.get_account_balance(cr, uid, + account_list, + ['balance'], + initial_balance=True, + company_id=chart_account.company_id.id, + fiscal_year_id = fiscalyear.id, + state = target_move, + chart_account_id = chart_account.id, + filter_type=filter_type) + + return account_lines, account_balance, account_conciliation + + '''' + This method is created to solve the error when extracting the name move_id (line.move_id.name) fails because of read permissions + parameter move_lines are the move_lines that match with the journal and period. Pass from mako. + ''' + def extract_name_move(self, cr, uid, move_lines): + move_temp = self.pool.get('account.move') + dict_name = {} #dict_name keys is the line id. + + for line in move_lines: + move_id = move_temp.search(cr, uid, [('id', '=', line.move_id.id)]) + move_obj = move_temp.browse(cr, uid, move_id) + if move_obj[0].name: + dict_name[line.id] = move_obj[0].name + else: + dict_name[line.id] = move_obj[0].id + + return dict_name + +report_sxw.report_sxw('report.account_general_ledger_webkit', + 'account.account', + 'addons/account_general_ledger_report/report/account_general_ledger_report.mako', + parser=GeneralLedgerReportWebkit) \ No newline at end of file === added file 'account_general_ledger_report/report/report.xml' --- account_general_ledger_report/report/report.xml 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/report/report.xml 2013-05-15 14:27:49 +0000 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id="account_financial_report_webkit.account_report_general_ledger_webkit" model="ir.actions.report.xml"> + <field name="report_type">webkit</field> + <field name="report_name">account_general_ledger_webkit</field> + <field eval="[(6,0,[])]" name="groups_id"/> + <field name="model">account.account</field> + <field name="type">ir.actions.report.xml</field> + <field name="name">General Ledger Webkit</field> + <field name="report_rml">account_general_ledger_report/report/account_general_ledger_report.mako</field> + <field name="report_file">account_general_ledger_report/report/account_general_ledger_report.mako</field> + </record> + </data> +</openerp> === added file 'account_general_ledger_report/report_menus.xml' --- account_general_ledger_report/report_menus.xml 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/report_menus.xml 2013-05-15 14:27:49 +0000 @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <menuitem icon="STOCK_PRINT" + name="General Ledger" + parent="account.final_accounting_reports" + action="action_general_ledger_report_wizard" + groups="account.group_account_manager,account.group_account_user" + id="account.menu_general_ledger"/> + + </data> +</openerp> === added directory 'account_general_ledger_report/wizard' === added file 'account_general_ledger_report/wizard/__init__.py' --- account_general_ledger_report/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/wizard/__init__.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,23 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved +# d$ +# +# 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/>. +# +############################################################################## + +import account_general_ledger_report_wizard \ No newline at end of file === added file 'account_general_ledger_report/wizard/account_general_ledger_report_wizard.py' --- account_general_ledger_report/wizard/account_general_ledger_report_wizard.py 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/wizard/account_general_ledger_report_wizard.py 2013-05-15 14:27:49 +0000 @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Addons modules by CLEARCORP S.A. +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). +# +# 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 osv import fields, osv + +class AccountReportGeneralLedgerWizard(osv.osv_memory): + + _inherit = "general.ledger.webkit" + _name = "general.ledger.webkit" + _description = "General Ledger Report Wizard" + + def _print_report(self, cursor, uid, ids, data, context=None): + context = context or {} + + # we update form with display account value + data = self.pre_print_report(cursor, uid, ids, data, context=context) + + return {'type': 'ir.actions.report.xml', + 'report_name': 'account_general_ledger_webkit', + 'datas': data} + \ No newline at end of file === added file 'account_general_ledger_report/wizard/account_general_ledger_report_wizard.xml' --- account_general_ledger_report/wizard/account_general_ledger_report_wizard.xml 1970-01-01 00:00:00 +0000 +++ account_general_ledger_report/wizard/account_general_ledger_report_wizard.xml 2013-05-15 14:27:49 +0000 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id ="account_report_general_ledger_report_inherit" model="ir.ui.view"> + <field name="name">General Ledger Report </field> + <field name="model">general.ledger.webkit</field> + <field name="type">form</field> + <field name="inherit_id" ref="account_financial_report_webkit.account_report_general_ledger_view_webkit"/> + <field name="arch" type="xml"> + <data> + <field name="fiscalyear_id" position="attributes"> + <attribute name="required">True</attribute> + </field> + </data> + </field> + </record> + + <record id="action_general_ledger_report_wizard" model="ir.actions.act_window"> + <field name="name">General Ledger Report</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">general.ledger.webkit</field> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="view_id" ref="account_report_general_ledger_report_inherit"/> + <field name="target">new</field> + </record> + </data> +</openerp> === modified file 'account_webkit_report_library/common_library.py' --- account_webkit_report_library/common_library.py 2013-02-06 22:15:54 +0000 +++ account_webkit_report_library/common_library.py 2013-05-15 14:27:49 +0000 @@ -80,7 +80,7 @@ return pevious_period - def get_move_lines(self, cr, uid, account_ids, filter_type='', filter_data=None, fiscalyear=None, target_move='all', unreconcile = False, historic_strict=False, special_period =False, context=None): + def get_move_lines(self, cr, uid, account_ids, filter_type='', filter_data=None, fiscalyear=None, target_move='all', unreconcile = False, historic_strict=False, special_period =False, order_by=None, context=None): ''' Get the move lines of the accounts provided and filtered. Arguments: 'account_ids': List of accounts ids. @@ -91,6 +91,7 @@ 'target_move': Target moves of the report, possibles values: 'all' or 'posted'. 'unreconcile': If True then get the move lines unreconciled. 'historic_strict': Used when unreconcile = True, forces to include move lines that where not reconciled at the end date of the filter but are now. + 'order_by': Used to the lines return order by specific order. asc or desc are the acepted words. ''' #TODO: Translate comments to english @@ -181,11 +182,19 @@ periods_ids = self.pool.get('account.period').search(cr, uid, [('special', '=', False),('fiscalyear_id', '=', fiscalyear.id)], context=context) domain_period = ('period_id.id', 'in', periods_ids) list_tuples.append(domain_period) - + #**********************************************************************************************# if unreconcile == False: - move_line_ids = move_line_obj.search(cr, uid, list_tuples, context=context) + #order by date ASC or DESC the move_lines + if order_by != None and order_by == 'asc': + move_line_ids = move_line_obj.search(cr, uid, list_tuples, order='date asc', context=context) + + elif order_by != None and order_by == 'desc': + move_line_ids = move_line_obj.search(cr, uid, list_tuples, order='date DESC', context=context) + + else: + move_line_ids = move_line_obj.search(cr, uid, list_tuples, context=context) else: #list_tuples + [domain_unreconciled] -> Con esta sintaxis no se altera la variable @@ -419,7 +428,6 @@ return res def get_account_child_ids(self, cr, uid, account_ids, context={}): - print account_ids if isinstance(account_ids, orm.browse_record): account_ids = [account_ids.id] elif isinstance(account_ids, int):
_______________________________________________ Mailing list: https://launchpad.net/~clearcorp Post to : [email protected] Unsubscribe : https://launchpad.net/~clearcorp More help : https://help.launchpad.net/ListHelp

