Browse Source

[IMP] Se agrega on_change para cambiar el analityc_ledger,


			
			
				6.0
			
			
		
Humberto Arocha 13 years ago
parent
commit
fd5f3dd5ec
  1. 13
      account_financial_report/model/account_financial_report.py
  2. 6
      account_financial_report/view/account_financial_report_view.xml
  3. 6
      account_financial_report/view/wizard.xml
  4. 12
      account_financial_report/wizard/wizard.py

13
account_financial_report/model/account_financial_report.py

@ -81,11 +81,24 @@ class account_financial_report(osv.osv):
defaults['name'] = new_name defaults['name'] = new_name
return super(account_financial_report,self).copy(cr, uid, id, defaults, context=context) return super(account_financial_report,self).copy(cr, uid, id, defaults, context=context)
def onchange_inf_type(self,cr,uid,ids,inf_type,context=None):
if context is None:
context = {}
res = {'value':{}}
if inf_type != 'BS':
res['value'].update({'analytic_ledger':False})
return res
def onchange_columns(self,cr,uid,ids,columns,fiscalyear_id,period_ids,context=None): def onchange_columns(self,cr,uid,ids,columns,fiscalyear_id,period_ids,context=None):
if context is None: if context is None:
context = {} context = {}
res = {'value':{}} res = {'value':{}}
if columns != 'four':
res['value'].update({'analytic_ledger':False})
if columns in ('qtr', 'thirteen'): if columns in ('qtr', 'thirteen'):
p_obj = self.pool.get("account.period") p_obj = self.pool.get("account.period")
period_ids = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear_id),('special','=',False)],context=context) period_ids = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear_id),('special','=',False)],context=context)

6
account_financial_report/view/account_financial_report_view.xml

@ -22,7 +22,11 @@
</group> </group>
<group colspan="2"> <group colspan="2">
<separator string="Report Info" colspan="4"/> <separator string="Report Info" colspan="4"/>
<field name="inf_type" colspan="4"/>
<field
name="inf_type"
colspan="4"
on_change='onchange_inf_type(inf_type)'
/>
<field name="columns" on_change='onchange_columns(columns,fiscalyear_id,period_ids)' colspan="4"/> <field name="columns" on_change='onchange_columns(columns,fiscalyear_id,period_ids)' colspan="4"/>
<field name="analytic_ledger" colspan="4" <field name="analytic_ledger" colspan="4"
attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}" attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}"

6
account_financial_report/view/wizard.xml

@ -20,7 +20,11 @@
<group colspan="2"> <group colspan="2">
<separator string="Report Info" colspan="4"/> <separator string="Report Info" colspan="4"/>
<field name="afr_id" on_change='onchange_afr_id(afr_id)' colspan="4"/> <field name="afr_id" on_change='onchange_afr_id(afr_id)' colspan="4"/>
<field name="inf_type" colspan="4"/>
<field
name="inf_type"
colspan="4"
on_change='onchange_inf_type(inf_type)'
/>
<field name="columns" on_change='onchange_columns(columns,fiscalyear,periods)' colspan="4"/> <field name="columns" on_change='onchange_columns(columns,fiscalyear,periods)' colspan="4"/>
<field name="analytic_ledger" colspan="4" <field name="analytic_ledger" colspan="4"
attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}" attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}"

12
account_financial_report/wizard/wizard.py

@ -71,6 +71,16 @@ class wizard_report(osv.osv_memory):
'columns': lambda *a:'five', 'columns': lambda *a:'five',
} }
def onchange_inf_type(self,cr,uid,ids,inf_type,context=None):
if context is None:
context = {}
res = {'value':{}}
if inf_type != 'BS':
res['value'].update({'analytic_ledger':False})
return res
def onchange_columns(self,cr,uid,ids,columns,fiscalyear,periods,context=None): def onchange_columns(self,cr,uid,ids,columns,fiscalyear,periods,context=None):
if context is None: if context is None:
context = {} context = {}
@ -82,6 +92,8 @@ class wizard_report(osv.osv_memory):
t = set(all_periods) t = set(all_periods)
go = periods[0][2] and s.issubset(t) or False go = periods[0][2] and s.issubset(t) or False
if columns != 'four':
res['value'].update({'analytic_ledger':False})
if columns in ('qtr', 'thirteen'): if columns in ('qtr', 'thirteen'):
res['value'].update({'periods':all_periods}) res['value'].update({'periods':all_periods})

Loading…
Cancel
Save