Browse Source

[MERGE] AFR backport from v7

6.0
Humberto Arocha 11 years ago
parent
commit
cc90a7e180
  1. 4
      account_financial_report/model/account_financial_report.py
  2. 2
      account_financial_report/model/res_company.py
  3. 2
      account_financial_report/report/balance_full.rml
  4. 2
      account_financial_report/report/balance_full_13_cols.rml
  5. 2
      account_financial_report/report/balance_full_2_cols.rml
  6. 2
      account_financial_report/report/balance_full_4_cols.rml
  7. 2
      account_financial_report/report/balance_full_4_cols_analytic_ledger.rml
  8. 2
      account_financial_report/report/balance_full_4_cols_journal_ledger.rml
  9. 2
      account_financial_report/report/balance_full_4_cols_partner_balance.rml
  10. 2
      account_financial_report/report/balance_full_5_cols.rml
  11. 2
      account_financial_report/report/balance_full_qtr_cols.rml
  12. 29
      account_financial_report/report/parser.py
  13. 22
      account_financial_report/view/account_financial_report_view.xml
  14. 53
      account_financial_report/view/wizard.xml
  15. 3
      account_financial_report/wizard/wizard.py

4
account_financial_report/model/account_financial_report.py

@ -27,7 +27,7 @@
##############################################################################
from osv import osv, fields
import pooler
#~ import pooler
import time
from tools.translate import _
@ -73,7 +73,7 @@ class account_financial_report(osv.osv):
('all', 'All Entries'),
], 'Entries to Include', required=True,
help='Print All Accounting Entries or just Posted Accounting Entries'),
'narration': fields.text('Notes'),
#~ Deprecated fields
'filter': fields.selection([('bydate', 'By Date'), ('byperiod', 'By Period'),
('all', 'By Date and Period'), ('none', 'No Filter')], 'Date/Period Filter'),

2
account_financial_report/model/res_company.py

@ -25,7 +25,7 @@
from osv import osv
from osv import fields
from tools.translate import _
#~ from tools.translate import _
class res_company(osv.osv):

2
account_financial_report/report/balance_full.rml

@ -89,7 +89,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,13.5cm,3.0cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">

2
account_financial_report/report/balance_full_13_cols.rml

@ -87,7 +87,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.0cm,6.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>

2
account_financial_report/report/balance_full_2_cols.rml

@ -81,7 +81,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,9.5cm,3.5cm,3.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>

2
account_financial_report/report/balance_full_4_cols.rml

@ -82,7 +82,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,6.5cm,2.5cm,3.5cm,3.5cm,2.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>

2
account_financial_report/report/balance_full_4_cols_analytic_ledger.rml

@ -119,7 +119,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,13.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="0">
<tr noRowsplits="0">

2
account_financial_report/report/balance_full_4_cols_journal_ledger.rml

@ -140,7 +140,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,13.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="0">
<tr noRowsplits="0">

2
account_financial_report/report/balance_full_4_cols_partner_balance.rml

@ -119,7 +119,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,13.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="0">
<tr noRowsplits="0">

2
account_financial_report/report/balance_full_5_cols.rml

@ -82,7 +82,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,6.0cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>

2
account_financial_report/report/balance_full_qtr_cols.rml

@ -82,7 +82,7 @@
</stylesheet>
<images/>
<story>
<para>[[setLang(user.lang)]]</para>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,6.0cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>

29
account_financial_report/report/parser.py

@ -26,16 +26,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
import xml
import copy
from operator import itemgetter
#~ import xml
#~ import copy
#~ from operator import itemgetter
import time
import datetime
#~ import datetime
from report import report_sxw
from tools import config
#~ from tools import config
from tools.translate import _
from osv import osv
from openerp.tools.safe_eval import safe_eval as eval
#~ from openerp.tools.safe_eval import safe_eval as eval
class account_balance(report_sxw.rml_parse):
@ -118,11 +118,11 @@ class account_balance(report_sxw.rml_parse):
return day, year and month
'''
if form['filter'] in ['bydate', 'all']:
months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
mes = months[time.strptime(form['date_to'], "%Y-%m-%d")[1] - 1]
ano = time.strptime(form['date_to'], "%Y-%m-%d")[0]
dia = time.strptime(form['date_to'], "%Y-%m-%d")[2]
#~ months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
#~ "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
#~ mes = months[time.strptime(form['date_to'], "%Y-%m-%d")[1] - 1]
#~ ano = time.strptime(form['date_to'], "%Y-%m-%d")[0]
#~ dia = time.strptime(form['date_to'], "%Y-%m-%d")[2]
return _('From ') + self.formatLang(form['date_from'], date=True) + _(' to ') + self.formatLang(form['date_to'], date=True)
elif form['filter'] in ['byperiod', 'all']:
aux = []
@ -138,10 +138,11 @@ class account_balance(report_sxw.rml_parse):
"""
Returns the text with the periods/dates used on the report.
"""
form = form or {}
period_obj = self.pool.get('account.period')
fiscalyear_obj = self.pool.get('account.fiscalyear')
periods_str = None
fiscalyear_id = form[
'fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid)
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid)
period_ids = period_obj.search(self.cr, self.uid, [(
'fiscalyear_id', '=', fiscalyear_id), ('special', '=', False)])
if form['filter'] in ['byperiod', 'all']:
@ -191,7 +192,7 @@ class account_balance(report_sxw.rml_parse):
return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).debit_account_ids]
def _get_partner_balance(self, account, init_period, ctx=None):
rp_obj = self.pool.get('res.partner')
#~ rp_obj = self.pool.get('res.partner')
res = []
ctx = ctx or {}
if account['type'] in ('other', 'liquidity', 'receivable', 'payable'):

22
account_financial_report/view/account_financial_report_view.xml

@ -6,10 +6,16 @@
<field name="model">afr</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Financial Report (Templates)" version="7.0">
<h2><label for="name"/></h2>
<field name="name" nolabel="1"/>
<group>
<form string="Account Financial Report (Templates)">
<group colspan="4" col="6">
<field name="name" nolabel="0" colspan="6"/>
</group>
<group colspan="4">
<label string="Notes" colspan="4"/>
<field name="narration" colspan="4" nolabel="1"/>
</group>
<group colspan="4">
<group string="Company Info" >
<field name="company_id" on_change='onchange_company_id(company_id)' />
<field name="currency_id"
@ -28,7 +34,7 @@
attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}" />
</group>
</group>
<group>
<group colspan="4">
<group string="Accounts Info" >
<field name="display_account" required="True" />
<field name="display_account_level" required="True" />
@ -39,7 +45,7 @@
domain="[('company_id','=',company_id)]"/>
</group>
</group>
<group>
<group colspan="4">
<group string="Accounts to Include">
<field name="account_ids" nolabel="1" domain="[('company_id','=',company_id)]">
<tree>
@ -63,10 +69,10 @@
</field>
</group>
</group>
<group string="Account's Sign Conventions">
<group string="Account's Sign Conventions" colspan="4">
<label string="Please check the [ Account's Sign on Reports ] Section in the Company"/>
</group>
<group>
<group colspan="4">
<group string="Total">
<field name="tot_check"/>
<field name="lab_str" attrs="{'required':[('tot_check','=',True)], 'readonly':[('tot_check','=',False)],}" />

53
account_financial_report/view/wizard.xml

@ -7,26 +7,17 @@
<field name="model">wizard.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Financial Report" version="7.0">
<header>
<button
name="print_report"
string="Print"
type="object"
class="oe_highlight" />
or
<button
type='special'
special='cancel'
string='_Cancel'
class="oe_link" />
</header>
<h2><label for="afr_id"/></h2>
<field name="afr_id" on_change='onchange_afr_id(afr_id)' nolabel="1"/>
<group>
<form string="Account Financial Report">
<group colspan="4" col="6">
<field name="afr_id" on_change='onchange_afr_id(afr_id)' nolabel="0" colspan="6"/>
</group>
<group colspan="4">
<label string="Notes" colspan="4"/>
<field name="narration" colspan="4" nolabel="1"/>
</group>
<group colspan="4">
<group string="Company Info">
<label for="company_id"/>
<field name="company_id" on_change='onchange_company_id(company_id)' nolabel="1"/>
<field name="company_id" on_change='onchange_company_id(company_id)' nolabel="0"/>
<field name="currency_id"
domain="[('company_id','=',company_id)]"
attrs="{'readonly':[('analytic_ledger','=',True)]}"/>
@ -49,7 +40,7 @@
/>
</group>
</group>
<group>
<group colspan="4">
<group string="Accounts Info">
<field name="display_account" required="True" />
<field name="display_account_level" required="True" />
@ -60,7 +51,7 @@
<newline/>
</group>
</group>
<group >
<group colspan="4">
<group string="Accounts to Include">
<field name="account_list" nolabel="1" domain="[('company_id','=',company_id)]">
<tree>
@ -85,11 +76,11 @@
</field>
</group>
</group>
<group string="Account's Sign Conventions">
<group colspan="4" string="Account's Sign Conventions">
<label string="Please check the [ Account's Sign on Reports ] Section in the Company"/>
</group>
<group>
<group colspan="4">
<group string="Total" >
<field name="tot_check" />
<field name="lab_str" attrs="{'required':[('tot_check','=',True)], 'readonly':[('tot_check','=',False)],}" />
@ -97,6 +88,20 @@
<group string=" " >
</group>
</group>
<group colspan="4">
<button
name="print_report"
string="Print"
type="object"
icon="gtk-print"
/>
<button
type='special'
special='cancel'
string='_Cancel'
/>
</group>
</form>
</field>
</record>
@ -108,7 +113,7 @@
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_report_view"/>
<field name="target">inline</field>
<field name="target">new</field>
</record>

3
account_financial_report/wizard/wizard.py

@ -61,6 +61,7 @@ class wizard_report(osv.osv_memory):
('all', 'All Entries'),
], 'Entries to Include', required=True,
help='Print All Accounting Entries or just Posted Accounting Entries'),
'narration': fields.text('Notes', readonly=True),
#~ 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'),
@ -151,6 +152,7 @@ class wizard_report(osv.osv_memory):
if not afr_id:
return res
afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context)
res['value'].update({
'currency_id': afr_brw.currency_id and afr_brw.currency_id.id or afr_brw.company_id.currency_id.id})
res['value'].update({'inf_type': afr_brw.inf_type or 'BS'})
@ -167,6 +169,7 @@ class wizard_report(osv.osv_memory):
res['value'].update({
'analytic_ledger': afr_brw.analytic_ledger or False})
res['value'].update({'tot_check': afr_brw.tot_check or False})
res['value'].update({'narration': afr_brw.narration or ''})
res['value'].update({'lab_str': afr_brw.lab_str or _(
'Write a Description for your Summary Total')})
return res

Loading…
Cancel
Save