[MERGE] merge from trunk addons3
bzr revid: pso@tinyerp.com-20101210112450-dejshjdqt5madxh8
This commit is contained in:
commit
eb872df55d
|
@ -1170,7 +1170,7 @@
|
|||
<filter icon="terp-document-new" string="Unbalanced" domain="[('state','=','draft')]" help="Unbalanced Journal Items"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Journal Items"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
|
||||
<filter name="posted" icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter
|
||||
icon="terp-dolar_ok!"
|
||||
|
@ -1216,6 +1216,7 @@
|
|||
<field name="res_model">account.move.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_posted': 1}</field>
|
||||
<field name="search_view_id" ref="view_account_move_line_filter"/>
|
||||
<field name="help">This view is used by accountants in order to record entries massively in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account, OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account Payable".</field>
|
||||
</record>
|
||||
|
|
|
@ -95,6 +95,25 @@ class account_installer(osv.osv_memory):
|
|||
'bank_accounts_id': _get_default_accounts,
|
||||
'charts': _get_default_charts
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
configured_cmp = []
|
||||
unconfigured_cmp = []
|
||||
cmp_select = []
|
||||
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
|
||||
cr.execute("SELECT company_id FROM account_account WHERE account_account.parent_id IS NULL")
|
||||
for r in cr.fetchall():
|
||||
configured_cmp.append(r[0])
|
||||
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
|
||||
if unconfigured_cmp:
|
||||
for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp):
|
||||
cmp_select.append((line.id,line.name))
|
||||
for field in res['fields']:
|
||||
if field == 'company_id':
|
||||
res['fields'][field]['domain'] = unconfigured_cmp
|
||||
res['fields'][field]['selection'] = cmp_select
|
||||
return res
|
||||
|
||||
def on_change_tax(self, cr, uid, id, tax):
|
||||
return {'value': {'purchase_tax': tax}}
|
||||
|
|
|
@ -33,8 +33,9 @@ class account_chart(osv.osv_memory):
|
|||
help = 'Keep empty for all open fiscal years'),
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required = True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required = True),
|
||||
}
|
||||
|
||||
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
|
||||
|
@ -92,7 +93,7 @@ class account_chart(osv.osv_memory):
|
|||
return result
|
||||
|
||||
_defaults = {
|
||||
'target_move': 'all'
|
||||
'target_move': 'posted'
|
||||
}
|
||||
|
||||
account_chart()
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
from lxml import etree
|
||||
|
||||
from osv import osv
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
|
@ -29,6 +29,15 @@ class account_move_journal(osv.osv_memory):
|
|||
_name = "account.move.journal"
|
||||
_description = "Move journal"
|
||||
|
||||
_columns = {
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'target_move': 'posted'
|
||||
}
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
"""
|
||||
Return default account period value
|
||||
|
@ -93,6 +102,8 @@ class account_move_journal(osv.osv_memory):
|
|||
view = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<form string="Standard entries">
|
||||
<separator string="Open Journal Items !" colspan="4"/>
|
||||
<field name="target_move" />
|
||||
<newline/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal: %s"/>
|
||||
<newline/>
|
||||
|
@ -132,6 +143,7 @@ class account_move_journal(osv.osv_memory):
|
|||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
target_move = self.read(cr, uid, ids, [])[0]['target_move']
|
||||
|
||||
name = _("Journal Items")
|
||||
if journal_id:
|
||||
|
@ -156,23 +168,26 @@ class account_move_journal(osv.osv_memory):
|
|||
}
|
||||
period_pool.create(cr, uid, res,context=context)
|
||||
|
||||
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
|
||||
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
|
||||
period = period_pool.browse(cr, uid, ids[0], context=context)
|
||||
name = (period.journal_id.code or '') + ':' + (period.period_id.code or '')
|
||||
|
||||
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res_id = result and result[1] or False
|
||||
move = 0
|
||||
if target_move == 'posted':
|
||||
move = 1
|
||||
return {
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,graph,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': False,
|
||||
'context': "{'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (journal_id, journal_id, period_id),
|
||||
'context': "{'search_default_posted': %d, 'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (move, journal_id, journal_id, period_id),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res_id
|
||||
}
|
||||
|
||||
account_move_journal()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -38,8 +38,9 @@ class account_common_report(osv.osv_memory):
|
|||
'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
|
||||
'date_from': fields.date("Start Date"),
|
||||
'date_to': fields.date("End Date"),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,7 @@ class account_common_report(osv.osv_memory):
|
|||
'journal_ids': _get_all_journal,
|
||||
'filter': 'filter_no',
|
||||
'chart_account_id': _get_account,
|
||||
'target_move': 'all',
|
||||
'target_move': 'posted',
|
||||
}
|
||||
|
||||
def _build_contexts(self, cr, uid, ids, data, context=None):
|
||||
|
|
|
@ -31,8 +31,9 @@ class account_tax_chart(osv.osv_memory):
|
|||
'period_id': fields.many2one('account.period', \
|
||||
'Period', \
|
||||
),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
}
|
||||
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
|
@ -72,7 +73,7 @@ class account_tax_chart(osv.osv_memory):
|
|||
|
||||
_defaults = {
|
||||
'period_id': _get_period,
|
||||
'target_move': 'all'
|
||||
'target_move': 'posted'
|
||||
}
|
||||
|
||||
account_tax_chart()
|
||||
|
|
Loading…
Reference in New Issue