[13.0][MIG] account_move_reconcile_helper

This commit is contained in:
kittiu
2020-01-07 11:18:43 +07:00
committed by Ethan Hildick
parent 334ed4e4de
commit 291240198a
7 changed files with 21 additions and 24 deletions

View File

@@ -17,7 +17,6 @@ class AccountMoveLine(models.Model):
string="Reconciled lines", string="Reconciled lines",
) )
@api.multi
@api.depends("matched_debit_ids", "matched_credit_ids") @api.depends("matched_debit_ids", "matched_credit_ids")
def _compute_partial_reconciliation_in_progress(self): def _compute_partial_reconciliation_in_progress(self):
for rec in self: for rec in self:
@@ -25,12 +24,10 @@ class AccountMoveLine(models.Model):
rec.matched_debit_ids rec.matched_debit_ids
) or bool(rec.matched_credit_ids) ) or bool(rec.matched_credit_ids)
@api.multi
def _compute_reconciled_lines(self): def _compute_reconciled_lines(self):
for rec in self: for rec in self:
rec.reconcile_line_ids = rec._get_reconciled_lines() rec.reconcile_line_ids = rec._get_reconciled_lines()
@api.multi
def _get_reconciled_lines(self, move_lines=None): def _get_reconciled_lines(self, move_lines=None):
""" """
Returns lines which were reconciled directly or indirectly with Returns lines which were reconciled directly or indirectly with
@@ -64,7 +61,6 @@ class AccountMoveLine(models.Model):
return move_lines return move_lines
@api.multi
def open_full_reconcile_view(self): def open_full_reconcile_view(self):
action = self.env.ref("account.action_account_moves_all_a").read()[0] action = self.env.ref("account.action_account_moves_all_a").read()[0]
action["domain"] = [("id", "in", self.mapped("reconcile_line_ids").ids)] action["domain"] = [("id", "in", self.mapped("reconcile_line_ids").ids)]

View File

@@ -1,14 +1,10 @@
Provides tools to facilitate reconciliation. Provides tools to facilitate reconciliation.
* Display a button on Journal entries list to show reconciled lines. * Display a button on Journal Items to show reconciled lines.
* Added Balance field in Journal entries list (this feature * Added Balance field in Journal Items (this feature
is provided by account_balance_line). is provided by account_balance_line).
.. image:: ./static/docs/journal_entries_1.png .. image:: ./static/docs/journal_items.png
:alt: Journal entries :alt: Journal items
:scale: 50 %
.. image:: ./static/docs/journal_entries_2.png
:alt: Reconciled lines view
:scale: 50 % :scale: 50 %

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@@ -84,6 +84,8 @@ class TestAccountMoveReconcileHelper(TransactionCase):
) )
lines.reconcile() lines.reconcile()
# For v13, need to force compute
lines._compute_reconciled_lines()
for line in lines: for line in lines:
self.assertEquals(line.reconcile_line_ids, lines) self.assertEquals(line.reconcile_line_ids, lines)
@@ -102,6 +104,8 @@ class TestAccountMoveReconcileHelper(TransactionCase):
) )
lines.reconcile() lines.reconcile()
# For v13, need to force compute
lines._compute_reconciled_lines()
for line in lines: for line in lines:
self.assertEquals(line.reconcile_line_ids, lines) self.assertEquals(line.reconcile_line_ids, lines)

View File

@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 ACSONE SA/NV <!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record id="account_move_line_tree_view" model="ir.ui.view"> <record id="account_move_line_tree_view" model="ir.ui.view">
<field name="name">account.move.line.tree (in account_move_reconcile_helper)</field> <field
name="name"
>account.move.line.tree (in account_move_reconcile_helper)</field>
<field name="model">account.move.line</field> <field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree" /> <field name="inherit_id" ref="account.view_move_line_tree" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="full_reconcile_id" position="after"> <field name="full_reconcile_id" position="after">
<field name="partial_reconciliation_in_progress" invisible="1" /> <field name="partial_reconciliation_in_progress" invisible="1" />
<button name="open_full_reconcile_view" type="object" <button
string="Reconciled lines" icon="fa-list" name="open_full_reconcile_view"
attrs="{'invisible': [('full_reconcile_id', '=', False), ('partial_reconciliation_in_progress', '=', False)]}"/> type="object"
string="Reconciled lines"
icon="fa-list"
attrs="{'invisible': [('full_reconcile_id', '=', False), ('partial_reconciliation_in_progress', '=', False)]}"
/>
</field> </field>
</field> </field>
</record> </record>
</odoo> </odoo>