}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
+ 'date': lambda self, cr, uid, context, *a: context.get('date'),
'type': 'general',
}
</group>
<notebook colspan="4">
<page string="Transaction" name="statement_line_ids">
- <field colspan="4" name="line_ids" nolabel="1">
+ <field colspan="4" name="line_ids" nolabel="1" context="{'date':date}">
<tree editable="bottom" string="Statement lines">
<field name="sequence" readonly="1" invisible="1"/>
<field name="date" groups="base.group_extended"/>
<notebook colspan="4">
<page string="Cash Transactions" attrs="{'invisible': [('state','=','draft')]}">
- <field colspan="4" name="line_ids" nolabel="1">
+ <field colspan="4" name="line_ids" nolabel="1" context="{'date':date}">
<tree editable="bottom" string="Statement lines">
<field name="sequence" invisible="1"/>
<field name="date" groups="base.group_extended"/>
bank_st_line_obj = self.pool.get('account.bank.statement.line')
st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
if st_line.voucher_id:
- voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
+ voucher_obj.write(cr, uid, [st_line.voucher_id.id],
+ {'number': next_number,
+ 'date': st_line.date,
+ 'period_id': st_line.statement_id.period_id.id},
+ context=context)
if st_line.voucher_id.state == 'cancel':
voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)