Browse Source

[ADD] Se agrega modelo para plantillas de reportes financieros

pull/79/head
Humberto Arocha 12 years ago
parent
commit
2732c37645
  1. 1
      account_financial_report/__openerp__.py
  2. 1
      account_financial_report/model/__init__.py
  3. 82
      account_financial_report/model/account_financial_report.py
  4. 129
      account_financial_report/view/account_financial_report_view.xml

1
account_financial_report/__openerp__.py

@ -41,6 +41,7 @@
"view/wizard.xml",
"view/account_view.xml",
"view/company_view.xml",
"view/account_financial_report_view.xml",
],
"active": False,
"installable": True

1
account_financial_report/model/__init__.py

@ -23,4 +23,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import account_financial_report
import res_company

82
account_financial_report/model/account_financial_report.py

@ -0,0 +1,82 @@
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Coded by: Humberto Arocha humberto@openerp.com.ve
# Angelica Barrios angelicaisabelb@gmail.com
# Jordi Esteve <jesteve@zikzakmedia.com>
# Javier Duran <javieredm@gmail.com>
# Planified by: Humberto Arocha
# Finance by: LUBCAN COL S.A.S http://www.lubcancol.com
# Audited by: Humberto Arocha humberto@openerp.com.ve
#############################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
from osv import osv,fields
import pooler
import time
from tools.translate import _
class account_financial_report(osv.osv):
_name = "afr"
_columns = {
'name': fields.char('Name', size= 128, required=True),
'company_id': fields.many2one('res.company','Company',required=True),
'currency_id': fields.many2one('res.currency', 'Currency', help="Currency at which this report will be expressed. If not selected will be used the one set in the company"),
'inf_type': fields.selection([('BS','Balance Sheet'),('IS','Income Statement')],'Type',required=True),
'columns': fields.selection([('one','End. Balance'),('two','Debit | Credit'), ('four','Initial | Debit | Credit | YTD'), ('five','Initial | Debit | Credit | Period | YTD'),('thirteen','12 Months | YTD')],'Columns',required=True),
'display_account': fields.selection([('all','All Accounts'),('bal', 'With Balance'),('mov','With movements'),('bal_mov','With Balance / Movements')],'Display accounts'),
'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'),
'account_ids': fields.many2many ('account.account','afr_account_rel','afr_id','account_id','Root accounts',required=True),
'fiscalyear_id': fields.many2one('account.fiscalyear','Fiscal year',help='Fiscal Year for this report',required=True),
'period_ids': fields.many2many('account.period','afr_period_rel','afr_id','period_id','Periods',help='All periods in the fiscal year if empty'),
'tot_check': fields.boolean('Summarize?', help='Checking will add a new line at the end of the Report which will Summarize Columns in Report'),
'lab_str': fields.char('Description', help='Description for the Summary', size= 128),
#~ Deprecated fields
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'date_to': fields.date('End date'),
'date_from': fields.date('Start date'),
}
_defaults = {
'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'BS',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c),
'fiscalyear_id': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid),
'display_account': lambda *a:'bal_mov',
'columns': lambda *a:'five',
'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
'filter': lambda *a:'byperiod',
}
def copy(self, cr, uid, id, defaults, context=None):
if context is None:
context = {}
previous_name = self.browse(cr, uid, id, context=context).name
new_name = _('Copy of %s')%previous_name
lst = self.search(cr, uid, [('name','like',new_name)], context=context)
if lst:
new_name = '%s (%s)' % (new_name, len(lst)+1)
defaults['name'] = new_name
return super(account_financial_report,self).copy(cr, uid, id, defaults, context=context)
account_financial_report()

129
account_financial_report/view/account_financial_report_view.xml

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_financial_report_view" model="ir.ui.view">
<field name="name">Account Financial Report (Template)</field>
<field name="model">afr</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Financial Report">
<group colspan="4">
<field name="name" colspan="4"/>
</group>
<group colspan="4">
<group colspan="2">
<separator string="Company Info" colspan="4"/>
<field name="company_id" colspan="4"/>
<field name="currency_id" domain="[('company_id','=',company_id)]" colspan="4"/>
</group>
<group colspan="2">
<separator string="Report Info" colspan="4"/>
<field name="inf_type" colspan="4"/>
<field name="columns" colspan="4"/>
</group>
</group>
<group colspan='2'>
<group colspan="2">
<separator string="Accounts Info" colspan="4"/>
<field name="display_account" required="True" colspan="4"/>
<field name="display_account_level" required="True" colspan="4"/>
</group>
<group colspan="2">
<separator string="FiscalYear Info" colspan="4"/>
<field name="fiscalyear_id" domain="[('company_id','=',company_id)]"/>
<newline/>
</group>
</group>
<group colspan='4'>
<group colspan="1">
<separator string="Account to Include" colspan="4"/>
<field name="account_ids" nolabel="1" colspan="4" domain="[('company_id','=',company_id)]">
<tree>
<field name='code'/>
<field name='name'/>
<field name='type'/>
</tree>
</field>
</group>
<group colspan="1">
<separator string="Periods to Include" colspan="4"/>
<field name="period_ids" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear_id),('special','=',False),('company_id','=',company_id)]">
<tree>
<field name='code'/>
<field name='name'/>
<field name='state'/>
</tree>
</field>
</group>
</group>
<group colspan="4">
<group colspan="2">
<separator string="Account's Sign Conventions" colspan="4"/>
<label string="Please check the [ Account's Sign on Reports ] Section in the Company"/>
<!--
<button name="print_report" string="Print" type="object"/>
-->
</group>
<group colspan="2">
<separator string="Total" colspan="4"/>
<field name="tot_check" colspan="4"/>
<field name="lab_str" colspan="4" attrs="{'required':[('tot_check','=',True)], 'readonly':[('tot_check','=',False)],}" />
</group>
</group>
</form>
</field>
</record>
<record id="account_financial_report_tree" model="ir.ui.view">
<field name="name">Account Financial Report (Template)</field>
<field name="model">afr</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Account Financial Report (Templates)">
<field name="name"/>
<field name="company_id"/>
<field name="currency_id"/>
<field name="inf_type"/>
<field name="columns"/>
<field name="display_account"/>
<field name="display_account_level" required="True" colspan="4"/>
<field name="fiscalyear_id"/>
<field name="tot_check" colspan="4"/>
<!--
<button name="print_report" string="Print" type="object"/>
-->
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="account_financial_report_action">
<field name="name">Account Financial Report</field>
<field name="res_model">afr</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ut nunc magna. Vivamus felis sem, mattis vel consequat pharetra, adipiscing ut erat. In accumsan fermentum ullamcorper. Cras vitae sem magna, pellentesque condimentum metus. Cras at sem quis lectus vehicula adipiscing. Vivamus in urna ipsum, sed molestie magna. Nam ullamcorper arcu condimentum leo ultrices egestas. Nullam ut tincidunt orci. Proin sollicitudin luctus risus sit amet mattis. Duis eget risus non enim pharetra dignissim. Mauris eros eros, fringilla et interdum non, aliquam at orci.
</field>
</record>
<menuitem
id="account_financial_report_menu"
name="Account Financial Report (Templates)"
parent="account.final_accounting_reports"
sequence="100"
groups="account_financial_report.group_afreport"
action="account_financial_report_action"/>
</data>
</openerp>
Loading…
Cancel
Save