[FIX] account: add buttons on journal entries and journal item to see reconciled entries

This commit is contained in:
Cedric Snauwaert
2016-01-06 14:46:19 +01:00
parent bf6b106044
commit 833fe492d1
2 changed files with 36 additions and 1 deletions
+16
View File
@@ -213,6 +213,10 @@ class AccountMove(models.Model):
return [x.id for x in reversed_moves]
return True
@api.multi
def open_reconcile_view(self):
return self.line_ids.open_reconcile_view()
class AccountMoveLine(models.Model):
_name = "account.move.line"
@@ -1144,6 +1148,18 @@ class AccountMoveLine(models.Model):
tables, where_clause, where_clause_params = query.get_sql()
return tables, where_clause, where_clause_params
@api.multi
def open_reconcile_view(self):
model, action_id = self.pool['ir.model.data'].get_object_reference(self._cr, self._uid, 'account', "action_account_moves_all_a")
action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context)
ids = []
for aml in self:
if aml.account_id.reconcile:
ids.extend([r.debit_move_id.id for r in aml.matched_debit_ids] if aml.credit > 0 else [r.credit_move_id.id for r in aml.matched_credit_ids])
ids.append(aml.id)
action['domain'] = [('id', 'in', ids)]
return action
class AccountPartialReconcile(models.Model):
_name = "account.partial.reconcile"
+20 -1
View File
@@ -1005,7 +1005,18 @@
<field name="amount_currency"/>
</group>
<group string="Reconciliation">
<field name="reconciled"/>
<label for="reconciled"/>
<div>
<field name="reconciled"/>
<field name="matched_debit_ids" invisible="1"/>
<field name="matched_credit_ids" invisible="1"/>
<button name="open_reconcile_view"
class="oe_link"
type="object"
string="-> View reconciled entries"
attrs="{'invisible': [('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}">
</button>
</div>
</group>
<group string="States">
<field name="blocked"/>
@@ -1219,6 +1230,14 @@
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_button_box">
<button name="open_reconcile_view"
class="oe_stat_button"
icon="fa-bars"
type="object"
string="View reconciled entries">
</button>
</div>
<label for="name" class="oe_edit_only" attrs="{'invisible':[('name','=','/')]}"/>
<h1>
<field name="name" readonly="True" attrs="{'invisible':[('name','=','/')]}"/>