[ADD] account_reconcile_oca
parent
cd0a37535f
commit
8e2365f5ec
|
@ -0,0 +1,96 @@
|
||||||
|
=====================
|
||||||
|
Account Reconcile Oca
|
||||||
|
=====================
|
||||||
|
|
||||||
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
:target: https://odoo-community.org/page/development-status
|
||||||
|
:alt: Beta
|
||||||
|
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github
|
||||||
|
:target: https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca
|
||||||
|
:alt: OCA/account-reconcile
|
||||||
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
|
:target: https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_oca
|
||||||
|
:alt: Translate me on Weblate
|
||||||
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
|
:target: https://runbot.odoo-community.org/runbot/98/16.0
|
||||||
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
This addon allows to reconcile bank statements and account marked as `reconcile`.
|
||||||
|
|
||||||
|
**Table of contents**
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
Bank reconcile
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Access `Invoicing / Dashboard` with a user with Full Acounting capabilities.
|
||||||
|
Select reconcile on the journal of your choice.
|
||||||
|
|
||||||
|
Account reconcile
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Access `Invoicing / Accounting / Actions / Reconcile`
|
||||||
|
All the possible reconcile options will show and you will be able to reconcile properly.
|
||||||
|
You can access the same widget from accounts and Partners.
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
The following bugs are already detected:
|
||||||
|
|
||||||
|
* Creation of activities on the chatter do show automatically
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-reconcile/issues>`_.
|
||||||
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
|
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
* CreuBlanca
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Enric Tobella
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
:target: https://odoo-community.org
|
||||||
|
|
||||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.
|
||||||
|
|
||||||
|
This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca>`_ project on GitHub.
|
||||||
|
|
||||||
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
@ -0,0 +1,2 @@
|
||||||
|
from . import models
|
||||||
|
from .hooks import post_init_hook
|
|
@ -0,0 +1,45 @@
|
||||||
|
# Copyright 2022 CreuBlanca
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "Account Reconcile Oca",
|
||||||
|
"summary": """
|
||||||
|
Reconcile addons for Odoo CE accounting""",
|
||||||
|
"version": "16.0.1.0.0",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"author": "CreuBlanca,Odoo Community Association (OCA)",
|
||||||
|
"maintainers": ["etobella"],
|
||||||
|
"website": "https://github.com/OCA/account-reconcile",
|
||||||
|
"depends": [
|
||||||
|
"account",
|
||||||
|
"base_sparse_field",
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
"security/ir.model.access.csv",
|
||||||
|
"views/account_account_reconcile.xml",
|
||||||
|
"views/account_bank_statement_line.xml",
|
||||||
|
"views/account_move_line.xml",
|
||||||
|
"views/account_journal.xml",
|
||||||
|
"views/account_move.xml",
|
||||||
|
"views/account_account.xml",
|
||||||
|
],
|
||||||
|
"demo": ["demo/demo.xml"],
|
||||||
|
"post_init_hook": "post_init_hook",
|
||||||
|
"assets": {
|
||||||
|
"web.assets_backend": [
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_manual_view.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_data_widget.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_chatter_field.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/selection_badge_uncheck.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_move_line_view.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_move_line_widget.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_kanban_record.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_renderer.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_controller.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_view.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/js/reconcile_form_view.esm.js",
|
||||||
|
"account_reconcile_oca/static/src/xml/reconcile.xml",
|
||||||
|
"account_reconcile_oca/static/src/scss/reconcile.scss",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="base.user_admin" model="res.users">
|
||||||
|
<field name="groups_id" eval="[(4,ref('account.group_account_user'))]" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
|
@ -0,0 +1,8 @@
|
||||||
|
def post_init_hook(cr, registry):
|
||||||
|
cr.execute(
|
||||||
|
"""
|
||||||
|
UPDATE account_bank_statement_line
|
||||||
|
SET reconcile_mode = 'edit'
|
||||||
|
WHERE is_reconciled
|
||||||
|
"""
|
||||||
|
)
|
|
@ -0,0 +1,4 @@
|
||||||
|
from . import account_reconcile_abstract
|
||||||
|
from . import account_journal
|
||||||
|
from . import account_bank_statement_line
|
||||||
|
from . import account_account_reconcile
|
|
@ -0,0 +1,171 @@
|
||||||
|
# Copyright 2022 CreuBlanca
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class CharId(fields.Id):
|
||||||
|
type = "string"
|
||||||
|
column_type = ("varchar", fields.pg_varchar())
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAccountReconcile(models.Model):
|
||||||
|
_name = "account.account.reconcile"
|
||||||
|
_description = "Account Account Reconcile"
|
||||||
|
_inherit = "account.reconcile.abstract"
|
||||||
|
_auto = False
|
||||||
|
|
||||||
|
reconcile_data_info = fields.Serialized(inverse="_inverse_reconcile_data_info")
|
||||||
|
|
||||||
|
partner_id = fields.Many2one("res.partner")
|
||||||
|
account_id = fields.Many2one("account.account")
|
||||||
|
name = fields.Char()
|
||||||
|
is_reconciled = fields.Boolean()
|
||||||
|
currency_id = fields.Many2one("res.currency")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _table_query(self):
|
||||||
|
return "%s %s %s %s %s" % (
|
||||||
|
self._select(),
|
||||||
|
self._from(),
|
||||||
|
self._where(),
|
||||||
|
self._groupby(),
|
||||||
|
self._having(),
|
||||||
|
)
|
||||||
|
|
||||||
|
def _select(self):
|
||||||
|
return """
|
||||||
|
SELECT
|
||||||
|
CAST(
|
||||||
|
(
|
||||||
|
coalesce(aml.partner_id, 0) + a.id
|
||||||
|
)*(
|
||||||
|
COALESCE(aml.partner_id, 0)+a.id - 1
|
||||||
|
)/2 + COALESCE(aml.partner_id, 0) AS INTEGER
|
||||||
|
) as id,
|
||||||
|
MAX(a.name) as name,
|
||||||
|
aml.partner_id,
|
||||||
|
a.id as account_id,
|
||||||
|
FALSE as is_reconciled,
|
||||||
|
aml.currency_id as currency_id,
|
||||||
|
a.company_id
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _from(self):
|
||||||
|
return """
|
||||||
|
FROM
|
||||||
|
account_account a
|
||||||
|
INNER JOIN account_move_line aml ON aml.account_id = a.id
|
||||||
|
INNER JOIN account_move am ON am.id = aml.move_id
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _where(self):
|
||||||
|
return """
|
||||||
|
WHERE a.reconcile
|
||||||
|
AND am.state = 'posted'
|
||||||
|
AND aml.amount_residual != 0
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _groupby(self):
|
||||||
|
return """
|
||||||
|
GROUP BY
|
||||||
|
a.id, aml.partner_id, aml.currency_id, a.company_id
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _having(self):
|
||||||
|
return """
|
||||||
|
HAVING
|
||||||
|
SUM(aml.debit) > 0
|
||||||
|
AND SUM(aml.credit) > 0
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _compute_reconcile_data_info(self):
|
||||||
|
data_obj = self.env["account.account.reconcile.data"]
|
||||||
|
for record in self:
|
||||||
|
data_record = data_obj.search(
|
||||||
|
[("user_id", "=", self.env.user.id), ("reconcile_id", "=", record.id)]
|
||||||
|
)
|
||||||
|
if data_record:
|
||||||
|
record.reconcile_data_info = data_record.data
|
||||||
|
else:
|
||||||
|
record.reconcile_data_info = {"data": [], "counterparts": []}
|
||||||
|
|
||||||
|
def _inverse_reconcile_data_info(self):
|
||||||
|
data_obj = self.env["account.account.reconcile.data"]
|
||||||
|
for record in self:
|
||||||
|
data_record = data_obj.search(
|
||||||
|
[("user_id", "=", self.env.user.id), ("reconcile_id", "=", record.id)]
|
||||||
|
)
|
||||||
|
if data_record:
|
||||||
|
data_record.data = record.reconcile_data_info
|
||||||
|
else:
|
||||||
|
data_obj.create(
|
||||||
|
{
|
||||||
|
"reconcile_id": record.id,
|
||||||
|
"user_id": self.env.user.id,
|
||||||
|
"data": record.reconcile_data_info,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.onchange("add_account_move_line_id")
|
||||||
|
def _onchange_add_account_move_line(self):
|
||||||
|
if self.add_account_move_line_id:
|
||||||
|
data = self.reconcile_data_info
|
||||||
|
if self.add_account_move_line_id.id not in data["counterparts"]:
|
||||||
|
data["counterparts"].append(self.add_account_move_line_id.id)
|
||||||
|
else:
|
||||||
|
del data["counterparts"][
|
||||||
|
data["counterparts"].index(self.add_account_move_line_id.id)
|
||||||
|
]
|
||||||
|
self.reconcile_data_info = self._recompute_data(data)
|
||||||
|
self.add_account_move_line_id = False
|
||||||
|
|
||||||
|
@api.onchange("manual_reference", "manual_delete")
|
||||||
|
def _onchange_manual_reconcile_reference(self):
|
||||||
|
self.ensure_one()
|
||||||
|
data = self.reconcile_data_info
|
||||||
|
counterparts = []
|
||||||
|
for line in data["data"]:
|
||||||
|
if line["reference"] == self.manual_reference:
|
||||||
|
if self.manual_delete:
|
||||||
|
continue
|
||||||
|
counterparts.append(line["id"])
|
||||||
|
data["counterparts"] = counterparts
|
||||||
|
self.reconcile_data_info = self._recompute_data(data)
|
||||||
|
self.manual_delete = False
|
||||||
|
self.manual_reference = False
|
||||||
|
|
||||||
|
def _recompute_data(self, data):
|
||||||
|
new_data = {"data": [], "counterparts": data["counterparts"]}
|
||||||
|
counterparts = data["counterparts"]
|
||||||
|
amount = 0.0
|
||||||
|
for line_id in counterparts:
|
||||||
|
line = self._get_reconcile_line(
|
||||||
|
self.env["account.move.line"].browse(line_id), "other", True, amount
|
||||||
|
)
|
||||||
|
new_data["data"].append(line)
|
||||||
|
amount += line["amount"]
|
||||||
|
return new_data
|
||||||
|
|
||||||
|
def clean_reconcile(self):
|
||||||
|
self.ensure_one()
|
||||||
|
self.reconcile_data_info = {"data": [], "counterparts": []}
|
||||||
|
|
||||||
|
def reconcile(self):
|
||||||
|
lines = self.env["account.move.line"].browse(
|
||||||
|
self.reconcile_data_info["counterparts"]
|
||||||
|
)
|
||||||
|
lines.reconcile()
|
||||||
|
data_record = self.env["account.account.reconcile.data"].search(
|
||||||
|
[("user_id", "=", self.env.user.id), ("reconcile_id", "=", self.id)]
|
||||||
|
)
|
||||||
|
data_record.unlink()
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAccountReconcileData(models.TransientModel):
|
||||||
|
_name = "account.account.reconcile.data"
|
||||||
|
_description = "Reconcile data model to store user info"
|
||||||
|
|
||||||
|
user_id = fields.Many2one("res.users", required=True)
|
||||||
|
reconcile_id = fields.Integer(required=True)
|
||||||
|
data = fields.Serialized()
|
|
@ -0,0 +1,574 @@
|
||||||
|
# Copyright 2022 CreuBlanca
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
from odoo import Command, _, api, fields, models
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
|
class AccountBankStatementLine(models.Model):
|
||||||
|
_name = "account.bank.statement.line"
|
||||||
|
_inherit = ["account.bank.statement.line", "account.reconcile.abstract"]
|
||||||
|
|
||||||
|
reconcile_data_info = fields.Serialized(inverse="_inverse_reconcile_data_info")
|
||||||
|
reconcile_mode = fields.Selection(
|
||||||
|
selection=lambda self: self.env["account.journal"]
|
||||||
|
._fields["reconcile_mode"]
|
||||||
|
.selection
|
||||||
|
)
|
||||||
|
company_id = fields.Many2one(related="journal_id.company_id")
|
||||||
|
reconcile_data = fields.Serialized()
|
||||||
|
manual_line_id = fields.Many2one(
|
||||||
|
"account.move.line",
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_kind = fields.Char(
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_account_id = fields.Many2one(
|
||||||
|
"account.account",
|
||||||
|
check_company=True,
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_partner_id = fields.Many2one(
|
||||||
|
"res.partner",
|
||||||
|
check_company=True,
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_model_id = fields.Many2one(
|
||||||
|
"account.reconcile.model",
|
||||||
|
check_company=True,
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
domain=[("rule_type", "=", "writeoff_button")],
|
||||||
|
)
|
||||||
|
manual_delete = fields.Boolean(
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_name = fields.Char(store=False, default=False, prefetch=False)
|
||||||
|
manual_amount = fields.Monetary(store=False, default=False, prefetch=False)
|
||||||
|
can_reconcile = fields.Boolean(sparse="reconcile_data_info")
|
||||||
|
|
||||||
|
def save(self):
|
||||||
|
return {"type": "ir.actions.act_window_close"}
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def action_new_line(self):
|
||||||
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
|
"account_reconcile_oca.action_bank_statement_line_create"
|
||||||
|
)
|
||||||
|
action["context"] = self.env.context
|
||||||
|
return action
|
||||||
|
|
||||||
|
@api.onchange("manual_model_id")
|
||||||
|
def _onchange_manual_model_id(self):
|
||||||
|
if self.manual_model_id:
|
||||||
|
data = []
|
||||||
|
for line in self.reconcile_data_info.get("data", []):
|
||||||
|
if line.get("kind") != "suspense":
|
||||||
|
data.append(line)
|
||||||
|
self.reconcile_data_info = self._recompute_suspense_line(
|
||||||
|
*self._reconcile_data_by_model(
|
||||||
|
data,
|
||||||
|
self.manual_model_id,
|
||||||
|
self.reconcile_data_info["reconcile_auxiliary_id"],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Refreshing data
|
||||||
|
self.reconcile_data_info = self.browse(
|
||||||
|
self.id.origin
|
||||||
|
)._default_reconcile_data()
|
||||||
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||||
|
|
||||||
|
@api.onchange("add_account_move_line_id")
|
||||||
|
def _onchange_add_account_move_line_id(self):
|
||||||
|
if self.add_account_move_line_id:
|
||||||
|
data = self.reconcile_data_info["data"]
|
||||||
|
new_data = []
|
||||||
|
is_new_line = True
|
||||||
|
pending_amount = 0.0
|
||||||
|
for line in data:
|
||||||
|
if line["kind"] != "suspense":
|
||||||
|
pending_amount += line["amount"]
|
||||||
|
if line.get("counterpart_line_id") == self.add_account_move_line_id.id:
|
||||||
|
is_new_line = False
|
||||||
|
else:
|
||||||
|
new_data.append(line)
|
||||||
|
if is_new_line:
|
||||||
|
new_data.append(
|
||||||
|
self._get_reconcile_line(
|
||||||
|
self.add_account_move_line_id, "other", True, pending_amount
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.reconcile_data_info = self._recompute_suspense_line(
|
||||||
|
new_data, self.reconcile_data_info["reconcile_auxiliary_id"]
|
||||||
|
)
|
||||||
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||||
|
self.add_account_move_line_id = False
|
||||||
|
|
||||||
|
def _recompute_suspense_line(self, data, reconcile_auxiliary_id):
|
||||||
|
can_reconcile = True
|
||||||
|
total_amount = 0
|
||||||
|
new_data = []
|
||||||
|
suspense_line = False
|
||||||
|
counterparts = []
|
||||||
|
for line in data:
|
||||||
|
if line.get("counterpart_line_id"):
|
||||||
|
counterparts.append(line["counterpart_line_id"])
|
||||||
|
if (
|
||||||
|
line["account_id"][0] == self.journal_id.suspense_account_id.id
|
||||||
|
or not line["account_id"][0]
|
||||||
|
) and line["kind"] != "suspense":
|
||||||
|
can_reconcile = False
|
||||||
|
if line["kind"] != "suspense":
|
||||||
|
new_data.append(line)
|
||||||
|
total_amount += line["amount"]
|
||||||
|
else:
|
||||||
|
suspense_line = line
|
||||||
|
if not float_is_zero(
|
||||||
|
total_amount, precision_digits=self.currency_id.decimal_places
|
||||||
|
):
|
||||||
|
can_reconcile = False
|
||||||
|
if suspense_line:
|
||||||
|
suspense_line.update(
|
||||||
|
{
|
||||||
|
"amount": -total_amount,
|
||||||
|
"credit": total_amount if total_amount > 0 else 0.0,
|
||||||
|
"debit": -total_amount if total_amount < 0 else 0.0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
suspense_line = {
|
||||||
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
||||||
|
"id": False,
|
||||||
|
"account_id": self.journal_id.suspense_account_id.name_get()[0],
|
||||||
|
"partner_id": self.partner_id
|
||||||
|
and self.partner_id.name_get()[0]
|
||||||
|
or False,
|
||||||
|
"date": fields.Date.to_string(self.date),
|
||||||
|
"name": self.name,
|
||||||
|
"amount": -total_amount,
|
||||||
|
"credit": total_amount if total_amount > 0 else 0.0,
|
||||||
|
"debit": -total_amount if total_amount < 0 else 0.0,
|
||||||
|
"kind": "suspense",
|
||||||
|
"currency_id": self.currency_id.id,
|
||||||
|
}
|
||||||
|
reconcile_auxiliary_id += 1
|
||||||
|
new_data.append(suspense_line)
|
||||||
|
return {
|
||||||
|
"data": new_data,
|
||||||
|
"counterparts": counterparts,
|
||||||
|
"reconcile_auxiliary_id": reconcile_auxiliary_id,
|
||||||
|
"can_reconcile": can_reconcile,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _check_line_changed(self, line):
|
||||||
|
return (
|
||||||
|
not float_is_zero(
|
||||||
|
self.manual_amount - line["amount"],
|
||||||
|
precision_digits=self.currency_id.decimal_places,
|
||||||
|
)
|
||||||
|
or self.manual_account_id.id != line["account_id"][0]
|
||||||
|
or self.manual_name != line["name"]
|
||||||
|
or (
|
||||||
|
self.manual_partner_id and self.manual_partner_id.name_get()[0] or False
|
||||||
|
)
|
||||||
|
!= line.get("partner_id")
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.onchange("manual_reference", "manual_delete")
|
||||||
|
def _onchange_manual_reconcile_reference(self):
|
||||||
|
self.ensure_one()
|
||||||
|
data = self.reconcile_data_info.get("data", [])
|
||||||
|
new_data = []
|
||||||
|
for line in data:
|
||||||
|
if line["reference"] == self.manual_reference:
|
||||||
|
if self.manual_delete:
|
||||||
|
self.update(
|
||||||
|
{
|
||||||
|
"manual_delete": False,
|
||||||
|
"manual_reference": False,
|
||||||
|
"manual_account_id": False,
|
||||||
|
"manual_amount": False,
|
||||||
|
"manual_name": False,
|
||||||
|
"manual_partner_id": False,
|
||||||
|
"manual_line_id": False,
|
||||||
|
"manual_kind": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
self.manual_account_id = line["account_id"][0]
|
||||||
|
self.manual_amount = line["amount"]
|
||||||
|
self.manual_name = line["name"]
|
||||||
|
self.manual_partner_id = (
|
||||||
|
line.get("partner_id") and line["partner_id"][0]
|
||||||
|
)
|
||||||
|
self.manual_line_id = line["id"]
|
||||||
|
self.manual_kind = line["kind"]
|
||||||
|
new_data.append(line)
|
||||||
|
self.reconcile_data_info = self._recompute_suspense_line(
|
||||||
|
new_data, self.reconcile_data_info["reconcile_auxiliary_id"]
|
||||||
|
)
|
||||||
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||||
|
|
||||||
|
@api.onchange(
|
||||||
|
"manual_account_id",
|
||||||
|
"manual_partner_id",
|
||||||
|
"manual_name",
|
||||||
|
"manual_amount",
|
||||||
|
)
|
||||||
|
def _onchange_manual_reconcile_vals(self):
|
||||||
|
self.ensure_one()
|
||||||
|
data = self.reconcile_data_info.get("data", [])
|
||||||
|
new_data = []
|
||||||
|
for line in data:
|
||||||
|
if line["reference"] == self.manual_reference:
|
||||||
|
if self._check_line_changed(line):
|
||||||
|
line.update(
|
||||||
|
{
|
||||||
|
"name": self.manual_name,
|
||||||
|
"partner_id": self.manual_partner_id
|
||||||
|
and self.manual_partner_id.name_get()[0]
|
||||||
|
or False,
|
||||||
|
"account_id": self.manual_account_id.name_get()[0]
|
||||||
|
if self.manual_account_id
|
||||||
|
else [False, _("Undefined")],
|
||||||
|
"amount": self.manual_amount,
|
||||||
|
"credit": -self.manual_amount
|
||||||
|
if self.manual_amount < 0
|
||||||
|
else 0.0,
|
||||||
|
"debit": self.manual_amount
|
||||||
|
if self.manual_amount > 0
|
||||||
|
else 0.0,
|
||||||
|
"kind": line["kind"]
|
||||||
|
if line["kind"] != "suspense"
|
||||||
|
else "other",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if line["kind"] == "liquidity":
|
||||||
|
self._update_move_partner()
|
||||||
|
new_data.append(line)
|
||||||
|
self.reconcile_data_info = self._recompute_suspense_line(
|
||||||
|
new_data, self.reconcile_data_info["reconcile_auxiliary_id"]
|
||||||
|
)
|
||||||
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||||
|
|
||||||
|
def _update_move_partner(self):
|
||||||
|
if self.partner_id == self.manual_partner_id:
|
||||||
|
return
|
||||||
|
self.partner_id = self.manual_partner_id
|
||||||
|
|
||||||
|
@api.depends("reconcile_data")
|
||||||
|
def _compute_reconcile_data_info(self):
|
||||||
|
for record in self:
|
||||||
|
if record.reconcile_data:
|
||||||
|
record.reconcile_data_info = record.reconcile_data
|
||||||
|
else:
|
||||||
|
record.reconcile_data_info = record._default_reconcile_data()
|
||||||
|
record.can_reconcile = record.reconcile_data_info.get(
|
||||||
|
"can_reconcile", False
|
||||||
|
)
|
||||||
|
|
||||||
|
def action_show_move(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
|
"account.action_move_journal_line"
|
||||||
|
)
|
||||||
|
action.update(
|
||||||
|
{"res_id": self.move_id.id, "views": [[False, "form"]], "view_mode": "form"}
|
||||||
|
)
|
||||||
|
return action
|
||||||
|
|
||||||
|
def _inverse_reconcile_data_info(self):
|
||||||
|
for record in self:
|
||||||
|
record.reconcile_data = record.reconcile_data_info
|
||||||
|
|
||||||
|
def _reconcile_data_by_model(self, data, reconcile_model, reconcile_auxiliary_id):
|
||||||
|
new_data = []
|
||||||
|
liquidity_amount = 0.0
|
||||||
|
for line_data in data:
|
||||||
|
if line_data["kind"] == "suspense":
|
||||||
|
continue
|
||||||
|
new_data.append(line_data)
|
||||||
|
liquidity_amount += line_data["amount"]
|
||||||
|
for line in reconcile_model._apply_lines_for_bank_widget(
|
||||||
|
-liquidity_amount, self._retrieve_partner(), self
|
||||||
|
):
|
||||||
|
amount = line["amount_currency"]
|
||||||
|
new_line = {
|
||||||
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
||||||
|
"id": False,
|
||||||
|
"amount": amount,
|
||||||
|
"debit": amount if amount > 0 else 0.0,
|
||||||
|
"credit": -amount if amount < 0 else 0.0,
|
||||||
|
"kind": "other",
|
||||||
|
"account_id": self.env["account.account"]
|
||||||
|
.browse(line["account_id"])
|
||||||
|
.name_get()[0],
|
||||||
|
"date": fields.Date.to_string(self.date),
|
||||||
|
"name": line.get("name"),
|
||||||
|
"currency_id": line.get("currency_id"),
|
||||||
|
}
|
||||||
|
reconcile_auxiliary_id += 1
|
||||||
|
if line.get("partner_id"):
|
||||||
|
new_line["partner_id"] = (
|
||||||
|
self.env["res.partner"].browse(line["partner_id"]).name_get()[0]
|
||||||
|
)
|
||||||
|
new_data.append(new_line)
|
||||||
|
return new_data, reconcile_auxiliary_id
|
||||||
|
|
||||||
|
def _compute_exchange_rate(self, data):
|
||||||
|
reconcile_auxiliary_id = 1
|
||||||
|
if not self.foreign_currency_id or self.is_reconciled:
|
||||||
|
return reconcile_auxiliary_id
|
||||||
|
currency = self.journal_id.currency_id or self.company_id.currency_id
|
||||||
|
currency_amount = self.foreign_currency_id._convert(
|
||||||
|
self.amount_currency, currency, self.company_id, self.date
|
||||||
|
)
|
||||||
|
amount = sum(d["amount"] for d in data) - currency_amount
|
||||||
|
if not currency.is_zero(amount):
|
||||||
|
account = self.company_id.expense_currency_exchange_account_id
|
||||||
|
if amount > 0:
|
||||||
|
account = self.company_id.income_currency_exchange_account_id
|
||||||
|
data.append(
|
||||||
|
{
|
||||||
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
||||||
|
"id": False,
|
||||||
|
"account_id": account.name_get()[0],
|
||||||
|
"partner_id": False,
|
||||||
|
"date": fields.Date.to_string(self.date),
|
||||||
|
"name": self.name,
|
||||||
|
"amount": -amount,
|
||||||
|
"credit": amount if amount > 0 else 0.0,
|
||||||
|
"debit": -amount if amount < 0 else 0.0,
|
||||||
|
"kind": "other",
|
||||||
|
"currency_id": self.currency_id.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
reconcile_auxiliary_id += 1
|
||||||
|
return reconcile_auxiliary_id
|
||||||
|
|
||||||
|
def _default_reconcile_data(self):
|
||||||
|
liquidity_lines, suspense_lines, other_lines = self._seek_for_lines()
|
||||||
|
data = [self._get_reconcile_line(line, "liquidity") for line in liquidity_lines]
|
||||||
|
reconcile_auxiliary_id = self._compute_exchange_rate(data)
|
||||||
|
res = (
|
||||||
|
self.env["account.reconcile.model"]
|
||||||
|
.search([("rule_type", "in", ["invoice_matching", "writeoff_suggestion"])])
|
||||||
|
._apply_rules(self, self._retrieve_partner())
|
||||||
|
)
|
||||||
|
if res and res.get("status", "") == "write_off":
|
||||||
|
return self._recompute_suspense_line(
|
||||||
|
*self._reconcile_data_by_model(
|
||||||
|
data, res["model"], reconcile_auxiliary_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif res and res.get("amls"):
|
||||||
|
amount = self.amount
|
||||||
|
for line in res.get("amls", []):
|
||||||
|
line_data = self._get_reconcile_line(
|
||||||
|
line, "other", is_counterpart=True, max_amount=amount
|
||||||
|
)
|
||||||
|
amount -= line_data.get("amount")
|
||||||
|
data.append(line_data)
|
||||||
|
return self._recompute_suspense_line(data, reconcile_auxiliary_id)
|
||||||
|
return self._recompute_suspense_line(
|
||||||
|
data + [self._get_reconcile_line(line, "other") for line in other_lines],
|
||||||
|
reconcile_auxiliary_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
def clean_reconcile(self):
|
||||||
|
self.reconcile_data_info = self._default_reconcile_data()
|
||||||
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
||||||
|
|
||||||
|
def reconcile_bank_line(self):
|
||||||
|
self.ensure_one()
|
||||||
|
self.reconcile_mode = self.journal_id.reconcile_mode
|
||||||
|
return getattr(self, "_reconcile_bank_line_%s" % self.reconcile_mode)(
|
||||||
|
self.reconcile_data_info["data"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def _reconcile_bank_line_edit(self, data):
|
||||||
|
_liquidity_lines, suspense_lines, other_lines = self._seek_for_lines()
|
||||||
|
lines_to_remove = [(2, line.id) for line in suspense_lines + other_lines]
|
||||||
|
|
||||||
|
# Cleanup previous lines.
|
||||||
|
move = self.move_id
|
||||||
|
container = {"records": move, "self": move}
|
||||||
|
to_reconcile = []
|
||||||
|
with move._check_balanced(container):
|
||||||
|
move.with_context(
|
||||||
|
skip_account_move_synchronization=True, force_delete=True
|
||||||
|
).write(
|
||||||
|
{
|
||||||
|
"line_ids": lines_to_remove,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
for line_vals in data:
|
||||||
|
if line_vals["kind"] == "liquidity":
|
||||||
|
continue
|
||||||
|
line = (
|
||||||
|
self.env["account.move.line"]
|
||||||
|
.with_context(check_move_validity=False)
|
||||||
|
.create(self._reconcile_move_line_vals(line_vals))
|
||||||
|
)
|
||||||
|
if line_vals.get("counterpart_line_id"):
|
||||||
|
to_reconcile.append(
|
||||||
|
self.env["account.move.line"].browse(
|
||||||
|
line_vals.get("counterpart_line_id")
|
||||||
|
)
|
||||||
|
+ line
|
||||||
|
)
|
||||||
|
for reconcile_items in to_reconcile:
|
||||||
|
reconcile_items.reconcile()
|
||||||
|
|
||||||
|
def _reconcile_bank_line_keep_move_vals(self):
|
||||||
|
return {
|
||||||
|
"journal_id": self.journal_id.id,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _reconcile_bank_line_keep(self, data):
|
||||||
|
move = (
|
||||||
|
self.env["account.move"]
|
||||||
|
.with_context(skip_invoice_sync=True)
|
||||||
|
.create(self._reconcile_bank_line_keep_move_vals())
|
||||||
|
)
|
||||||
|
_liquidity_lines, suspense_lines, other_lines = self._seek_for_lines()
|
||||||
|
container = {"records": move, "self": move}
|
||||||
|
to_reconcile = defaultdict(lambda: self.env["account.move.line"])
|
||||||
|
with move._check_balanced(container):
|
||||||
|
for line in suspense_lines | other_lines:
|
||||||
|
to_reconcile[line.account_id.id] |= line
|
||||||
|
line_data = line.with_context(
|
||||||
|
active_test=False,
|
||||||
|
include_business_fields=True,
|
||||||
|
).copy_data({"move_id": move.id})[0]
|
||||||
|
to_reconcile[line.account_id.id] |= (
|
||||||
|
self.env["account.move.line"]
|
||||||
|
.with_context(check_move_validity=False, skip_invoice_sync=True)
|
||||||
|
.create(line_data)
|
||||||
|
)
|
||||||
|
move.write(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
Command.update(
|
||||||
|
line.id,
|
||||||
|
{
|
||||||
|
"balance": -line.balance,
|
||||||
|
"amount_currency": -line.amount_currency,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
for line in move.line_ids
|
||||||
|
if line.move_id.move_type == "entry"
|
||||||
|
or line.display_type == "cogs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
for line_vals in data:
|
||||||
|
if line_vals["kind"] == "liquidity":
|
||||||
|
continue
|
||||||
|
if line_vals["kind"] == "suspense":
|
||||||
|
raise UserError(_("No supense lines are allowed when reconciling"))
|
||||||
|
line = (
|
||||||
|
self.env["account.move.line"]
|
||||||
|
.with_context(check_move_validity=False, skip_invoice_sync=True)
|
||||||
|
.create(self._reconcile_move_line_vals(line_vals, move.id))
|
||||||
|
)
|
||||||
|
if line_vals.get("counterpart_line_id") and line.account_id.reconcile:
|
||||||
|
to_reconcile[line.account_id.id] |= (
|
||||||
|
self.env["account.move.line"].browse(
|
||||||
|
line_vals.get("counterpart_line_id")
|
||||||
|
)
|
||||||
|
| line
|
||||||
|
)
|
||||||
|
move.invalidate_recordset()
|
||||||
|
move._post()
|
||||||
|
for _account, lines in to_reconcile.items():
|
||||||
|
lines.reconcile()
|
||||||
|
|
||||||
|
def unreconcile_bank_line(self):
|
||||||
|
self.ensure_one()
|
||||||
|
return getattr(self, "_unreconcile_bank_line_%s" % self.reconcile_mode)(
|
||||||
|
self.reconcile_data_info["data"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def _unreconcile_bank_line_edit(self, data):
|
||||||
|
self.move_id.button_draft()
|
||||||
|
self.move_id.line_ids.unlink()
|
||||||
|
self.move_id.write(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(0, 0, line_vals)
|
||||||
|
for line_vals in self._prepare_move_line_default_vals()
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.move_id.action_post()
|
||||||
|
|
||||||
|
def _unreconcile_bank_line_keep(self, data):
|
||||||
|
raise UserError(_("Keep suspense move lines mode cannot be unreconciled"))
|
||||||
|
|
||||||
|
def _reconcile_move_line_vals(self, line, move_id=False):
|
||||||
|
return {
|
||||||
|
"move_id": move_id or self.move_id.id,
|
||||||
|
"account_id": line["account_id"][0],
|
||||||
|
"partner_id": line.get("partner_id") and line["partner_id"][0],
|
||||||
|
"credit": line["credit"],
|
||||||
|
"debit": line["debit"],
|
||||||
|
}
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, mvals):
|
||||||
|
result = super().create(mvals)
|
||||||
|
models = self.env["account.reconcile.model"].search(
|
||||||
|
[
|
||||||
|
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
|
||||||
|
("auto_reconcile", "=", True),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
for record in result:
|
||||||
|
res = models._apply_rules(record, record._retrieve_partner())
|
||||||
|
if not res:
|
||||||
|
continue
|
||||||
|
liquidity_lines, suspense_lines, other_lines = record._seek_for_lines()
|
||||||
|
data = [
|
||||||
|
record._get_reconcile_line(line, "liquidity")
|
||||||
|
for line in liquidity_lines
|
||||||
|
]
|
||||||
|
reconcile_auxiliary_id = record._compute_exchange_rate(data)
|
||||||
|
if res.get("status", "") == "write_off":
|
||||||
|
data = record._recompute_suspense_line(
|
||||||
|
*record._reconcile_data_by_model(
|
||||||
|
data, res["model"], reconcile_auxiliary_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif res.get("amls"):
|
||||||
|
amount = self.amount
|
||||||
|
for line in res.get("amls", []):
|
||||||
|
line_data = record._get_reconcile_line(
|
||||||
|
line, "other", is_counterpart=True, max_amount=amount
|
||||||
|
)
|
||||||
|
amount -= line_data.get("amount")
|
||||||
|
data.append(line_data)
|
||||||
|
data = record._recompute_suspense_line(data, reconcile_auxiliary_id)
|
||||||
|
if not data.get("can_reconcile"):
|
||||||
|
continue
|
||||||
|
getattr(
|
||||||
|
record, "_reconcile_bank_line_%s" % record.journal_id.reconcile_mode
|
||||||
|
)(data["data"])
|
||||||
|
return result
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright 2022 CreuBlanca
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import _, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class AccountJournal(models.Model):
|
||||||
|
_inherit = "account.journal"
|
||||||
|
|
||||||
|
reconcile_mode = fields.Selection(
|
||||||
|
[("edit", "Edit Move"), ("keep", "Keep Suspense Accounts")],
|
||||||
|
default="edit",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def action_open_reconcile_to_check(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
|
"account_reconcile_oca.action_bank_statement_line_reconcile"
|
||||||
|
)
|
||||||
|
action["domain"] = [("id", "=", self.to_check_ids().ids)]
|
||||||
|
return action
|
||||||
|
|
||||||
|
def get_rainbowman_message(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if self.get_journal_dashboard_datas()["number_to_reconcile"] > 0:
|
||||||
|
return False
|
||||||
|
return _("Well done! Everything has been reconciled")
|
|
@ -0,0 +1,64 @@
|
||||||
|
# Copyright 2022 CreuBlanca
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
|
class AccountReconcileAbstract(models.AbstractModel):
|
||||||
|
_name = "account.reconcile.abstract"
|
||||||
|
_description = "Account Reconcile Abstract"
|
||||||
|
|
||||||
|
reconcile_data_info = fields.Serialized(
|
||||||
|
compute="_compute_reconcile_data_info",
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
company_id = fields.Many2one("res.company")
|
||||||
|
add_account_move_line_id = fields.Many2one(
|
||||||
|
"account.move.line",
|
||||||
|
check_company=True,
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
manual_reference = fields.Char(store=False, default=False, prefetch=False)
|
||||||
|
manual_delete = fields.Boolean(
|
||||||
|
store=False,
|
||||||
|
default=False,
|
||||||
|
prefetch=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _get_reconcile_line(self, line, kind, is_counterpart=False, max_amount=False):
|
||||||
|
original_amount = amount = line.debit - line.credit
|
||||||
|
if is_counterpart:
|
||||||
|
original_amount = amount = (
|
||||||
|
line.amount_residual_currency or line.amount_residual
|
||||||
|
)
|
||||||
|
if max_amount:
|
||||||
|
if amount > max_amount > 0:
|
||||||
|
amount = max_amount
|
||||||
|
if amount < max_amount < 0:
|
||||||
|
amount = max_amount
|
||||||
|
if is_counterpart:
|
||||||
|
amount = -amount
|
||||||
|
original_amount = -original_amount
|
||||||
|
vals = {
|
||||||
|
"reference": "account.move.line;%s" % line.id,
|
||||||
|
"id": line.id,
|
||||||
|
"account_id": line.account_id.name_get()[0],
|
||||||
|
"partner_id": line.partner_id and line.partner_id.name_get()[0] or False,
|
||||||
|
"date": fields.Date.to_string(line.date),
|
||||||
|
"name": line.name,
|
||||||
|
"debit": amount if amount > 0 else 0.0,
|
||||||
|
"credit": -amount if amount < 0 else 0.0,
|
||||||
|
"amount": amount,
|
||||||
|
"currency_id": line.currency_id.id,
|
||||||
|
"kind": kind,
|
||||||
|
}
|
||||||
|
if not float_is_zero(
|
||||||
|
amount - original_amount, precision_digits=line.currency_id.decimal_places
|
||||||
|
):
|
||||||
|
vals["original_amount"] = abs(original_amount)
|
||||||
|
if is_counterpart:
|
||||||
|
vals["counterpart_line_id"] = line.id
|
||||||
|
return vals
|
|
@ -0,0 +1 @@
|
||||||
|
* Enric Tobella
|
|
@ -0,0 +1 @@
|
||||||
|
This addon allows to reconcile bank statements and account marked as `reconcile`.
|
|
@ -0,0 +1,3 @@
|
||||||
|
The following bugs are already detected:
|
||||||
|
|
||||||
|
* Creation of activities on the chatter do show automatically
|
|
@ -0,0 +1,12 @@
|
||||||
|
Bank reconcile
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Access `Invoicing / Dashboard` with a user with Full Acounting capabilities.
|
||||||
|
Select reconcile on the journal of your choice.
|
||||||
|
|
||||||
|
Account reconcile
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Access `Invoicing / Accounting / Actions / Reconcile`
|
||||||
|
All the possible reconcile options will show and you will be able to reconcile properly.
|
||||||
|
You can access the same widget from accounts and Partners.
|
|
@ -0,0 +1,3 @@
|
||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_account_account_reconcile,account.account.reconcile,model_account_account_reconcile,account.group_account_user,1,1,0,0
|
||||||
|
access_account_account_reconcile_data,account.account.reconcile,model_account_account_reconcile_data,account.group_account_user,1,1,1,1
|
|
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
|
@ -0,0 +1,446 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||||
|
<title>Account Reconcile Oca</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
/*
|
||||||
|
:Author: David Goodger (goodger@python.org)
|
||||||
|
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||||
|
:Copyright: This stylesheet has been placed in the public domain.
|
||||||
|
|
||||||
|
Default cascading style sheet for the HTML output of Docutils.
|
||||||
|
|
||||||
|
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||||
|
customize this style sheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* used to remove borders from tables and images */
|
||||||
|
.borderless, table.borderless td, table.borderless th {
|
||||||
|
border: 0 }
|
||||||
|
|
||||||
|
table.borderless td, table.borderless th {
|
||||||
|
/* Override padding for "table.docutils td" with "! important".
|
||||||
|
The right padding separates the table cells. */
|
||||||
|
padding: 0 0.5em 0 0 ! important }
|
||||||
|
|
||||||
|
.first {
|
||||||
|
/* Override more specific margin styles with "! important". */
|
||||||
|
margin-top: 0 ! important }
|
||||||
|
|
||||||
|
.last, .with-subtitle {
|
||||||
|
margin-bottom: 0 ! important }
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none }
|
||||||
|
|
||||||
|
.subscript {
|
||||||
|
vertical-align: sub;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
.superscript {
|
||||||
|
vertical-align: super;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
a.toc-backref {
|
||||||
|
text-decoration: none ;
|
||||||
|
color: black }
|
||||||
|
|
||||||
|
blockquote.epigraph {
|
||||||
|
margin: 2em 5em ; }
|
||||||
|
|
||||||
|
dl.docutils dd {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||||
|
dl.docutils dt {
|
||||||
|
font-weight: bold }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.abstract {
|
||||||
|
margin: 2em 5em }
|
||||||
|
|
||||||
|
div.abstract p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||||
|
div.hint, div.important, div.note, div.tip, div.warning {
|
||||||
|
margin: 2em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||||
|
div.important p.admonition-title, div.note p.admonition-title,
|
||||||
|
div.tip p.admonition-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||||
|
div.danger p.admonition-title, div.error p.admonition-title,
|
||||||
|
div.warning p.admonition-title, .code .error {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||||
|
compound paragraphs.
|
||||||
|
div.compound .compound-first, div.compound .compound-middle {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
div.compound .compound-last, div.compound .compound-middle {
|
||||||
|
margin-top: 0.5em }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.dedication {
|
||||||
|
margin: 2em 5em ;
|
||||||
|
text-align: center ;
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
div.dedication p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-style: normal }
|
||||||
|
|
||||||
|
div.figure {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
div.footer, div.header {
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
div.line-block {
|
||||||
|
display: block ;
|
||||||
|
margin-top: 1em ;
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
div.line-block div.line-block {
|
||||||
|
margin-top: 0 ;
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-left: 1.5em }
|
||||||
|
|
||||||
|
div.sidebar {
|
||||||
|
margin: 0 0 0.5em 1em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em ;
|
||||||
|
background-color: #ffffee ;
|
||||||
|
width: 40% ;
|
||||||
|
float: right ;
|
||||||
|
clear: right }
|
||||||
|
|
||||||
|
div.sidebar p.rubric {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-size: medium }
|
||||||
|
|
||||||
|
div.system-messages {
|
||||||
|
margin: 5em }
|
||||||
|
|
||||||
|
div.system-messages h1 {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
div.system-message {
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.system-message p.system-message-title {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
div.topic {
|
||||||
|
margin: 2em }
|
||||||
|
|
||||||
|
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||||
|
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||||
|
margin-top: 0.4em }
|
||||||
|
|
||||||
|
h1.title {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
h2.subtitle {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
hr.docutils {
|
||||||
|
width: 75% }
|
||||||
|
|
||||||
|
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||||
|
clear: left ;
|
||||||
|
float: left ;
|
||||||
|
margin-right: 1em }
|
||||||
|
|
||||||
|
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||||
|
clear: right ;
|
||||||
|
float: right ;
|
||||||
|
margin-left: 1em }
|
||||||
|
|
||||||
|
img.align-center, .figure.align-center, object.align-center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.align-center {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-left {
|
||||||
|
text-align: left }
|
||||||
|
|
||||||
|
.align-center {
|
||||||
|
clear: both ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
.align-right {
|
||||||
|
text-align: right }
|
||||||
|
|
||||||
|
/* reset inner alignment in figures */
|
||||||
|
div.align-right {
|
||||||
|
text-align: inherit }
|
||||||
|
|
||||||
|
/* div.align-center * { */
|
||||||
|
/* text-align: left } */
|
||||||
|
|
||||||
|
.align-top {
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
.align-middle {
|
||||||
|
vertical-align: middle }
|
||||||
|
|
||||||
|
.align-bottom {
|
||||||
|
vertical-align: bottom }
|
||||||
|
|
||||||
|
ol.simple, ul.simple {
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
ol.arabic {
|
||||||
|
list-style: decimal }
|
||||||
|
|
||||||
|
ol.loweralpha {
|
||||||
|
list-style: lower-alpha }
|
||||||
|
|
||||||
|
ol.upperalpha {
|
||||||
|
list-style: upper-alpha }
|
||||||
|
|
||||||
|
ol.lowerroman {
|
||||||
|
list-style: lower-roman }
|
||||||
|
|
||||||
|
ol.upperroman {
|
||||||
|
list-style: upper-roman }
|
||||||
|
|
||||||
|
p.attribution {
|
||||||
|
text-align: right ;
|
||||||
|
margin-left: 50% }
|
||||||
|
|
||||||
|
p.caption {
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
p.credits {
|
||||||
|
font-style: italic ;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
p.label {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
p.rubric {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger ;
|
||||||
|
color: maroon ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
p.sidebar-title {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger }
|
||||||
|
|
||||||
|
p.sidebar-subtitle {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
p.topic-title {
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
pre.address {
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-top: 0 ;
|
||||||
|
font: inherit }
|
||||||
|
|
||||||
|
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
pre.code .ln { color: grey; } /* line numbers */
|
||||||
|
pre.code, code { background-color: #eeeeee }
|
||||||
|
pre.code .comment, code .comment { color: #5C6576 }
|
||||||
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||||
|
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||||
|
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||||
|
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||||
|
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||||
|
|
||||||
|
span.classifier {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-style: oblique }
|
||||||
|
|
||||||
|
span.classifier-delimiter {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
span.interpreted {
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
span.option {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
span.pre {
|
||||||
|
white-space: pre }
|
||||||
|
|
||||||
|
span.problematic {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
span.section-subtitle {
|
||||||
|
/* font-size relative to parent (h1..h6 element) */
|
||||||
|
font-size: 80% }
|
||||||
|
|
||||||
|
table.citation {
|
||||||
|
border-left: solid 1px gray;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docinfo {
|
||||||
|
margin: 2em 4em }
|
||||||
|
|
||||||
|
table.docutils {
|
||||||
|
margin-top: 0.5em ;
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
table.footnote {
|
||||||
|
border-left: solid 1px black;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docutils td, table.docutils th,
|
||||||
|
table.docinfo td, table.docinfo th {
|
||||||
|
padding-left: 0.5em ;
|
||||||
|
padding-right: 0.5em ;
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: left ;
|
||||||
|
white-space: nowrap ;
|
||||||
|
padding-left: 0 }
|
||||||
|
|
||||||
|
/* "booktabs" style (no vertical lines) */
|
||||||
|
table.docutils.booktabs {
|
||||||
|
border: 0px;
|
||||||
|
border-top: 2px solid;
|
||||||
|
border-bottom: 2px solid;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs * {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs th {
|
||||||
|
border-bottom: thin solid;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||||
|
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||||
|
font-size: 100% }
|
||||||
|
|
||||||
|
ul.auto-toc {
|
||||||
|
list-style-type: none }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="document" id="account-reconcile-oca">
|
||||||
|
<h1 class="title">Account Reconcile Oca</h1>
|
||||||
|
|
||||||
|
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/98/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
|
<p>This addon allows to reconcile bank statements and account marked as <cite>reconcile</cite>.</p>
|
||||||
|
<p><strong>Table of contents</strong></p>
|
||||||
|
<div class="contents local topic" id="contents">
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference internal" href="#usage" id="id1">Usage</a><ul>
|
||||||
|
<li><a class="reference internal" href="#bank-reconcile" id="id2">Bank reconcile</a></li>
|
||||||
|
<li><a class="reference internal" href="#account-reconcile" id="id3">Account reconcile</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
|
||||||
|
<li><a class="reference internal" href="#bug-tracker" id="id5">Bug Tracker</a></li>
|
||||||
|
<li><a class="reference internal" href="#credits" id="id6">Credits</a><ul>
|
||||||
|
<li><a class="reference internal" href="#authors" id="id7">Authors</a></li>
|
||||||
|
<li><a class="reference internal" href="#contributors" id="id8">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="usage">
|
||||||
|
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
|
||||||
|
<div class="section" id="bank-reconcile">
|
||||||
|
<h2><a class="toc-backref" href="#id2">Bank reconcile</a></h2>
|
||||||
|
<p>Access <cite>Invoicing / Dashboard</cite> with a user with Full Acounting capabilities.
|
||||||
|
Select reconcile on the journal of your choice.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="account-reconcile">
|
||||||
|
<h2><a class="toc-backref" href="#id3">Account reconcile</a></h2>
|
||||||
|
<p>Access <cite>Invoicing / Accounting / Actions / Reconcile</cite>
|
||||||
|
All the possible reconcile options will show and you will be able to reconcile properly.
|
||||||
|
You can access the same widget from accounts and Partners.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="known-issues-roadmap">
|
||||||
|
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
|
||||||
|
<p>The following bugs are already detected:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Creation of activities on the chatter do show automatically</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="bug-tracker">
|
||||||
|
<h1><a class="toc-backref" href="#id5">Bug Tracker</a></h1>
|
||||||
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-reconcile/issues">GitHub Issues</a>.
|
||||||
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
|
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="credits">
|
||||||
|
<h1><a class="toc-backref" href="#id6">Credits</a></h1>
|
||||||
|
<div class="section" id="authors">
|
||||||
|
<h2><a class="toc-backref" href="#id7">Authors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>CreuBlanca</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="contributors">
|
||||||
|
<h2><a class="toc-backref" href="#id8">Contributors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Enric Tobella</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="maintainers">
|
||||||
|
<h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
|
||||||
|
<p>This module is maintained by the OCA.</p>
|
||||||
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.</p>
|
||||||
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca">OCA/account-reconcile</a> project on GitHub.</p>
|
||||||
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,15 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
import {ChatterContainer} from "@mail/components/chatter_container/chatter_container";
|
||||||
|
|
||||||
|
const {Component} = owl;
|
||||||
|
|
||||||
|
export class AccountReconcileChatterWidget extends Component {}
|
||||||
|
AccountReconcileChatterWidget.template =
|
||||||
|
"account_reconcile_oca.AccountReconcileChatterWidget";
|
||||||
|
AccountReconcileChatterWidget.components = {...Component.components, ChatterContainer};
|
||||||
|
|
||||||
|
registry
|
||||||
|
.category("fields")
|
||||||
|
.add("account_reconcile_oca_chatter", AccountReconcileChatterWidget);
|
|
@ -0,0 +1,99 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
const {useState, useSubEnv} = owl;
|
||||||
|
import {KanbanController} from "@web/views/kanban/kanban_controller";
|
||||||
|
import {View} from "@web/views/view";
|
||||||
|
import {useService} from "@web/core/utils/hooks";
|
||||||
|
|
||||||
|
export class ReconcileController extends KanbanController {
|
||||||
|
async setup() {
|
||||||
|
super.setup();
|
||||||
|
this.state = useState({
|
||||||
|
selectedRecordId: null,
|
||||||
|
});
|
||||||
|
useSubEnv({
|
||||||
|
parentController: this,
|
||||||
|
exposeController: this.exposeController.bind(this),
|
||||||
|
});
|
||||||
|
this.effect = useService("effect");
|
||||||
|
this.orm = useService("orm");
|
||||||
|
this.action = useService("action");
|
||||||
|
this.activeActions = this.props.archInfo.activeActions;
|
||||||
|
this.model.addEventListener("update", () => this.selectRecord(), {once: true});
|
||||||
|
}
|
||||||
|
exposeController(controller) {
|
||||||
|
this.form_controller = controller;
|
||||||
|
}
|
||||||
|
async onClickNewButton() {
|
||||||
|
const action = await this.orm.call(this.props.resModel, "action_new_line", [], {
|
||||||
|
context: this.props.context,
|
||||||
|
});
|
||||||
|
this.action.doAction(action, {
|
||||||
|
onClose: async () => {
|
||||||
|
await this.model.root.load();
|
||||||
|
this.render(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async setRainbowMan(message) {
|
||||||
|
this.effect.add({
|
||||||
|
message,
|
||||||
|
type: "rainbow_man",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
get viewReconcileInfo() {
|
||||||
|
return {
|
||||||
|
resId: this.state.selectedRecordId,
|
||||||
|
type: "form",
|
||||||
|
context: {
|
||||||
|
...(this.props.context || {}),
|
||||||
|
form_view_ref: this.props.context.view_ref,
|
||||||
|
},
|
||||||
|
display: {controlPanel: false},
|
||||||
|
mode: this.props.mode || "edit",
|
||||||
|
resModel: this.props.resModel,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async selectRecord(record) {
|
||||||
|
var resId = undefined;
|
||||||
|
if (record === undefined) {
|
||||||
|
var records = this.model.root.records.filter(
|
||||||
|
(modelRecord) =>
|
||||||
|
!modelRecord.data.is_reconciled || modelRecord.data.to_check
|
||||||
|
);
|
||||||
|
if (records.length === 0) {
|
||||||
|
records = this.model.root.records;
|
||||||
|
if (records.length === 0) {
|
||||||
|
this.state.selectedRecordId = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resId = records[0].resId;
|
||||||
|
} else {
|
||||||
|
resId = record.resId;
|
||||||
|
}
|
||||||
|
if (this.state.selectedRecordId && this.state.selectedRecordId !== resId) {
|
||||||
|
if (this.form_controller.model.root.isDirty) {
|
||||||
|
await this.form_controller.model.root.save({
|
||||||
|
noReload: true,
|
||||||
|
stayInEdition: true,
|
||||||
|
useSaveErrorDialog: true,
|
||||||
|
});
|
||||||
|
await this.model.root.load();
|
||||||
|
await this.render(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!this.state.selectedRecordId || this.state.selectedRecordId !== resId) {
|
||||||
|
this.state.selectedRecordId = resId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async openRecord(record) {
|
||||||
|
this.selectRecord(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReconcileController.components = {
|
||||||
|
...ReconcileController.components,
|
||||||
|
View,
|
||||||
|
};
|
||||||
|
|
||||||
|
ReconcileController.template = "account_reconcile_oca.ReconcileController";
|
||||||
|
ReconcileController.defaultProps = {};
|
|
@ -0,0 +1,65 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import fieldUtils from "web.field_utils";
|
||||||
|
import session from "web.session";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
|
||||||
|
const {Component} = owl;
|
||||||
|
|
||||||
|
export class AccountReconcileDataWidget extends Component {
|
||||||
|
getReconcileLines() {
|
||||||
|
var data = this.props.record.data[this.props.name].data;
|
||||||
|
for (var line in data) {
|
||||||
|
data[line].amount_format = fieldUtils.format.monetary(
|
||||||
|
data[line].amount,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
currency: session.get_currency(data[line].currency_id),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
data[line].debit_format = fieldUtils.format.monetary(
|
||||||
|
data[line].debit,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
currency: session.get_currency(data[line].currency_id),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
data[line].credit_format = fieldUtils.format.monetary(
|
||||||
|
data[line].credit,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
currency: session.get_currency(data[line].currency_id),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (data[line].original_amount) {
|
||||||
|
data[line].original_amount_format = fieldUtils.format.monetary(
|
||||||
|
data[line].original_amount,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
currency: session.get_currency(data[line].currency_id),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
data[line].date_format = fieldUtils.format.date(
|
||||||
|
fieldUtils.parse.date(data[line].date, undefined, {isUTC: true})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
onTrashLine(ev, line) {
|
||||||
|
this.props.record.update({
|
||||||
|
manual_reference: line.reference,
|
||||||
|
manual_delete: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
selectReconcileLine(ev, line) {
|
||||||
|
this.props.record.update({
|
||||||
|
manual_reference: line.reference,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AccountReconcileDataWidget.template = "account_reconcile_oca.ReconcileDataWidget";
|
||||||
|
|
||||||
|
registry
|
||||||
|
.category("fields")
|
||||||
|
.add("account_reconcile_oca_data", AccountReconcileDataWidget);
|
|
@ -0,0 +1,51 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {FormController} from "@web/views/form/form_controller";
|
||||||
|
import {formView} from "@web/views/form/form_view";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
import {useService} from "@web/core/utils/hooks";
|
||||||
|
import {useViewButtons} from "@web/views/view_button/view_button_hook";
|
||||||
|
const {useRef} = owl;
|
||||||
|
|
||||||
|
export class ReconcileFormController extends FormController {
|
||||||
|
setup() {
|
||||||
|
super.setup(...arguments);
|
||||||
|
this.env.exposeController(this);
|
||||||
|
this.orm = useService("orm");
|
||||||
|
const rootRef = useRef("root");
|
||||||
|
useViewButtons(this.model, rootRef, {
|
||||||
|
reload: this.reloadFormController.bind(this),
|
||||||
|
beforeExecuteAction: this.beforeExecuteActionButton.bind(this),
|
||||||
|
afterExecuteAction: this.afterExecuteActionButton.bind(this),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async reloadFormController() {
|
||||||
|
var is_reconciled = this.model.root.data.is_reconciled;
|
||||||
|
await this.model.root.load();
|
||||||
|
if (!is_reconciled && this.model.root.data.is_reconciled) {
|
||||||
|
// This only happens when we press the reconcile button
|
||||||
|
if (this.env.parentController) {
|
||||||
|
// Showing rainbow man
|
||||||
|
const message = await this.orm.call(
|
||||||
|
"account.journal",
|
||||||
|
"get_rainbowman_message",
|
||||||
|
[[this.model.root.data.journal_id[0]]]
|
||||||
|
);
|
||||||
|
if (message) {
|
||||||
|
this.env.parentController.setRainbowMan(message);
|
||||||
|
}
|
||||||
|
// Refreshing
|
||||||
|
await this.env.parentController.model.root.load();
|
||||||
|
await this.env.parentController.render(true);
|
||||||
|
this.env.parentController.selectRecord();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ReconcileFormView = {
|
||||||
|
...formView,
|
||||||
|
Controller: ReconcileFormController,
|
||||||
|
};
|
||||||
|
|
||||||
|
registry.category("views").add("reconcile_form", ReconcileFormView);
|
|
@ -0,0 +1,14 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {KanbanRecord} from "@web/views/kanban/kanban_record";
|
||||||
|
|
||||||
|
export class ReconcileKanbanRecord extends KanbanRecord {
|
||||||
|
getRecordClasses() {
|
||||||
|
var result = super.getRecordClasses();
|
||||||
|
if (this.props.selectedRecordId === this.props.record.resId) {
|
||||||
|
result += " o_kanban_record_reconcile_oca_selected";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReconcileKanbanRecord.props = [...KanbanRecord.props, "selectedRecordId?"];
|
|
@ -0,0 +1,38 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {FormController} from "@web/views/form/form_controller";
|
||||||
|
import {formView} from "@web/views/form/form_view";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
import {useViewButtons} from "@web/views/view_button/view_button_hook";
|
||||||
|
const {useRef} = owl;
|
||||||
|
|
||||||
|
export class FormManualReconcileController extends FormController {
|
||||||
|
setup() {
|
||||||
|
super.setup(...arguments);
|
||||||
|
const rootRef = useRef("root");
|
||||||
|
useViewButtons(this.model, rootRef, {
|
||||||
|
reload: this.reloadFormController.bind(this),
|
||||||
|
beforeExecuteAction: this.beforeExecuteActionButton.bind(this),
|
||||||
|
afterExecuteAction: this.afterExecuteActionButton.bind(this),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async reloadFormController() {
|
||||||
|
try {
|
||||||
|
await this.model.root.load();
|
||||||
|
} catch (error) {
|
||||||
|
// This should happen when we reconcile a line (no more possible data...)
|
||||||
|
if (this.env.parentController) {
|
||||||
|
await this.env.parentController.model.root.load();
|
||||||
|
await this.env.parentController.render(true);
|
||||||
|
this.env.parentController.selectRecord();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FormManualReconcileView = {
|
||||||
|
...formView,
|
||||||
|
Controller: FormManualReconcileController,
|
||||||
|
};
|
||||||
|
|
||||||
|
registry.category("views").add("reconcile_manual", FormManualReconcileView);
|
|
@ -0,0 +1,46 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {ListController} from "@web/views/list/list_controller";
|
||||||
|
import {ListRenderer} from "@web/views/list/list_renderer";
|
||||||
|
import {listView} from "@web/views/list/list_view";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
|
||||||
|
export class ReconcileMoveLineRenderer extends ListRenderer {
|
||||||
|
getRowClass(record) {
|
||||||
|
var classes = super.getRowClass(record);
|
||||||
|
if (
|
||||||
|
this.props.parentRecord.data.reconcile_data_info.counterparts.includes(
|
||||||
|
record.resId
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
classes += " o_field_account_reconcile_oca_move_line_selected";
|
||||||
|
}
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReconcileMoveLineRenderer.props = [
|
||||||
|
...ListRenderer.props,
|
||||||
|
"parentRecord",
|
||||||
|
"parentField",
|
||||||
|
];
|
||||||
|
export class ReconcileMoveLineController extends ListController {
|
||||||
|
async openRecord(record) {
|
||||||
|
var data = {};
|
||||||
|
data[this.props.parentField] = [record.resId, record.display_name];
|
||||||
|
this.props.parentRecord.update(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReconcileMoveLineController.template = `account_reconcile_oca.ReconcileMoveLineController`;
|
||||||
|
ReconcileMoveLineController.props = {
|
||||||
|
...ListController.props,
|
||||||
|
parentRecord: {type: Object, optional: true},
|
||||||
|
parentField: {type: String, optional: true},
|
||||||
|
};
|
||||||
|
export const ReconcileMoveLineView = {
|
||||||
|
...listView,
|
||||||
|
Controller: ReconcileMoveLineController,
|
||||||
|
Renderer: ReconcileMoveLineRenderer,
|
||||||
|
};
|
||||||
|
|
||||||
|
registry.category("views").add("reconcile_move_line", ReconcileMoveLineView);
|
|
@ -0,0 +1,51 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {View} from "@web/views/view";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
|
||||||
|
const {Component, useSubEnv} = owl;
|
||||||
|
|
||||||
|
export class AccountReconcileMatchWidget extends Component {
|
||||||
|
setup() {
|
||||||
|
// Necessary in order to avoid a loop
|
||||||
|
super.setup(...arguments);
|
||||||
|
useSubEnv({
|
||||||
|
config: {},
|
||||||
|
parentController: this.env.parentController,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
get listViewProperties() {
|
||||||
|
return {
|
||||||
|
type: "list",
|
||||||
|
display: {
|
||||||
|
controlPanel: {
|
||||||
|
// Hiding the control panel buttons
|
||||||
|
"top-left": false,
|
||||||
|
"bottom-left": false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
resModel: this.props.record.fields[this.props.name].relation,
|
||||||
|
searchMenuTypes: ["filter"],
|
||||||
|
domain: this.props.record.getFieldDomain(this.props.name).toList(),
|
||||||
|
context: {
|
||||||
|
...this.props.record.getFieldContext(this.props.name),
|
||||||
|
},
|
||||||
|
// Disables de selector
|
||||||
|
allowSelectors: false,
|
||||||
|
// We need to force the search view in order to show the right one
|
||||||
|
searchViewId: false,
|
||||||
|
parentRecord: this.props.record,
|
||||||
|
parentField: this.props.name,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AccountReconcileMatchWidget.template = "account_reconcile_oca.ReconcileMatchWidget";
|
||||||
|
|
||||||
|
AccountReconcileMatchWidget.components = {
|
||||||
|
...AccountReconcileMatchWidget.components,
|
||||||
|
View,
|
||||||
|
};
|
||||||
|
|
||||||
|
registry
|
||||||
|
.category("fields")
|
||||||
|
.add("account_reconcile_oca_match", AccountReconcileMatchWidget);
|
|
@ -0,0 +1,12 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {KanbanRenderer} from "@web/views/kanban/kanban_renderer";
|
||||||
|
import {ReconcileKanbanRecord} from "./reconcile_kanban_record.esm.js";
|
||||||
|
export class ReconcileRenderer extends KanbanRenderer {}
|
||||||
|
|
||||||
|
ReconcileRenderer.components = {
|
||||||
|
...KanbanRenderer.components,
|
||||||
|
KanbanRecord: ReconcileKanbanRecord,
|
||||||
|
};
|
||||||
|
ReconcileRenderer.template = "account_reconcile_oca.ReconcileRenderer";
|
||||||
|
ReconcileRenderer.props = [...KanbanRenderer.props, "selectedRecordId?"];
|
|
@ -0,0 +1,16 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import {ReconcileController} from "./reconcile_controller.esm.js";
|
||||||
|
import {ReconcileRenderer} from "./reconcile_renderer.esm.js";
|
||||||
|
import {kanbanView} from "@web/views/kanban/kanban_view";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
|
||||||
|
export const reconcileView = {
|
||||||
|
...kanbanView,
|
||||||
|
Renderer: ReconcileRenderer,
|
||||||
|
Controller: ReconcileController,
|
||||||
|
buttonTemplate: "account_reconcile.ReconcileView.Buttons",
|
||||||
|
searchMenuTypes: ["filter"],
|
||||||
|
};
|
||||||
|
|
||||||
|
registry.category("views").add("reconcile", reconcileView);
|
|
@ -0,0 +1,29 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
import {
|
||||||
|
BadgeSelectionField,
|
||||||
|
preloadSelection,
|
||||||
|
} from "@web/views/fields/badge_selection/badge_selection_field";
|
||||||
|
import {registry} from "@web/core/registry";
|
||||||
|
|
||||||
|
export class FieldSelectionBadgeUncheck extends BadgeSelectionField {
|
||||||
|
async onChange(value) {
|
||||||
|
var old_value = this.props.value;
|
||||||
|
if (this.props.type === "many2one") {
|
||||||
|
old_value = old_value[0];
|
||||||
|
}
|
||||||
|
if (value === old_value) {
|
||||||
|
this.props.update(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.onChange(...arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FieldSelectionBadgeUncheck.supportedTypes = ["many2one", "selection"];
|
||||||
|
FieldSelectionBadgeUncheck.additionalClasses = ["o_field_selection_badge"];
|
||||||
|
registry.category("fields").add("selection_badge_uncheck", FieldSelectionBadgeUncheck);
|
||||||
|
|
||||||
|
registry.category("preloadedData").add("selection_badge_uncheck", {
|
||||||
|
loadOnTypes: ["many2one"],
|
||||||
|
preload: preloadSelection,
|
||||||
|
});
|
|
@ -0,0 +1,72 @@
|
||||||
|
.o_account_reconcile_oca {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-flow: row wrap;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
height: 100%;
|
||||||
|
.o_kanban_renderer.o_kanban_ungrouped .o_kanban_record {
|
||||||
|
margin: 0 0 0;
|
||||||
|
> div {
|
||||||
|
border-right: thick solid rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
&.o_kanban_record_reconcile_oca_selected > div {
|
||||||
|
border-right: thick solid $o-brand-primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.o_account_reconcile_oca_selector {
|
||||||
|
width: 30%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
border-right: 1px solid $o-gray-300;
|
||||||
|
}
|
||||||
|
.o_account_reconcile_oca_info {
|
||||||
|
width: 70%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.o_form_view {
|
||||||
|
.btn-info:not(.dropdown-toggle):not(.dropdown-item) {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.o_form_statusbar.o_account_reconcile_oca_statusbar {
|
||||||
|
.btn:not(.dropdown-toggle):not(.dropdown-item) {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
height: 40px;
|
||||||
|
> .o_statusbar_buttons {
|
||||||
|
height: 100%;
|
||||||
|
> .btn {
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.o_field_account_reconcile_oca_data {
|
||||||
|
.o_field_account_reconcile_oca_balance_float {
|
||||||
|
.o_field_account_reconcile_oca_balance_original_float {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.o_field_widget.o_field_account_reconcile_oca_match {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.o_field_account_reconcile_oca_move_line_selected {
|
||||||
|
background-color: rgba($o-brand-primary, 0.2);
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.o_reconcile_widget_table {
|
||||||
|
.o_reconcile_widget_line {
|
||||||
|
&.liquidity {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.o_field_account_reconcile_oca_chatter {
|
||||||
|
width: 100%;
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates>
|
||||||
|
<t
|
||||||
|
t-name="account_reconcile_oca.ReconcileRenderer"
|
||||||
|
t-inherit="web.KanbanRenderer"
|
||||||
|
t-inherit-mode="primary"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<xpath expr="div[hasclass('o_kanban_renderer')]" position="attributes">
|
||||||
|
<attribute
|
||||||
|
name="class"
|
||||||
|
add="o_account_reconcile_oca_selector"
|
||||||
|
separator=" "
|
||||||
|
/>
|
||||||
|
</xpath>
|
||||||
|
<!-- Group by selector disabled on the view, so we need to find the one without group,
|
||||||
|
then we pass to the component the selected record -->
|
||||||
|
<xpath expr="//KanbanRecord[not(@group)]" position="attributes">
|
||||||
|
<attribute name="selectedRecordId">props.selectedRecordId</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
<t
|
||||||
|
t-name="account_reconcile_oca.ReconcileController"
|
||||||
|
t-inherit="web.KanbanView"
|
||||||
|
t-inherit-mode="primary"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<!-- we pass to the component the selected record -->
|
||||||
|
<xpath expr="//Layout/t[2]" position="attributes">
|
||||||
|
<attribute name="selectedRecordId">state.selectedRecordId</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//Layout" position="attributes">
|
||||||
|
<attribute
|
||||||
|
name="className"
|
||||||
|
>model.useSampleModel ? 'o_view_sample_data o_account_reconcile_oca' : 'o_account_reconcile_oca'</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//Layout" position="inside">
|
||||||
|
<div class="o_account_reconcile_oca_info">
|
||||||
|
<t t-if="state.selectedRecordId">
|
||||||
|
<View t-props="viewReconcileInfo" t-key="state.selectedRecordId" />
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
<t t-name="account_reconcile.ReconcileView.Buttons" owl="1">
|
||||||
|
<button
|
||||||
|
t-on-click="onClickNewButton"
|
||||||
|
class="btn btn-primary"
|
||||||
|
t-if="activeActions.create"
|
||||||
|
>Create</button>
|
||||||
|
</t>
|
||||||
|
<t t-name="account_reconcile_oca.ReconcileMatchWidget" owl="1">
|
||||||
|
<View t-props="listViewProperties" />
|
||||||
|
</t>
|
||||||
|
<t t-name="account_reconcile_oca.ReconcileDataWidget" owl="1">
|
||||||
|
<table
|
||||||
|
class="table table-sm position-relative mb-0 table-striped o_reconcile_widget_table"
|
||||||
|
style="table-layout: auto"
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<th>Account</th>
|
||||||
|
<th>Partner</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Label</th>
|
||||||
|
<th class="text-end">Debit</th>
|
||||||
|
<th class="text-end">Credit</th>
|
||||||
|
<th />
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<t
|
||||||
|
t-foreach="getReconcileLines()"
|
||||||
|
t-as="reconcile_line"
|
||||||
|
t-key="reconcile_line_index"
|
||||||
|
>
|
||||||
|
<tr
|
||||||
|
t-on-click="(ev) => this.selectReconcileLine(ev, reconcile_line)"
|
||||||
|
t-att-class="'o_reconcile_widget_line ' + reconcile_line.kind"
|
||||||
|
>
|
||||||
|
<td t-esc="reconcile_line.account_id[1]" />
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
t-esc="reconcile_line.partner_id[1]"
|
||||||
|
t-if="reconcile_line.partner_id"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td t-esc="reconcile_line.date_format" />
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
t-esc="reconcile_line.name"
|
||||||
|
t-if="reconcile_line.name"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="text-end o_field_account_reconcile_oca_balance_float"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
t-esc="reconcile_line.debit_format"
|
||||||
|
t-if="reconcile_line.amount > 0"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="o_field_account_reconcile_oca_balance_original_float"
|
||||||
|
t-esc="reconcile_line.original_amount_format"
|
||||||
|
t-if="reconcile_line.amount > 0 and reconcile_line.original_amount"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
class="text-end o_field_account_reconcile_oca_balance_float"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
t-esc="reconcile_line.credit_format"
|
||||||
|
t-if="reconcile_line.amount < 0"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="o_field_account_reconcile_oca_balance_original_float"
|
||||||
|
t-esc="reconcile_line.original_amount_format"
|
||||||
|
t-if="reconcile_line.amount < 0 and reconcile_line.original_amount"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button
|
||||||
|
class="btn fa fa-trash-o"
|
||||||
|
role="button"
|
||||||
|
t-on-click="(ev) => this.onTrashLine(ev, reconcile_line)"
|
||||||
|
t-if="reconcile_line.kind == 'other'"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</t>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</t>
|
||||||
|
<t t-name="account_reconcile_oca.AccountReconcileChatterWidget" owl="1">
|
||||||
|
<ChatterContainer
|
||||||
|
threadModel="this.props.record.fields[this.props.name].relation"
|
||||||
|
threadId="this.props.value[0]"
|
||||||
|
/>
|
||||||
|
</t>
|
||||||
|
<t
|
||||||
|
t-name="account_reconcile_oca.ReconcileMoveLineController"
|
||||||
|
t-inherit="web.ListView"
|
||||||
|
t-inherit-mode="primary"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<xpath expr="//t[@list='model.root']" position="attributes">
|
||||||
|
<attribute name="parentRecord">props.parentRecord</attribute>
|
||||||
|
<attribute name="parentField">props.parentField</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
|
@ -0,0 +1,2 @@
|
||||||
|
from . import test_bank_account_reconcile
|
||||||
|
from . import test_account_reconcile
|
|
@ -0,0 +1,304 @@
|
||||||
|
from odoo.tests import Form, tagged
|
||||||
|
|
||||||
|
from odoo.addons.account.tests.common import TestAccountReconciliationCommon
|
||||||
|
|
||||||
|
|
||||||
|
@tagged("post_install", "-at_install")
|
||||||
|
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
|
|
||||||
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
|
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
||||||
|
cls.bank_journal_usd.suspense_account_id = (
|
||||||
|
cls.company.account_journal_suspense_account_id
|
||||||
|
)
|
||||||
|
cls.bank_journal_euro.suspense_account_id = (
|
||||||
|
cls.company.account_journal_suspense_account_id
|
||||||
|
)
|
||||||
|
cls.current_assets_account = (
|
||||||
|
cls.env["account.account"]
|
||||||
|
.search(
|
||||||
|
[
|
||||||
|
("account_type", "=", "asset_current"),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.copy()
|
||||||
|
)
|
||||||
|
cls.current_assets_account.reconcile = True
|
||||||
|
cls.asset_receivable_account = (
|
||||||
|
cls.env["account.account"]
|
||||||
|
.search(
|
||||||
|
[
|
||||||
|
("account_type", "=", "asset_receivable"),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.copy()
|
||||||
|
)
|
||||||
|
cls.asset_receivable_account.reconcile = True
|
||||||
|
cls.equity_account = (
|
||||||
|
cls.env["account.account"]
|
||||||
|
.search(
|
||||||
|
[
|
||||||
|
("account_type", "=", "equity"),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.copy()
|
||||||
|
)
|
||||||
|
cls.non_current_assets_account = (
|
||||||
|
cls.env["account.account"]
|
||||||
|
.search(
|
||||||
|
[
|
||||||
|
("account_type", "=", "asset_non_current"),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.copy()
|
||||||
|
)
|
||||||
|
cls.non_current_assets_account.reconcile = True
|
||||||
|
cls.move_1 = cls.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.non_current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cls.move_1.action_post()
|
||||||
|
cls.move_2 = cls.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.non_current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 50,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.equity_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 50,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cls.move_2.action_post()
|
||||||
|
cls.move_3 = cls.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.non_current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 50,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": cls.equity_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 50,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cls.move_3.action_post()
|
||||||
|
|
||||||
|
def test_reconcile(self):
|
||||||
|
account = self.non_current_assets_account
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[("account_id", "=", account.id)]
|
||||||
|
)
|
||||||
|
self.assertTrue(reconcile_account)
|
||||||
|
with Form(reconcile_account) as f:
|
||||||
|
f.add_account_move_line_id = self.move_1.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
f.add_account_move_line_id = self.move_2.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
reconcile_account.reconcile()
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[("account_id", "=", account.id)]
|
||||||
|
)
|
||||||
|
self.assertTrue(reconcile_account)
|
||||||
|
with Form(reconcile_account) as f:
|
||||||
|
f.add_account_move_line_id = self.move_1.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
f.add_account_move_line_id = self.move_3.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
reconcile_account.reconcile()
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[("account_id", "=", account.id)]
|
||||||
|
)
|
||||||
|
self.assertFalse(reconcile_account)
|
||||||
|
|
||||||
|
def test_clean_reconcile(self):
|
||||||
|
account = self.non_current_assets_account
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[("account_id", "=", account.id)]
|
||||||
|
)
|
||||||
|
self.assertTrue(reconcile_account)
|
||||||
|
with Form(reconcile_account) as f:
|
||||||
|
f.add_account_move_line_id = self.move_1.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
f.add_account_move_line_id = self.move_2.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == account
|
||||||
|
)
|
||||||
|
self.assertTrue(reconcile_account.reconcile_data_info.get("counterparts"))
|
||||||
|
reconcile_account.clean_reconcile()
|
||||||
|
self.assertFalse(reconcile_account.reconcile_data_info.get("counterparts"))
|
||||||
|
|
||||||
|
def test_cannot_reconcile(self):
|
||||||
|
"""
|
||||||
|
There is not enough records to reconcile for this account
|
||||||
|
"""
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[("account_id", "=", self.current_assets_account.id)]
|
||||||
|
)
|
||||||
|
self.assertFalse(reconcile_account)
|
||||||
|
|
||||||
|
def test_cannot_reconcile_different_partners(self):
|
||||||
|
"""
|
||||||
|
We can only reconcile lines with the same account and partner.
|
||||||
|
"""
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[
|
||||||
|
("account_id", "=", self.asset_receivable_account.id),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertFalse(reconcile_account)
|
||||||
|
move_1 = self.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.asset_receivable_account.id,
|
||||||
|
"partner_id": self.env.user.partner_id.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
move_1.action_post()
|
||||||
|
self.env.flush_all()
|
||||||
|
move_2 = self.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.asset_receivable_account.id,
|
||||||
|
"partner_id": self.company.partner_id.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
move_2.action_post()
|
||||||
|
self.env.flush_all()
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[
|
||||||
|
("account_id", "=", self.asset_receivable_account.id),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertFalse(reconcile_account)
|
||||||
|
|
||||||
|
move_3 = self.env["account.move"].create(
|
||||||
|
{
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.current_assets_account.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"debit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"account_id": self.asset_receivable_account.id,
|
||||||
|
"partner_id": self.env.user.partner_id.id,
|
||||||
|
"name": "DEMO",
|
||||||
|
"credit": 100,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
move_3.action_post()
|
||||||
|
self.env.flush_all()
|
||||||
|
reconcile_account = self.env["account.account.reconcile"].search(
|
||||||
|
[
|
||||||
|
("account_id", "=", self.asset_receivable_account.id),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertTrue(reconcile_account)
|
||||||
|
self.assertEqual(reconcile_account.partner_id, self.env.user.partner_id)
|
|
@ -0,0 +1,706 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.tests import Form, tagged
|
||||||
|
|
||||||
|
from odoo.addons.account.tests.common import TestAccountReconciliationCommon
|
||||||
|
|
||||||
|
|
||||||
|
@tagged("post_install", "-at_install")
|
||||||
|
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
|
|
||||||
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
|
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
||||||
|
cls.bank_journal_usd.suspense_account_id = (
|
||||||
|
cls.company.account_journal_suspense_account_id
|
||||||
|
)
|
||||||
|
cls.bank_journal_euro.suspense_account_id = (
|
||||||
|
cls.company.account_journal_suspense_account_id
|
||||||
|
)
|
||||||
|
cls.current_assets_account = cls.env["account.account"].search(
|
||||||
|
[
|
||||||
|
("account_type", "=", "asset_current"),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
cls.current_assets_account.reconcile = True
|
||||||
|
|
||||||
|
cls.rule = cls.env["account.reconcile.model"].create(
|
||||||
|
{
|
||||||
|
"name": "write-off model",
|
||||||
|
"rule_type": "writeoff_button",
|
||||||
|
"match_partner": True,
|
||||||
|
"match_partner_ids": [],
|
||||||
|
"line_ids": [(0, 0, {"account_id": cls.current_assets_account.id})],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
# We need to make some fields visible in order to make the tests work
|
||||||
|
cls.env["ir.ui.view"].create(
|
||||||
|
{
|
||||||
|
"name": "DEMO Account bank statement",
|
||||||
|
"model": "account.bank.statement.line",
|
||||||
|
"inherit_id": cls.env.ref(
|
||||||
|
"account_reconcile_oca.bank_statement_line_form_reconcile_view"
|
||||||
|
).id,
|
||||||
|
"arch": """
|
||||||
|
<data>
|
||||||
|
<field name="manual_reference" position="attributes">
|
||||||
|
<attribute name="invisible">0</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="manual_delete" position="attributes">
|
||||||
|
<attribute name="invisible">0</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="partner_id" position="attributes">
|
||||||
|
<attribute name="invisible">0</attribute>
|
||||||
|
</field>
|
||||||
|
</data>
|
||||||
|
""",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Testing reconcile action
|
||||||
|
|
||||||
|
def test_reconcile_invoice_unreconcile(self):
|
||||||
|
"""
|
||||||
|
We want to test the reconcile widget for bank statements on invoices.
|
||||||
|
As we use edit mode by default, we will also check what happens when
|
||||||
|
we press unreconcile
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
self.assertFalse(bank_stmt_line.is_reconciled)
|
||||||
|
self.assertTrue(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == self.bank_journal_euro.suspense_account_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
bank_stmt_line.reconcile_bank_line()
|
||||||
|
self.assertTrue(bank_stmt_line.is_reconciled)
|
||||||
|
self.assertFalse(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == self.bank_journal_euro.suspense_account_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
bank_stmt_line.unreconcile_bank_line()
|
||||||
|
self.assertFalse(bank_stmt_line.is_reconciled)
|
||||||
|
self.assertTrue(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == self.bank_journal_euro.suspense_account_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_reconcile_invoice_partial(self):
|
||||||
|
"""
|
||||||
|
We want to partially reconcile two invoices from a single payment.
|
||||||
|
As a result, both invoices must be partially reconciled
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
inv2 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
receivable2 = inv2.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable1
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
f.manual_reference = "account.move.line;%s" % receivable1.id
|
||||||
|
self.assertEqual(f.manual_amount, -100)
|
||||||
|
f.manual_amount = -70
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable2
|
||||||
|
f.manual_reference = "account.move.line;%s" % receivable2.id
|
||||||
|
self.assertEqual(f.manual_amount, -30)
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
self.assertEqual(inv1.amount_residual, 100)
|
||||||
|
self.assertEqual(inv2.amount_residual, 100)
|
||||||
|
bank_stmt_line.reconcile_bank_line()
|
||||||
|
self.assertEqual(inv1.amount_residual, 30)
|
||||||
|
self.assertEqual(inv2.amount_residual, 70)
|
||||||
|
|
||||||
|
def test_reconcile_model(self):
|
||||||
|
"""
|
||||||
|
We want to test what happens when we select an reconcile model to fill a
|
||||||
|
bank statement.
|
||||||
|
"""
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.manual_model_id = self.rule
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
bank_stmt_line.reconcile_bank_line()
|
||||||
|
self.assertTrue(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == self.current_assets_account
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_reconcile_invoice_model(self):
|
||||||
|
"""
|
||||||
|
We want to test what happens when we select a reconcile model to fill a
|
||||||
|
bank statement prefilled with an invoice.
|
||||||
|
|
||||||
|
The result should be the reconcile of the invoice, and the rest set to the model
|
||||||
|
"""
|
||||||
|
|
||||||
|
inv1 = self.create_invoice(currency_id=self.currency_euro_id)
|
||||||
|
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable1
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.manual_model_id = self.rule
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
bank_stmt_line.reconcile_bank_line()
|
||||||
|
self.assertNotEqual(self.current_assets_account, receivable1.account_id)
|
||||||
|
self.assertTrue(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == self.current_assets_account
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.assertTrue(
|
||||||
|
bank_stmt_line.move_id.line_ids.filtered(
|
||||||
|
lambda r: r.account_id == receivable1.account_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.assertEqual(0, inv1.amount_residual)
|
||||||
|
|
||||||
|
def test_reconcile_rule_on_create(self):
|
||||||
|
"""
|
||||||
|
Testing the fill of the bank statment line with
|
||||||
|
writeoff suggestion reconcile model with auto_reconcile
|
||||||
|
"""
|
||||||
|
self.env["account.reconcile.model"].create(
|
||||||
|
{
|
||||||
|
"name": "write-off model suggestion",
|
||||||
|
"rule_type": "writeoff_suggestion",
|
||||||
|
"match_label": "contains",
|
||||||
|
"match_label_param": "DEMO WRITEOFF",
|
||||||
|
"auto_reconcile": True,
|
||||||
|
"line_ids": [(0, 0, {"account_id": self.current_assets_account.id})],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "DEMO WRITEOFF",
|
||||||
|
"payment_ref": "DEMO WRITEOFF",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.assertTrue(bank_stmt_line.is_reconciled)
|
||||||
|
|
||||||
|
def test_reconcile_invoice_keep(self):
|
||||||
|
"""
|
||||||
|
We want to test how the keep mode works, keeping the original move lines.
|
||||||
|
However, the unreconcile will not work properly
|
||||||
|
"""
|
||||||
|
self.bank_journal_euro.reconcile_mode = "keep"
|
||||||
|
self.bank_journal_euro.suspense_account_id.reconcile = True
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable1
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(bank_stmt_line.can_reconcile)
|
||||||
|
bank_stmt_line.reconcile_bank_line()
|
||||||
|
self.assertIn(
|
||||||
|
self.bank_journal_euro.suspense_account_id,
|
||||||
|
bank_stmt_line.mapped("move_id.line_ids.account_id"),
|
||||||
|
)
|
||||||
|
with self.assertRaises(UserError):
|
||||||
|
bank_stmt_line.unreconcile_bank_line()
|
||||||
|
|
||||||
|
# Testing widget
|
||||||
|
|
||||||
|
def test_widget_invoice_clean(self):
|
||||||
|
"""
|
||||||
|
We want to test how the clean works on an already defined bank statement
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable1
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(bank_stmt_line.can_reconcile)
|
||||||
|
bank_stmt_line.clean_reconcile()
|
||||||
|
self.assertFalse(bank_stmt_line.can_reconcile)
|
||||||
|
|
||||||
|
def test_widget_invoice_delete(self):
|
||||||
|
"""
|
||||||
|
We need to test the possibility to remove a line from the reconcile widget
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = receivable1
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
f.manual_reference = "account.move.line;%s" % receivable1.id
|
||||||
|
self.assertEqual(f.manual_amount, -100)
|
||||||
|
f.manual_delete = True
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
|
||||||
|
def test_widget_invoice_unselect(self):
|
||||||
|
"""
|
||||||
|
We want to test how selection and unselection of an account move lines is managed
|
||||||
|
by the system.
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
f.add_account_move_line_id = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
self.assertFalse(f.add_account_move_line_id)
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
|
||||||
|
def test_widget_invoice_change_partner(self):
|
||||||
|
"""
|
||||||
|
We want to know how the change of partner of
|
||||||
|
a bank statement line is managed
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(
|
||||||
|
currency_id=self.currency_euro_id, invoice_amount=100
|
||||||
|
)
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
liquidity_lines, suspense_lines, other_lines = bank_stmt_line._seek_for_lines()
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
self.assertFalse(f.partner_id)
|
||||||
|
f.manual_reference = "account.move.line;%s" % liquidity_lines.id
|
||||||
|
f.manual_partner_id = inv1.partner_id
|
||||||
|
self.assertEqual(f.partner_id, inv1.partner_id)
|
||||||
|
bank_stmt_line.clean_reconcile()
|
||||||
|
# As we have a set a partner, the cleaning should assign the invoice automatically
|
||||||
|
self.assertTrue(bank_stmt_line.can_reconcile)
|
||||||
|
|
||||||
|
def test_widget_model_clean(self):
|
||||||
|
"""
|
||||||
|
We want to test what happens when we select an reconcile model to fill a
|
||||||
|
bank statement.
|
||||||
|
"""
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
with Form(
|
||||||
|
bank_stmt_line,
|
||||||
|
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
|
||||||
|
) as f:
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.manual_model_id = self.rule
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
# We need to check what happens when we uncheck it too
|
||||||
|
f.manual_model_id = self.env["account.reconcile.model"]
|
||||||
|
self.assertFalse(f.can_reconcile)
|
||||||
|
f.manual_model_id = self.rule
|
||||||
|
self.assertTrue(f.can_reconcile)
|
||||||
|
|
||||||
|
# Testing actions
|
||||||
|
|
||||||
|
def test_bank_statement_action_to_check(self):
|
||||||
|
action = self.bank_journal_euro.action_open_reconcile_to_check()
|
||||||
|
self.assertFalse(self.env[action["res_model"]].search(action["domain"]))
|
||||||
|
|
||||||
|
def test_bank_statement_rainbowman(self):
|
||||||
|
message = self.bank_journal_euro.get_rainbowman_message()
|
||||||
|
self.assertTrue(message)
|
||||||
|
self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.env.flush_all()
|
||||||
|
message = self.bank_journal_euro.get_rainbowman_message()
|
||||||
|
self.assertFalse(message)
|
||||||
|
|
||||||
|
def test_bank_statement_line_actions(self):
|
||||||
|
"""
|
||||||
|
Testing the actions of bank statement
|
||||||
|
"""
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
move_action = bank_stmt_line.action_show_move()
|
||||||
|
self.assertEqual(
|
||||||
|
bank_stmt_line.move_id,
|
||||||
|
self.env[move_action["res_model"]].browse(move_action["res_id"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Testing filters
|
||||||
|
|
||||||
|
def test_filter_partner(self):
|
||||||
|
"""
|
||||||
|
When a partner is set, the system might try to define an existent
|
||||||
|
invoice automatically
|
||||||
|
"""
|
||||||
|
inv1 = self.create_invoice(currency_id=self.currency_euro_id)
|
||||||
|
inv2 = self.create_invoice(currency_id=self.currency_euro_id)
|
||||||
|
partner = inv1.partner_id
|
||||||
|
|
||||||
|
receivable1 = inv1.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
self.assertTrue(receivable1)
|
||||||
|
receivable2 = inv2.line_ids.filtered(
|
||||||
|
lambda l: l.account_id.account_type == "asset_receivable"
|
||||||
|
)
|
||||||
|
self.assertTrue(receivable2)
|
||||||
|
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Without a partner set, No default data
|
||||||
|
|
||||||
|
bkstmt_data = bank_stmt_line.reconcile_data_info
|
||||||
|
mv_lines_ids = bkstmt_data["counterparts"]
|
||||||
|
self.assertNotIn(receivable1.id, mv_lines_ids)
|
||||||
|
self.assertNotIn(receivable2.id, mv_lines_ids)
|
||||||
|
|
||||||
|
# This is like input a partner in the widget
|
||||||
|
|
||||||
|
bank_stmt_line.partner_id = partner
|
||||||
|
bank_stmt_line.flush_recordset()
|
||||||
|
bank_stmt_line.invalidate_recordset()
|
||||||
|
bkstmt_data = bank_stmt_line.reconcile_data_info
|
||||||
|
mv_lines_ids = bkstmt_data["counterparts"]
|
||||||
|
|
||||||
|
self.assertIn(receivable1.id, mv_lines_ids)
|
||||||
|
self.assertIn(receivable2.id, mv_lines_ids)
|
||||||
|
|
||||||
|
# With a partner set, type the invoice reference in the filter
|
||||||
|
bank_stmt_line.payment_ref = inv1.payment_reference
|
||||||
|
bank_stmt_line.flush_recordset()
|
||||||
|
bank_stmt_line.invalidate_recordset()
|
||||||
|
bkstmt_data = bank_stmt_line.reconcile_data_info
|
||||||
|
mv_lines_ids = bkstmt_data["counterparts"]
|
||||||
|
|
||||||
|
self.assertIn(receivable1.id, mv_lines_ids)
|
||||||
|
self.assertNotIn(receivable2.id, mv_lines_ids)
|
||||||
|
|
||||||
|
def test_partner_name_with_parent(self):
|
||||||
|
parent_partner = self.env["res.partner"].create(
|
||||||
|
{
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
child_partner = self.env["res.partner"].create(
|
||||||
|
{
|
||||||
|
"name": "test",
|
||||||
|
"parent_id": parent_partner.id,
|
||||||
|
"type": "delivery",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.create_invoice_partner(
|
||||||
|
currency_id=self.currency_euro_id, partner_id=child_partner.id
|
||||||
|
)
|
||||||
|
|
||||||
|
bank_stmt = self.acc_bank_stmt_model.create(
|
||||||
|
{
|
||||||
|
"company_id": self.env.ref("base.main_company").id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
|
{
|
||||||
|
"name": "testLine",
|
||||||
|
"statement_id": bank_stmt.id,
|
||||||
|
"journal_id": self.bank_journal_euro.id,
|
||||||
|
"amount": 100,
|
||||||
|
"date": time.strftime("%Y-07-15"),
|
||||||
|
"payment_ref": "test",
|
||||||
|
"partner_name": "test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
bkstmt_data = bank_stmt_line.reconcile_data_info
|
||||||
|
self.assertEqual(len(bkstmt_data["counterparts"]), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
self.env["account.move.line"]
|
||||||
|
.browse(bkstmt_data["counterparts"])
|
||||||
|
.partner_id,
|
||||||
|
parent_partner,
|
||||||
|
)
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_list">
|
||||||
|
<field name="name">account.account.tree (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.account</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_list" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="action_read_account" position="after">
|
||||||
|
<button
|
||||||
|
type="action"
|
||||||
|
name="%(account_reconcile_oca.account_account_account_account_reconcile_act_window)s"
|
||||||
|
string="Reconcile"
|
||||||
|
class="float-end btn-secondary"
|
||||||
|
attrs="{'invisible': [('reconcile', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
|
@ -0,0 +1,165 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_account_reconcile_form_view">
|
||||||
|
<field
|
||||||
|
name="name"
|
||||||
|
>account.account.reconcile.form (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.account.reconcile</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form js_class="reconcile_manual" create="0">
|
||||||
|
<field name="manual_delete" invisible="1" />
|
||||||
|
<field name="manual_reference" invisible="1" />
|
||||||
|
<div class="o_form_statusbar o_account_reconcile_oca_statusbar">
|
||||||
|
<div class="o_statusbar_buttons">
|
||||||
|
<button
|
||||||
|
name="reconcile"
|
||||||
|
type="object"
|
||||||
|
string="Reconcile"
|
||||||
|
class="btn btn-primary"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="clean_reconcile"
|
||||||
|
type="object"
|
||||||
|
string="Clean"
|
||||||
|
class="btn btn-secondary"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<field name="is_reconciled" invisible="1" />
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="partner_id" />
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="account_id" />
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<field
|
||||||
|
name="reconcile_data_info"
|
||||||
|
nolabel="1"
|
||||||
|
widget="account_reconcile_oca_data"
|
||||||
|
class="w-100"
|
||||||
|
/>
|
||||||
|
<notebook>
|
||||||
|
<page
|
||||||
|
name="reconcile_line"
|
||||||
|
string="Reconcile"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="add_account_move_line_id"
|
||||||
|
widget="account_reconcile_oca_match"
|
||||||
|
domain="[('parent_state', '=', 'posted'), ('amount_residual', '!=', 0), ('account_id', '=', account_id)]"
|
||||||
|
context="{'search_default_partner_id': partner_id, 'tree_view_ref': 'account_reconcile_oca.account_move_line_tree_reconcile_view', 'search_view_ref': 'account_reconcile_oca.account_move_line_search_reconcile_view'}"
|
||||||
|
/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_account_reconcile_search_view">
|
||||||
|
<field
|
||||||
|
name="name"
|
||||||
|
>account.account.reconcile.search (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.account.reconcile</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search>
|
||||||
|
<!-- TODO -->
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_account_reconcile_tree_view">
|
||||||
|
<field
|
||||||
|
name="name"
|
||||||
|
>account.account.reconcile.tree (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.account.reconcile</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<!-- TODO -->
|
||||||
|
<field name="id" />
|
||||||
|
<field name="account_id" />
|
||||||
|
<field name="partner_id" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_account_reconcile_kanban_view">
|
||||||
|
<field
|
||||||
|
name="name"
|
||||||
|
>account.account.reconcile.kanban (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.account.reconcile</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<kanban js_class="reconcile">
|
||||||
|
<templates>
|
||||||
|
<t t-name="kanban-box">
|
||||||
|
<div
|
||||||
|
t-attf-class="oe_kanban_card oe_kanban_global_click"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<field name="account_id" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<field name="partner_id" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</kanban>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="account_account_reconcile_act_window">
|
||||||
|
<field name="name">Reconcile</field>
|
||||||
|
<field name="res_model">account.account.reconcile</field>
|
||||||
|
<field name="view_mode">kanban</field>
|
||||||
|
<field name="domain">[]</field>
|
||||||
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'view_ref': 'account_reconcile_oca.account_account_reconcile_form_view'}</field>
|
||||||
|
</record>
|
||||||
|
<record
|
||||||
|
id="res_partner_account_account_reconcile_act_window"
|
||||||
|
model="ir.actions.act_window"
|
||||||
|
>
|
||||||
|
<field name="name">Reconcile</field>
|
||||||
|
<field name="res_model">account.account.reconcile</field>
|
||||||
|
<field name="view_mode">kanban</field>
|
||||||
|
<field name="domain">[("partner_id", "=", active_id)]</field>
|
||||||
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'view_ref': 'account_reconcile_oca.account_account_reconcile_form_view'}</field>
|
||||||
|
<field name="binding_model_id" ref="base.model_res_partner" />
|
||||||
|
<field name="binding_view_types">form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record
|
||||||
|
id="account_account_account_account_reconcile_act_window"
|
||||||
|
model="ir.actions.act_window"
|
||||||
|
>
|
||||||
|
<field name="name">Reconcile</field>
|
||||||
|
<field name="res_model">account.account.reconcile</field>
|
||||||
|
<field name="view_mode">kanban</field>
|
||||||
|
<field name="domain">[("account_id", "=", active_id)]</field>
|
||||||
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'view_ref': 'account_reconcile_oca.account_account_reconcile_form_view'}</field>
|
||||||
|
<field name="binding_model_id" ref="account.model_account_account" />
|
||||||
|
<field name="binding_view_types">form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.menu" id="account_account_reconcile_menu">
|
||||||
|
<field name="name">Reconcile</field>
|
||||||
|
<field name="parent_id" ref="account.menu_finance_entries_actions" />
|
||||||
|
<field name="action" ref="account_account_reconcile_act_window" />
|
||||||
|
<field name="sequence" eval="10" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
|
@ -0,0 +1,326 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="bank_statement_search_reconcile_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.bank.statement.line.reconcile</field>
|
||||||
|
<field name="model">account.bank.statement.line</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search>
|
||||||
|
<field name="name" />
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field name="payment_ref" />
|
||||||
|
<field name="id" invisible="1" />
|
||||||
|
<field name="move_id" invisible="1" />
|
||||||
|
<separator />
|
||||||
|
<filter
|
||||||
|
name="reconciled"
|
||||||
|
string="Reconciled"
|
||||||
|
domain="[('is_reconciled', '=', True)]"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
name="not_reconciled"
|
||||||
|
string="Not Reconciled"
|
||||||
|
domain="[('is_reconciled', '=', False)]"
|
||||||
|
/>
|
||||||
|
<separator />
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="bank_statement_line_reconcile_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.bank.statement.line.reconcile</field>
|
||||||
|
<field name="model">account.bank.statement.line</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<kanban js_class="reconcile">
|
||||||
|
<field name="is_reconciled" />
|
||||||
|
<field name="currency_id" />
|
||||||
|
<field name="foreign_currency_id" />
|
||||||
|
<templates>
|
||||||
|
<t t-name="kanban-box">
|
||||||
|
<div
|
||||||
|
t-attf-class="oe_kanban_card oe_kanban_global_click"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8">
|
||||||
|
<field name="date" />
|
||||||
|
</div>
|
||||||
|
<div class="col-4" style="text-align:right">
|
||||||
|
<field
|
||||||
|
name="amount"
|
||||||
|
t-if="! record.foreign_currency_id.raw_value"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="amount_currency"
|
||||||
|
t-if="record.foreign_currency_id.raw_value"
|
||||||
|
widget="monetary"
|
||||||
|
options="{'currency_field': 'foreign_currency_id'}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<field name="partner_id" />
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8">
|
||||||
|
<field name="payment_ref" />
|
||||||
|
</div>
|
||||||
|
<div class="col-4" style="text-align:right">
|
||||||
|
<div
|
||||||
|
t-if="record.is_reconciled.raw_value"
|
||||||
|
class="badge text-bg-success"
|
||||||
|
>
|
||||||
|
Reconciled
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</kanban>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="bank_statement_line_form_add_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.bank.statement.line.form</field>
|
||||||
|
<field name="model">account.bank.statement.line</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="suitable_journal_ids" invisible="1" />
|
||||||
|
<field name="state" invisible="1" />
|
||||||
|
<field name="currency_id" invisible="1" />
|
||||||
|
<field name="date" />
|
||||||
|
<field name="payment_ref" required="1" />
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field
|
||||||
|
name="statement_id"
|
||||||
|
domain="[('journal_id', '=', journal_id)]"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="journal_id"
|
||||||
|
invisible="context.get('default_journal_id')"
|
||||||
|
required="1"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="amount" />
|
||||||
|
<field
|
||||||
|
name="foreign_currency_id"
|
||||||
|
domain="[('id', '!=', currency_id)]"
|
||||||
|
groups="base.group_multi_currency"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="amount_currency"
|
||||||
|
groups="base.group_multi_currency"
|
||||||
|
widget="monetary"
|
||||||
|
options="{'currency_field': 'foreign_currency_id'}"
|
||||||
|
attrs="{'invisible': [('foreign_currency_id', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button
|
||||||
|
string="Save"
|
||||||
|
type="object"
|
||||||
|
name="save"
|
||||||
|
class="btn btn-primary"
|
||||||
|
/>
|
||||||
|
<button string="Cancel" class="btn-secondary" special="cancel" />
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="bank_statement_line_form_reconcile_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.bank.statement.line.reconcile</field>
|
||||||
|
<field name="model">account.bank.statement.line</field>
|
||||||
|
<field name="priority">99</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form js_class="reconcile_form">
|
||||||
|
<div class="o_form_statusbar o_account_reconcile_oca_statusbar">
|
||||||
|
<div class="o_statusbar_buttons">
|
||||||
|
<button
|
||||||
|
name="reconcile_bank_line"
|
||||||
|
type="object"
|
||||||
|
string="Reconcile"
|
||||||
|
class="btn btn-primary"
|
||||||
|
attrs="{'invisible': ['|', ('is_reconciled', '=', True), ('can_reconcile', '=', False)]}"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="reconcile_bank_line"
|
||||||
|
type="object"
|
||||||
|
string="Reconcile"
|
||||||
|
class="btn btn-primary disabled"
|
||||||
|
attrs="{'invisible': ['|', ('is_reconciled', '=', True), ('can_reconcile', '=', True)]}"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="unreconcile_bank_line"
|
||||||
|
type="object"
|
||||||
|
string="Unreconcile"
|
||||||
|
class="btn btn-warning"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', False)]}"
|
||||||
|
confirm="Are you sure that the move should be unreconciled?"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="clean_reconcile"
|
||||||
|
type="object"
|
||||||
|
string="Clean"
|
||||||
|
class="btn btn-secondary"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
name="action_show_move"
|
||||||
|
type="object"
|
||||||
|
string="View move"
|
||||||
|
class="btn btn-info"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<field name="name" invisible="1" />
|
||||||
|
<field name="can_reconcile" invisible="1" />
|
||||||
|
<field name="partner_id" invisible="1" />
|
||||||
|
<field name="company_id" invisible="1" />
|
||||||
|
<field name="journal_id" invisible="1" />
|
||||||
|
<field name="suitable_journal_ids" invisible="1" />
|
||||||
|
<field name="manual_reference" invisible="1" />
|
||||||
|
<field name="manual_delete" invisible="1" />
|
||||||
|
<field name="is_reconciled" invisible="1" />
|
||||||
|
<field name="foreign_currency_id" invisible="1" />
|
||||||
|
<field
|
||||||
|
name="reconcile_data_info"
|
||||||
|
nolabel="1"
|
||||||
|
widget="account_reconcile_oca_data"
|
||||||
|
class="w-100"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<field
|
||||||
|
name="manual_model_id"
|
||||||
|
widget="selection_badge_uncheck"
|
||||||
|
nolabel="1"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<notebook>
|
||||||
|
<page
|
||||||
|
name="reconcile_line"
|
||||||
|
string="Reconcile"
|
||||||
|
attrs="{'invisible': [('is_reconciled', '=', True)]}"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="add_account_move_line_id"
|
||||||
|
widget="account_reconcile_oca_match"
|
||||||
|
domain="[('parent_state', '=', 'posted'),('amount_residual', '!=', 0),('account_id.reconcile', '=', True), ('company_id', '=', company_id)]"
|
||||||
|
context="{'search_default_partner_id': partner_id, 'tree_view_ref': 'account_reconcile_oca.account_move_line_tree_reconcile_view', 'search_view_ref': 'account_reconcile_oca.account_move_line_search_reconcile_view'}"
|
||||||
|
/>
|
||||||
|
</page>
|
||||||
|
<page name="manual" string="Manual operation">
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="manual_line_id" invisible="1" />
|
||||||
|
<field name="manual_kind" invisible="1" />
|
||||||
|
<field
|
||||||
|
name="manual_account_id"
|
||||||
|
string="Account"
|
||||||
|
attrs="{'readonly': ['|', '|', ('manual_reference', '=', False), ('is_reconciled', '=', True), ('manual_line_id', '!=', False)]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="manual_partner_id"
|
||||||
|
string="Partner"
|
||||||
|
attrs="{'readonly': ['|', '|', ('manual_reference', '=', False), ('is_reconciled', '=', True), '&', ('manual_line_id', '!=', False), ('manual_kind', '!=', 'liquidity')]}"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field
|
||||||
|
name="manual_name"
|
||||||
|
string="Name"
|
||||||
|
attrs="{'readonly': ['|', '|', ('manual_reference', '=', False), ('is_reconciled', '=', True), '&', ('manual_line_id', '!=', False), ('manual_kind', '!=', 'liquidity')]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="manual_amount"
|
||||||
|
string="Amount"
|
||||||
|
attrs="{'readonly': ['|', ('manual_reference', '=', False), ('is_reconciled', '=', True)]}"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
<page name="chatter" string="Chatter">
|
||||||
|
<field name="move_id" widget="account_reconcile_oca_chatter" />
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="action_bank_statement_line_reconcile" model="ir.actions.act_window">
|
||||||
|
<field name="name">Reconcile bank statement lines</field>
|
||||||
|
<field name="res_model">account.bank.statement.line</field>
|
||||||
|
<field name="domain">[('journal_id', '=', active_id)]</field>
|
||||||
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'default_journal_id': active_id, 'search_default_not_reconciled': True, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}</field>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field
|
||||||
|
name="view_ids"
|
||||||
|
eval="[(5, 0, 0),
|
||||||
|
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
|
/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
Nothing to reconcile
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="action_bank_statement_line_reconcile_all" model="ir.actions.act_window">
|
||||||
|
<field name="name">Reconcile bank statement lines</field>
|
||||||
|
<field name="res_model">account.bank.statement.line</field>
|
||||||
|
<field name="domain">[('journal_id', '=', active_id)]</field>
|
||||||
|
<field
|
||||||
|
name="context"
|
||||||
|
>{'default_journal_id': active_id, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}</field>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field
|
||||||
|
name="view_ids"
|
||||||
|
eval="[(5, 0, 0),
|
||||||
|
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
|
/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
Nothing to reconcile
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record
|
||||||
|
id="action_bank_statement_line_move_view_reconcile"
|
||||||
|
model="ir.actions.act_window"
|
||||||
|
>
|
||||||
|
<field name="name">Reconcile bank statement lines</field>
|
||||||
|
<field name="res_model">account.bank.statement.line</field>
|
||||||
|
<field name="context">{'search_default_move_id': active_id}</field>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field
|
||||||
|
name="view_ids"
|
||||||
|
eval="[(5, 0, 0),
|
||||||
|
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
|
/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
Nothing to reconcile
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="action_bank_statement_line_create" model="ir.actions.act_window">
|
||||||
|
<field name="name">Add an Statement</field>
|
||||||
|
<field name="res_model">account.bank.statement.line</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field
|
||||||
|
name="view_ids"
|
||||||
|
eval="[(5, 0, 0),
|
||||||
|
(0, 0, {'view_mode': 'form', 'view_id': ref('bank_statement_line_form_add_view')})]"
|
||||||
|
/>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_account_journal_form" model="ir.ui.view">
|
||||||
|
<field name="name">account.journal.inherit.dashboard.kanban</field>
|
||||||
|
<field name="model">account.journal</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_journal_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="suspense_account_id" position="before">
|
||||||
|
<field
|
||||||
|
name="reconcile_mode"
|
||||||
|
attrs="{'required': [('type', 'in', ('bank', 'cash'))], 'invisible': [('type', 'not in', ('bank', 'cash'))]}"
|
||||||
|
options="{'no_quick_create': True}"
|
||||||
|
groups="account.group_account_readonly"
|
||||||
|
/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.journal.inherit.dashboard.kanban</field>
|
||||||
|
<field name="model">account.journal</field>
|
||||||
|
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath
|
||||||
|
expr="//kanban/templates//div[@id='dashboard_bank_cash_left']/t[1]"
|
||||||
|
position="before"
|
||||||
|
>
|
||||||
|
<t t-if="dashboard.number_to_reconcile > 0">
|
||||||
|
<button
|
||||||
|
type="action"
|
||||||
|
name="%(account_reconcile_oca.action_bank_statement_line_reconcile)s"
|
||||||
|
class="btn btn-primary"
|
||||||
|
> Reconcile <t
|
||||||
|
t-esc="dashboard.number_to_reconcile"
|
||||||
|
/> Items</button>
|
||||||
|
</t>
|
||||||
|
</xpath>
|
||||||
|
<xpath
|
||||||
|
expr="//kanban/templates//div[@id='dashboard_bank_cash_right']"
|
||||||
|
position="inside"
|
||||||
|
>
|
||||||
|
<t t-if="dashboard.number_to_check > 0">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col overflow-hidden text-left">
|
||||||
|
<a type="object" name="action_open_reconcile_to_check">
|
||||||
|
<t t-esc="dashboard.number_to_check" /> to check</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto text-right">
|
||||||
|
<span>
|
||||||
|
<t t-esc="dashboard.to_check_balance" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
<xpath expr="//div[@id='card_action_view_menus']" position="after">
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
role="menuitem"
|
||||||
|
type="action"
|
||||||
|
name="%(account_reconcile_oca.action_bank_statement_line_reconcile_all)s"
|
||||||
|
>Transactions</a>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_move_form_view">
|
||||||
|
<field name="name">account.move.form (in account_reconcile_oca)</field>
|
||||||
|
<field name="model">account.move</field>
|
||||||
|
<field name="inherit_id" ref="account.view_move_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="button_box" position="inside">
|
||||||
|
<button
|
||||||
|
type="action"
|
||||||
|
name="%(account_reconcile_oca.action_bank_statement_line_move_view_reconcile)s"
|
||||||
|
string="Bank reconcile"
|
||||||
|
class="btn btn-primary"
|
||||||
|
icon="fa-list"
|
||||||
|
attrs="{'invisible': [('statement_line_id', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</odoo>
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!-- Copyright 2022 CreuBlanca
|
||||||
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="account_move_line_tree_reconcile_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.move.line.tree.reconcile</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="priority">99</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree js_class="reconcile_move_line">
|
||||||
|
<field name="date" />
|
||||||
|
<field name="move_id" />
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field name="name" />
|
||||||
|
<field name="amount_residual" />
|
||||||
|
<button
|
||||||
|
type="object"
|
||||||
|
name="action_open_business_doc"
|
||||||
|
string="View"
|
||||||
|
class="btn btn-secondary"
|
||||||
|
/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="account_move_line_search_reconcile_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.move.line.search.reconcile</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="priority">99</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Search Journal Items">
|
||||||
|
<field
|
||||||
|
name="name"
|
||||||
|
string="Journal Item"
|
||||||
|
filter_domain="[ '|', '|', '|', ('name', 'ilike', self), ('ref', 'ilike', self), ('account_id', 'ilike', self), ('partner_id', 'ilike', self)]"
|
||||||
|
/>
|
||||||
|
<field name="name" />
|
||||||
|
<field name="ref" />
|
||||||
|
<field name="date" />
|
||||||
|
<field name="account_id" />
|
||||||
|
<field name="account_root_id" />
|
||||||
|
<field name="account_type" />
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field name="journal_id" />
|
||||||
|
<field
|
||||||
|
name="move_id"
|
||||||
|
string="Journal Entry"
|
||||||
|
filter_domain="[ '|', '|', ('move_id.name', 'ilike', self), ('move_id.ref', 'ilike', self), ('move_id.partner_id', 'ilike', self)]"
|
||||||
|
/>
|
||||||
|
<separator />
|
||||||
|
<filter
|
||||||
|
string="Sales"
|
||||||
|
name="sales"
|
||||||
|
domain="[('journal_id.type', '=', 'sale')]"
|
||||||
|
context="{'default_journal_type': 'sale'}"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Purchases"
|
||||||
|
name="purchases"
|
||||||
|
domain="[('journal_id.type', '=', 'purchase')]"
|
||||||
|
context="{'default_journal_type': 'purchase'}"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Bank"
|
||||||
|
name="bank"
|
||||||
|
domain="[('journal_id.type', '=', 'bank')]"
|
||||||
|
context="{'default_journal_type': 'bank'}"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Cash"
|
||||||
|
name="cash"
|
||||||
|
domain="[('journal_id.type', '=', 'cash')]"
|
||||||
|
context="{'default_journal_type': 'cash'}"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Miscellaneous"
|
||||||
|
domain="[('journal_id.type', '=', 'general')]"
|
||||||
|
name="misc_filter"
|
||||||
|
context="{'default_journal_type': 'general'}"
|
||||||
|
/>
|
||||||
|
<separator />
|
||||||
|
<filter
|
||||||
|
string="Payable"
|
||||||
|
domain="[('account_id.account_type', '=', 'liability_payable'), ('account_id.non_trade', '=', False)]"
|
||||||
|
help="From Trade Payable accounts"
|
||||||
|
name="trade_payable"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Receivable"
|
||||||
|
domain="[('account_id.account_type', '=', 'asset_receivable'), ('account_id.non_trade', '=', False)]"
|
||||||
|
help="From Trade Receivable accounts"
|
||||||
|
name="trade_receivable"
|
||||||
|
/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
Loading…
Reference in New Issue