mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[14.0][MIG] account_move_reconcile_helper: Migration to 14.0
This commit is contained in:
committed by
Ethan Hildick
parent
a757ae7c75
commit
e8c06b23ce
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Account Move Reconcile Helper",
|
"name": "Account Move Reconcile Helper",
|
||||||
"summary": "Provides tools to facilitate reconciliation",
|
"summary": "Provides tools to facilitate reconciliation",
|
||||||
"version": "13.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/account-reconcile",
|
"website": "https://github.com/OCA/account-reconcile",
|
||||||
|
|||||||
@@ -1,29 +1,19 @@
|
|||||||
# 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).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
|
|
||||||
_inherit = "account.move.line"
|
_inherit = "account.move.line"
|
||||||
|
|
||||||
partial_reconciliation_in_progress = fields.Boolean(
|
|
||||||
compute="_compute_partial_reconciliation_in_progress"
|
|
||||||
)
|
|
||||||
reconcile_line_ids = fields.One2many(
|
reconcile_line_ids = fields.One2many(
|
||||||
compute="_compute_reconciled_lines",
|
compute="_compute_reconciled_lines",
|
||||||
comodel_name="account.move.line",
|
comodel_name="account.move.line",
|
||||||
string="Reconciled lines",
|
string="Reconciled lines",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("matched_debit_ids", "matched_credit_ids")
|
|
||||||
def _compute_partial_reconciliation_in_progress(self):
|
|
||||||
for rec in self:
|
|
||||||
rec.partial_reconciliation_in_progress = bool(
|
|
||||||
rec.matched_debit_ids
|
|
||||||
) or bool(rec.matched_credit_ids)
|
|
||||||
|
|
||||||
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()
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ class TestAccountMoveReconcileHelper(TransactionCase):
|
|||||||
"name": "Sales journal",
|
"name": "Sales journal",
|
||||||
"code": "MRH-SAJT",
|
"code": "MRH-SAJT",
|
||||||
"type": "sale",
|
"type": "sale",
|
||||||
"default_credit_account_id": self.account_sale.id,
|
"default_account_id": self.account_sale.id,
|
||||||
"default_debit_account_id": self.account_sale.id,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -82,13 +81,13 @@ class TestAccountMoveReconcileHelper(TransactionCase):
|
|||||||
("account_id", "=", self.account_recv.id),
|
("account_id", "=", self.account_recv.id),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
lines.mapped("move_id").action_post()
|
||||||
lines.reconcile()
|
lines.reconcile()
|
||||||
# For v13, need to force compute
|
# For v13, need to force compute
|
||||||
lines._compute_reconciled_lines()
|
lines._compute_reconciled_lines()
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
self.assertEquals(line.reconcile_line_ids, lines)
|
self.assertEqual(line.reconcile_line_ids, lines)
|
||||||
|
|
||||||
def test_02_full_reconcile(self):
|
def test_02_full_reconcile(self):
|
||||||
base_move = self.create_account_move(5000, self.account_recv, self.account_sale)
|
base_move = self.create_account_move(5000, self.account_recv, self.account_sale)
|
||||||
@@ -102,13 +101,13 @@ class TestAccountMoveReconcileHelper(TransactionCase):
|
|||||||
("account_id", "=", self.account_recv.id),
|
("account_id", "=", self.account_recv.id),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
lines.mapped("move_id").action_post()
|
||||||
lines.reconcile()
|
lines.reconcile()
|
||||||
# For v13, need to force compute
|
# For v13, need to force compute
|
||||||
lines._compute_reconciled_lines()
|
lines._compute_reconciled_lines()
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
self.assertEquals(line.reconcile_line_ids, lines)
|
self.assertEqual(line.reconcile_line_ids, lines)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
line.full_reconcile_id.reconciled_line_ids, line.reconcile_line_ids
|
line.full_reconcile_id.reconciled_line_ids, line.reconcile_line_ids
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,16 +9,26 @@
|
|||||||
<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="matching_number" position="after">
|
||||||
<field name="partial_reconciliation_in_progress" invisible="1" />
|
|
||||||
<button
|
<button
|
||||||
name="open_full_reconcile_view"
|
name="open_full_reconcile_view"
|
||||||
type="object"
|
type="object"
|
||||||
string="Reconciled lines"
|
title="Reconciled lines"
|
||||||
icon="fa-list"
|
icon="fa-list"
|
||||||
attrs="{'invisible': [('full_reconcile_id', '=', False), ('partial_reconciliation_in_progress', '=', False)]}"
|
attrs="{'invisible': [('matching_number', '=', False)]}"
|
||||||
/>
|
/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="view_move_line_tax_audit_tree" model="ir.ui.view">
|
||||||
|
<field name="name">account.move.line.tax.audit.tree</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="inherit_id" ref="account.view_move_line_tax_audit_tree" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="move_id" position="after">
|
||||||
|
<field name="matching_number" invisible="1" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user