[MERGE] improvements of 'post entry' wizard in order to allow the selection of several journals and several periods. Courtesy of Alexis de Lattre (Akretion)
bzr revid: qdp-launchpad@openerp.com-20131127153257-9e4ajwqvrmbuvxrn
This commit is contained in:
commit
9bc8665d8a
|
@ -80,8 +80,13 @@
|
|||
I validate this account move by using the 'Post Journal Entries' wizard
|
||||
-
|
||||
!record {model: validate.account.move, id: validate_account_move_0}:
|
||||
journal_id: account.bank_journal
|
||||
period_id: account.period_6
|
||||
journal_ids:
|
||||
- bank_journal
|
||||
- check_journal
|
||||
period_ids:
|
||||
- period_6
|
||||
- period_7
|
||||
- period_8
|
||||
-
|
||||
I click on validate Button
|
||||
-
|
||||
|
|
|
@ -25,18 +25,18 @@ class validate_account_move(osv.osv_memory):
|
|||
_name = "validate.account.move"
|
||||
_description = "Validate Account Move"
|
||||
_columns = {
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state','<>','done')]),
|
||||
'journal_ids': fields.many2many('account.journal', 'wizard_validate_account_move_journal', 'wizard_id', 'journal_id', 'Journal', required=True),
|
||||
'period_ids': fields.many2many('account.period', 'wizard_validate_account_move_period', 'wizard_id', 'period_id', 'Period', required=True, domain=[('state','<>','done')]),
|
||||
}
|
||||
|
||||
def validate_move(self, cr, uid, ids, context=None):
|
||||
obj_move = self.pool.get('account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data.journal_id.id),('period_id','=',data.period_id.id)])
|
||||
data = self.read(cr, uid, ids[0], context=context)
|
||||
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','in',tuple(data['journal_ids'])),('period_id','in',tuple(data['period_ids']))])
|
||||
if not ids_move:
|
||||
raise osv.except_osv(_('Warning!'), _('Specified journal does not have any account move entries in draft state for this period.'))
|
||||
raise osv.except_osv(_('Warning!'), _('Specified journals do not have any account move entries in draft state for the specified periods.'))
|
||||
obj_move.button_validate(cr, uid, ids_move, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Post Journal Entries" version="7.0">
|
||||
<group>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
<field name="journal_ids"/>
|
||||
<field name="period_ids"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Approve" name="validate_move" type="object" class="oe_highlight"/>
|
||||
|
|
Loading…
Reference in New Issue