Fields one2many:
bugfix for class 6, using widget many2many Bank statements - much more better usage: Create statement importing entries Check in bank journal -> New views and computing method and colors bzr revid: fp@tinyerp.com-7a9818b287379138975a8d16860b93d29700df35
This commit is contained in:
parent
8feb5aac23
commit
bfdf9b77b9
|
@ -57,8 +57,17 @@ class account_bank_statement(osv.osv):
|
|||
statements = self.browse(cr, uid, ids)
|
||||
for statement in statements:
|
||||
res[statement.id] = statement.balance_start
|
||||
for line in statement.line_ids:
|
||||
res[statement.id] += line.amount
|
||||
if statement.journal_id:
|
||||
for line in statement.move_line_ids:
|
||||
if line.debit>0:
|
||||
if line.account_id.id == (statement.journal_id.default_debit_account_id.id):
|
||||
res[statement.id]+=line.debit
|
||||
else:
|
||||
if line.account_id.id == (statement.journal_id.default_credit_account_id.id):
|
||||
res[statement.id]+=line.credit
|
||||
if statement.state=='draft':
|
||||
for line in statement.line_ids:
|
||||
res[statement.id] += line.amount
|
||||
for r in res:
|
||||
res[r] = round(res[r], 2)
|
||||
return res
|
||||
|
@ -108,6 +117,9 @@ class account_bank_statement(osv.osv):
|
|||
'journal_id': st.journal_id.id,
|
||||
'period_id': st.period_id.id,
|
||||
}, context=context)
|
||||
self.pool.get('account.bank.statement.line').write(cr, uid, [move.id], {
|
||||
'move_ids': [(4,move_id, False)]
|
||||
})
|
||||
if not move.amount:
|
||||
continue
|
||||
torec = []
|
||||
|
@ -169,7 +181,9 @@ class account_bank_statement(osv.osv):
|
|||
for st in self.browse(cr, uid, ids, context):
|
||||
if st.state=='draft':
|
||||
continue
|
||||
ids = [x.move_id.id for x in st.move_line_ids]
|
||||
ids = []
|
||||
for line in st.line_ids:
|
||||
ids += [x.id for x in line.move_ids]
|
||||
self.pool.get('account.move').unlink(cr, uid, ids, context)
|
||||
done.append(st.id)
|
||||
self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
|
@ -273,6 +287,7 @@ class account_bank_statement_line(osv.osv):
|
|||
'statement_id': fields.many2one('account.bank.statement', 'Statement', select=True),
|
||||
|
||||
'reconcile_id': fields.many2one('account.bank.statement.reconcile', 'Reconcile', states={'confirm':[('readonly',True)]}),
|
||||
'move_ids': fields.many2many('account.move', 'account_bank_statement_line_move_rel', 'move_id','statement_id', 'Moves'),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
|
||||
|
|
|
@ -322,7 +322,7 @@ class account_move_line(osv.osv):
|
|||
|
||||
self.write(cr, uid, ids, {'state': 'reconciled'}, update_check=False)
|
||||
r_id = self.pool.get('account.move.reconcile').create(cr, uid, {
|
||||
'name': date,
|
||||
#'name': date,
|
||||
'type': type,
|
||||
'line_id': map(lambda x: (4,x,False), ids)
|
||||
})
|
||||
|
|
|
@ -381,7 +381,7 @@
|
|||
<field name="model">account.bank.statement</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Statement" colors="red:balance_end_real!=balance_end;grey:balance_end_real==balance_end">
|
||||
<tree string="Statement" colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end)">
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
|
@ -400,15 +400,14 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Statement">
|
||||
<notebook>
|
||||
<page string="Statement">
|
||||
<field name="name" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="journal_id" select="1" on_change="onchange_journal_id(journal_id)"/>
|
||||
<field name="period_id" select="1"/>
|
||||
<field name="balance_start"/>
|
||||
<field name="balance_end_real"/>
|
||||
<separator string="Entry Lines" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="journal_id" select="1" on_change="onchange_journal_id(journal_id)"/>
|
||||
<field name="period_id" select="2"/>
|
||||
<field name="balance_start"/>
|
||||
<field name="balance_end_real"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Entry encoding">
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Statement lines" editable="bottom">
|
||||
<field name="date"/>
|
||||
|
@ -420,17 +419,17 @@
|
|||
<field name="reconcile_id" context="{'partner_id':partner_id,'amount':amount,'account_id':account_id}"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="7" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<field name="balance_end" />
|
||||
<button name="button_dummy" string="Compute" states="draft"/>
|
||||
<button name="button_confirm" string="Confirm" states="draft" type="object"/>
|
||||
<button name="button_cancel" string="Cancel" states="confirm" type="object"/>
|
||||
</group>
|
||||
</page><page string="Entries">
|
||||
</page><page string="Real Entries">
|
||||
<field name="move_line_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="7" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<field name="balance_end" />
|
||||
<button name="button_dummy" string="Compute" states="draft"/>
|
||||
<button name="button_confirm" string="Confirm" states="draft" type="object"/>
|
||||
<button name="button_cancel" string="Cancel" states="confirm" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -969,17 +968,75 @@
|
|||
<field name="view_id" ref="view_bank_tree"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_bank_statement_reconcile_form">
|
||||
<field name="name">account.bank.statement.reconcile.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="priority" eval="30"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Statement">
|
||||
<field name="name" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="journal_id" select="1" on_change="onchange_journal_id(journal_id)"/>
|
||||
<newline/>
|
||||
<field name="balance_start"/>
|
||||
<field name="balance_end_real"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Select entries">
|
||||
<field name="move_line_ids" colspan="4" nolabel="1" domain="[('statement_id','=',False),('journal_id','=',journal_id)]" widget="many2many"/>
|
||||
</page>
|
||||
<page string="Entry encoding">
|
||||
<separator string="Entry Lines" colspan="4"/>
|
||||
<field name="period_id"/>
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Statement lines" editable="bottom">
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id,type)"/>
|
||||
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
|
||||
<field name="amount"/>
|
||||
<field name="reconcile_id" context="{'partner_id':partner_id,'amount':amount,'account_id':account_id}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="7" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<field name="balance_end" />
|
||||
<button name="button_dummy" string="Compute" states="draft"/>
|
||||
<button name="button_confirm" string="Confirm" states="draft" type="object"/>
|
||||
<button name="button_cancel" string="Cancel" states="confirm" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_bank_statement_reconciliation_form">
|
||||
<field name="name">Statements reconciliation</field>
|
||||
<field name="res_model">account.bank.statement</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="view_id" ref="view_bank_statement_reconcile_form"/>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Bank reconciliation/Create statement importing entries"
|
||||
id="menu_action_account_bank_reconcile_tree"
|
||||
action="action_bank_statement_reconciliation_form"
|
||||
/>
|
||||
<wizard
|
||||
string="Bank reconciliation"
|
||||
model="account.move.line"
|
||||
name="account.move.bank.reconcile"
|
||||
menu="False"
|
||||
id="action_account_bank_reconcile_tree" />
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Reconciliation/Bank reconciliation"
|
||||
id="menu_action_account_bank_reconcile_tree"
|
||||
action="action_account_bank_reconcile_tree"
|
||||
type="wizard"/>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Bank reconciliation/Check in bank journal"
|
||||
id="menu_action_account_bank_reconcile_check_tree"
|
||||
action="action_account_bank_reconcile_tree"
|
||||
type="wizard"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<menuitem name="Financial Management/Reporting" sequence="8"/>
|
||||
|
|
Loading…
Reference in New Issue