mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[15.0][MIG] account_reconciliation_widget:Migration to 15.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "account_reconciliation_widget",
|
||||
"version": "14.0.1.2.0",
|
||||
"version": "15.0.1.1.1",
|
||||
"category": "Accounting",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Account reconciliation widget",
|
||||
@@ -12,13 +12,21 @@
|
||||
"depends": ["account"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/assets.xml",
|
||||
"views/account_view.xml",
|
||||
"views/account_bank_statement_view.xml",
|
||||
"views/account_journal_dashboard_view.xml",
|
||||
],
|
||||
"qweb": [
|
||||
"static/src/xml/account_reconciliation.xml",
|
||||
],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"account_reconciliation_widget/static/src/scss/account_reconciliation.scss",
|
||||
"account_reconciliation_widget/static/src/js/reconciliation**/*",
|
||||
],
|
||||
"web.qunit_suite_tests": [
|
||||
"account_reconciliation_widget/static/tests/**/*",
|
||||
],
|
||||
"web.assets_qweb": [
|
||||
"account_reconciliation_widget/static/src/xml/account_reconciliation.xml",
|
||||
],
|
||||
},
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class AccountBankStatement(models.Model):
|
||||
_inherit = "account.bank.statement"
|
||||
|
||||
accounting_date = fields.Date(
|
||||
string="Accounting Date",
|
||||
string="Financial Date",
|
||||
help="If set, the accounting entries created during the bank statement "
|
||||
"reconciliation process will be created at this date.\n"
|
||||
"This is useful if the accounting period in which the entries should "
|
||||
@@ -33,15 +33,14 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
_inherit = "account.bank.statement.line"
|
||||
|
||||
# FIXME: is this necessary now?
|
||||
move_name = fields.Char(
|
||||
string="Journal Entry Name",
|
||||
readonly=True,
|
||||
default=False,
|
||||
copy=False,
|
||||
help="Technical field holding the number given to the journal entry, "
|
||||
"automatically set when the statement line is reconciled then "
|
||||
"stored to set the same number again if the line is cancelled, "
|
||||
help="Technical field holding the number given to the journal entry,"
|
||||
"automatically set when the statement line is reconciled then stored"
|
||||
"to set the same number again if the line is cancelled,"
|
||||
"set to draft and re-processed again.",
|
||||
)
|
||||
|
||||
@@ -130,27 +129,9 @@ class AccountBankStatementLine(models.Model):
|
||||
and user_type_id not in account_types
|
||||
):
|
||||
account_types |= user_type_id
|
||||
# FIXME: review
|
||||
# if suspense_moves_mode:
|
||||
# if any(not line.journal_entry_ids for line in self):
|
||||
# raise UserError(
|
||||
# _(
|
||||
# "Some selected statement line were not already "
|
||||
# "reconciled with an account move."
|
||||
# )
|
||||
# )
|
||||
# else:
|
||||
# if any(line.journal_entry_ids for line in self):
|
||||
# raise UserError(
|
||||
# _(
|
||||
# "A selected statement line was already reconciled with "
|
||||
# "an account move."
|
||||
# )
|
||||
# )
|
||||
|
||||
# Fully reconciled moves are just linked to the bank statement
|
||||
total = self.amount
|
||||
currency = self.foreign_currency_id or statement_currency
|
||||
currency = self.currency_id or statement_currency
|
||||
for aml_rec in payment_aml_rec:
|
||||
balance = (
|
||||
aml_rec.amount_currency if aml_rec.currency_id else aml_rec.balance
|
||||
@@ -163,11 +144,8 @@ class AccountBankStatementLine(models.Model):
|
||||
{"statement_line_id": self.id}
|
||||
)
|
||||
counterpart_moves = counterpart_moves | aml_rec.move_id
|
||||
if (
|
||||
aml_rec.journal_id.post_at == "bank_rec"
|
||||
and aml_rec.payment_id
|
||||
and aml_rec.move_id.state == "draft"
|
||||
):
|
||||
# Update
|
||||
if aml_rec.payment_id and aml_rec.move_id.state == "draft":
|
||||
# In case the journal is set to only post payments when
|
||||
# performing bank reconciliation, we modify its date and post
|
||||
# it.
|
||||
@@ -180,8 +158,8 @@ class AccountBankStatementLine(models.Model):
|
||||
self._check_invoice_state(invoice)
|
||||
|
||||
# Create move line(s). Either matching an existing journal entry
|
||||
# (eg. invoice), in which case we reconcile the existing and the new
|
||||
# move lines together, or being a write-off.
|
||||
# (eg. invoice), in which case we reconcile the existing and the
|
||||
# new move lines together, or being a write-off.
|
||||
if counterpart_aml_dicts or new_aml_dicts:
|
||||
counterpart_moves = self._create_counterpart_and_new_aml(
|
||||
counterpart_moves, counterpart_aml_dicts, new_aml_dicts
|
||||
@@ -200,9 +178,9 @@ class AccountBankStatementLine(models.Model):
|
||||
)
|
||||
|
||||
# create the res.partner.bank if needed
|
||||
if self.account_number and self.partner_id and not self.partner_bank_id:
|
||||
# Search bank account without partner to handle the case the
|
||||
# res.partner.bank already exists but is set on a different partner.
|
||||
if self.account_number and self.partner_id and not self.bank_account_id:
|
||||
# Search bank account without partner to handle the case the res.partner.bank
|
||||
# already exists but is set on a different partner.
|
||||
self.partner_bank_id = self._find_or_create_bank_account()
|
||||
|
||||
counterpart_moves._check_balanced()
|
||||
@@ -252,7 +230,7 @@ class AccountBankStatementLine(models.Model):
|
||||
aml_to_reconcile.append((new_aml, counterpart_move_line))
|
||||
|
||||
# Post to allow reconcile
|
||||
if self.move_id.state != "posted":
|
||||
if self.move_id.state == "draft":
|
||||
self.move_id.with_context(
|
||||
skip_account_move_synchronization=True
|
||||
).action_post()
|
||||
@@ -264,7 +242,10 @@ class AccountBankStatementLine(models.Model):
|
||||
self._check_invoice_state(counterpart_move_line.move_id)
|
||||
|
||||
# Needs to be called manually as lines were created 1 by 1
|
||||
self.move_id.update_lines_tax_exigibility()
|
||||
if self.move_id.state == "draft":
|
||||
self.move_id.with_context(
|
||||
skip_account_move_synchronization=True
|
||||
).action_post()
|
||||
# record the move name on the statement line to be able to retrieve
|
||||
# it in case of unreconciliation
|
||||
self.write({"move_name": self.move_id.name})
|
||||
@@ -275,9 +256,9 @@ class AccountBankStatementLine(models.Model):
|
||||
self.ensure_one()
|
||||
company_currency = self.journal_id.company_id.currency_id
|
||||
statement_currency = self.journal_id.currency_id or company_currency
|
||||
st_line_currency = self.foreign_currency_id or statement_currency
|
||||
st_line_currency = self.currency_id or statement_currency
|
||||
st_line_currency_rate = (
|
||||
self.foreign_currency_id and (self.amount_currency / self.amount) or False
|
||||
self.currency_id and (self.amount_currency / self.amount) or False
|
||||
)
|
||||
company = self.company_id
|
||||
|
||||
@@ -285,21 +266,19 @@ class AccountBankStatementLine(models.Model):
|
||||
aml_dict["amount_currency"] = aml_dict["debit"] - aml_dict["credit"]
|
||||
aml_dict["currency_id"] = st_line_currency.id
|
||||
if (
|
||||
self.foreign_currency_id
|
||||
self.currency_id
|
||||
and statement_currency.id == company_currency.id
|
||||
and st_line_currency_rate
|
||||
):
|
||||
# Statement is in company currency but the transaction is in
|
||||
# foreign currency
|
||||
# Statement is in company currency but the transaction is in foreign currency
|
||||
aml_dict["debit"] = company_currency.round(
|
||||
aml_dict["debit"] / st_line_currency_rate
|
||||
)
|
||||
aml_dict["credit"] = company_currency.round(
|
||||
aml_dict["credit"] / st_line_currency_rate
|
||||
)
|
||||
elif self.foreign_currency_id and st_line_currency_rate:
|
||||
# Statement is in foreign currency and the transaction is in
|
||||
# another one
|
||||
elif self.currency_id and st_line_currency_rate:
|
||||
# Statement is in foreign currency and the transaction is in another one
|
||||
aml_dict["debit"] = statement_currency._convert(
|
||||
aml_dict["debit"] / st_line_currency_rate,
|
||||
company_currency,
|
||||
@@ -313,8 +292,8 @@ class AccountBankStatementLine(models.Model):
|
||||
date,
|
||||
)
|
||||
else:
|
||||
# Statement is in foreign currency and no extra currency is
|
||||
# given for the transaction
|
||||
# Statement is in foreign currency and no extra currency is given
|
||||
# for the transaction
|
||||
aml_dict["debit"] = st_line_currency._convert(
|
||||
aml_dict["debit"], company_currency, company, date
|
||||
)
|
||||
@@ -322,8 +301,7 @@ class AccountBankStatementLine(models.Model):
|
||||
aml_dict["credit"], company_currency, company, date
|
||||
)
|
||||
elif statement_currency.id != company_currency.id:
|
||||
# Statement is in foreign currency but the transaction is in company
|
||||
# currency
|
||||
# Statement is in foreign currency but the transaction is in company currency
|
||||
prorata_factor = (
|
||||
aml_dict["debit"] - aml_dict["credit"]
|
||||
) / self.amount_currency
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from psycopg2 import sql
|
||||
|
||||
@@ -7,6 +8,8 @@ from odoo.exceptions import UserError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools.misc import format_date, formatLang, parse_date
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AccountReconciliation(models.AbstractModel):
|
||||
_name = "account.reconciliation.widget"
|
||||
@@ -46,7 +49,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
st_line.write({"partner_id": datum["partner_id"]})
|
||||
|
||||
ctx["default_to_check"] = datum.get("to_check")
|
||||
moves = st_line.with_context(ctx).process_reconciliation(
|
||||
moves = st_line.with_context(**ctx).process_reconciliation(
|
||||
datum.get("counterpart_aml_dicts", []),
|
||||
payment_aml_rec,
|
||||
datum.get("new_aml_dicts", []),
|
||||
@@ -135,7 +138,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
recs_count = 0
|
||||
aml_recs = self.env["account.move.line"].browse([i[0] for i in res])
|
||||
target_currency = (
|
||||
st_line.foreign_currency_id
|
||||
st_line.currency_id
|
||||
or st_line.journal_id.currency_id
|
||||
or st_line.journal_id.company_id.currency_id
|
||||
)
|
||||
@@ -157,9 +160,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
self.env["res.partner.bank"]._apply_ir_rules(ir_rules_query, "read")
|
||||
from_clause, where_clause, where_clause_params = ir_rules_query.get_sql()
|
||||
if where_clause:
|
||||
where_bank = ("AND %s" % where_clause).replace(
|
||||
'"res_partner_bank"', '"bank"'
|
||||
)
|
||||
where_bank = ("AND %s" % where_clause).replace("res_partner_bank", "bank")
|
||||
params += where_clause_params
|
||||
else:
|
||||
where_bank = ""
|
||||
@@ -171,7 +172,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
self.env["res.partner"]._apply_ir_rules(ir_rules_query, "read")
|
||||
from_clause, where_clause, where_clause_params = ir_rules_query.get_sql()
|
||||
if where_clause:
|
||||
where_partner = ("AND %s" % where_clause).replace('"res_partner"', '"p3"')
|
||||
where_partner = ("AND %s" % where_clause).replace("res_partner", "p3")
|
||||
params += where_clause_params
|
||||
else:
|
||||
where_partner = ""
|
||||
@@ -257,7 +258,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
aml_ids = matching_amls[line.id]["aml_ids"]
|
||||
bank_statements_left += line.statement_id
|
||||
target_currency = (
|
||||
line.foreign_currency_id
|
||||
line.currency_id
|
||||
or line.journal_id.currency_id
|
||||
or line.journal_id.company_id.currency_id
|
||||
)
|
||||
@@ -710,7 +711,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
]
|
||||
str_domain = expression.OR([str_domain, amount_domain])
|
||||
except Exception:
|
||||
pass
|
||||
_logger.warning(Exception)
|
||||
else:
|
||||
try:
|
||||
amount = float(search_str)
|
||||
@@ -735,7 +736,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
]
|
||||
str_domain = expression.OR([str_domain, amount_domain])
|
||||
except Exception:
|
||||
pass
|
||||
_logger.warning(Exception)
|
||||
return str_domain
|
||||
|
||||
@api.model
|
||||
@@ -1021,7 +1022,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
statement_currency = (
|
||||
st_line.journal_id.currency_id or st_line.journal_id.company_id.currency_id
|
||||
)
|
||||
if st_line.amount_currency and st_line.foreign_currency_id:
|
||||
if st_line.amount_currency and st_line.currency_id:
|
||||
amount = st_line.amount_currency
|
||||
amount_currency = st_line.amount
|
||||
amount_currency_str = formatLang(
|
||||
@@ -1034,7 +1035,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
amount_str = formatLang(
|
||||
self.env,
|
||||
abs(amount),
|
||||
currency_obj=st_line.foreign_currency_id or statement_currency,
|
||||
currency_obj=st_line.currency_id or statement_currency,
|
||||
)
|
||||
|
||||
data = {
|
||||
@@ -1046,7 +1047,7 @@ class AccountReconciliation(models.AbstractModel):
|
||||
"date": format_date(self.env, st_line.date),
|
||||
"amount": amount,
|
||||
"amount_str": amount_str, # Amount in the statement line currency
|
||||
"currency_id": st_line.foreign_currency_id.id or statement_currency.id,
|
||||
"currency_id": st_line.currency_id.id or statement_currency.id,
|
||||
"partner_id": st_line.partner_id.id,
|
||||
"journal_id": st_line.journal_id.id,
|
||||
"statement_id": st_line.statement_id.id,
|
||||
|
||||
@@ -367,8 +367,8 @@ ul.auto-toc {
|
||||
!! 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/14.0/account_reconciliation_widget"><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-14-0/account-reconcile-14-0-account_reconciliation_widget"><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/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module restores account reconciliation widget moved from Odoo community to enterpise in V. 14.0
|
||||
<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/15.0/account_reconciliation_widget"><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-14-0/account-reconcile-14-0-account_reconciliation_widget"><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/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module restores account reconciliation widget moved from Odoo community to enterpise in V. 15.0
|
||||
Provides two widgets designed to reconcile move lines in a easy way: one focused on bank statements and another for generic use.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
@@ -396,7 +396,7 @@ Provides two widgets designed to reconcile move lines in a easy way: one focused
|
||||
<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_reconciliation_widget%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconciliation_widget%0Aversion:%2015.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">
|
||||
@@ -412,6 +412,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Tecnativa - Pedro M. Baeza</li>
|
||||
<li>kelvzxu - kelvin Leonardi Kohsasih</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -421,7 +422,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<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/14.0/account_reconciliation_widget">OCA/account-reconcile</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/15.0/account_reconciliation_widget">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>
|
||||
|
||||
@@ -144,7 +144,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
this._addProposition(line, prop);
|
||||
line["mv_lines_" + line.mode] = _.filter(
|
||||
line["mv_lines_" + line.mode],
|
||||
(l) => l.id != mv_line_id
|
||||
(l) => l.id !== mv_line_id
|
||||
);
|
||||
|
||||
// Remove all non valid lines
|
||||
@@ -159,7 +159,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
if (
|
||||
!line.st_line.partner_id &&
|
||||
line.reconciliation_proposition &&
|
||||
line.reconciliation_proposition.length == 1 &&
|
||||
line.reconciliation_proposition.length === 1 &&
|
||||
prop.partner_id &&
|
||||
line.type === undefined
|
||||
) {
|
||||
@@ -175,12 +175,12 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
this._performMoveLine(
|
||||
handle,
|
||||
"match_rp",
|
||||
line.mode == "match_rp" ? 1 : 0
|
||||
line.mode === "match_rp" ? 1 : 0
|
||||
),
|
||||
this._performMoveLine(
|
||||
handle,
|
||||
"match_other",
|
||||
line.mode == "match_other" ? 1 : 0
|
||||
line.mode === "match_other" ? 1 : 0
|
||||
),
|
||||
]);
|
||||
},
|
||||
@@ -282,7 +282,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
.then(function () {
|
||||
if (line.st_line.partner_id) {
|
||||
_.each(line.reconciliation_proposition, function (prop) {
|
||||
if (prop.partner_id != line.st_line.partner_id) {
|
||||
if (prop.partner_id !== line.st_line.partner_id) {
|
||||
line.reconciliation_proposition = [];
|
||||
return false;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
|
||||
// No proposition left and then, reset the st_line partner.
|
||||
if (
|
||||
line.reconciliation_proposition.length == 0 &&
|
||||
line.reconciliation_proposition.length === 0 &&
|
||||
line.st_line.has_no_partner
|
||||
)
|
||||
defs.push(self.changePartner(line.handle));
|
||||
@@ -1009,7 +1009,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
);
|
||||
|
||||
_.each(self.lines, function (other_line) {
|
||||
if (other_line != line) {
|
||||
if (other_line !== line) {
|
||||
var filtered_prop =
|
||||
other_line.reconciliation_proposition.filter(
|
||||
(p) =>
|
||||
@@ -1018,7 +1018,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
.includes(p.id)
|
||||
);
|
||||
if (
|
||||
filtered_prop.length !=
|
||||
filtered_prop.length !==
|
||||
other_line.reconciliation_proposition.length
|
||||
) {
|
||||
other_line.need_update = true;
|
||||
@@ -1305,7 +1305,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
: false,
|
||||
account_code: self.accounts[line.st_line.open_balance_account_id],
|
||||
};
|
||||
line.balance.show_balance = line.balance.amount_currency != 0;
|
||||
line.balance.show_balance = line.balance.amount_currency !== 0;
|
||||
line.balance.type = line.balance.amount_currency
|
||||
? line.st_line.partner_id
|
||||
? 0
|
||||
@@ -1427,7 +1427,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
var hasDifferentPartners = function (prop) {
|
||||
return (
|
||||
!prop.partner_id ||
|
||||
prop.partner_id !=
|
||||
prop.partner_id !==
|
||||
line.reconciliation_proposition[0]
|
||||
.partner_id
|
||||
);
|
||||
@@ -1517,13 +1517,13 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
);
|
||||
if (mv_lines[0]) {
|
||||
line["remaining_" + mode] = mv_lines[0].recs_count - mv_lines.length;
|
||||
} else if (line["mv_lines_" + mode].lenght == 0) {
|
||||
} else if (line["mv_lines_" + mode].lenght === 0) {
|
||||
line["remaining_" + mode] = 0;
|
||||
}
|
||||
this._formatLineProposition(line, mv_lines);
|
||||
|
||||
if (
|
||||
(line.mode == "match_other" || line.mode == "match_rp") &&
|
||||
(line.mode === "match_other" || line.mode === "match_rp") &&
|
||||
!line["mv_lines_" + mode].length &&
|
||||
!line["filter_" + mode].length
|
||||
) {
|
||||
@@ -1598,10 +1598,10 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
amount = (line.balance.amount * values.amount) / 100;
|
||||
break;
|
||||
case "regex":
|
||||
var matching = line.st_line.payment_ref.match(
|
||||
var matching = line.st_line.name.match(
|
||||
new RegExp(values.amount_string)
|
||||
);
|
||||
if (matching && matching.length == 2) {
|
||||
if (matching && matching.length === 2) {
|
||||
matching = matching[1].replace(
|
||||
new RegExp("\\D" + reconcileModel.decimal_separator, "g"),
|
||||
""
|
||||
@@ -2158,7 +2158,7 @@ odoo.define("account.ReconciliationModel", function (require) {
|
||||
|
||||
// No proposition left and then, reset the st_line partner.
|
||||
if (
|
||||
line.reconciliation_proposition.length == 0 &&
|
||||
line.reconciliation_proposition.length === 0 &&
|
||||
line.st_line.has_no_partner
|
||||
)
|
||||
defs.push(self.changePartner(line.handle));
|
||||
|
||||
@@ -155,10 +155,10 @@
|
||||
t-esc="state.st_line.amount_currency_str"
|
||||
/>)</t></td>
|
||||
<td class="cell_left"><t t-if="state.st_line.amount > 0"><t
|
||||
t-raw="state.st_line.amount_str"
|
||||
t-esc="state.st_line.amount_str"
|
||||
/></t></td>
|
||||
<td class="cell_right"><t t-if="state.st_line.amount < 0"><t
|
||||
t-raw="state.st_line.amount_str"
|
||||
t-esc="state.st_line.amount_str"
|
||||
/></t></td>
|
||||
<td class="cell_info_popover" />
|
||||
</tr>
|
||||
@@ -290,7 +290,7 @@
|
||||
t-att-data-content="state.balance.amount_currency_str"
|
||||
t-att-aria-label="state.balance.amount_currency_str"
|
||||
t-att-title="state.balance.amount_currency_str"
|
||||
/><t t-raw="state.balance.amount_str" /></t></td>
|
||||
/><t t-esc="state.balance.amount_str" /></t></td>
|
||||
<td class="cell_right"><t t-if="state.balance.amount_currency > 0"><span
|
||||
role="img"
|
||||
t-if="state.balance.amount_currency_str"
|
||||
@@ -298,7 +298,7 @@
|
||||
t-att-data-content="state.balance.amount_currency_str"
|
||||
t-att-aria-label="state.balance.amount_currency_str"
|
||||
t-att-title="state.balance.amount_currency_str"
|
||||
/><t t-raw="state.balance.amount_str" /></t></td>
|
||||
/><t t-esc="state.balance.amount_str" /></t></td>
|
||||
<td class="cell_info_popover" />
|
||||
</tr>
|
||||
</t>
|
||||
@@ -463,7 +463,7 @@
|
||||
t-if="line.partial_amount && line.partial_amount != line.amount"
|
||||
class="strike_amount text-muted"
|
||||
>
|
||||
<t t-raw="line.amount_str" />
|
||||
<t t-esc="line.amount_str" />
|
||||
<br />
|
||||
</span>
|
||||
</span>
|
||||
@@ -472,10 +472,10 @@
|
||||
<input class="edit_amount_input text-right d-none" />
|
||||
</t>
|
||||
<span class="line_amount">
|
||||
<t t-if="!line.partial_amount_str" t-raw="line.amount_str" />
|
||||
<t t-if="!line.partial_amount_str" t-esc="line.amount_str" />
|
||||
<t
|
||||
t-if="line.partial_amount_str && line.partial_amount != line.amount"
|
||||
t-raw="line.partial_amount_str"
|
||||
t-esc="line.partial_amount_str"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
@@ -532,17 +532,17 @@
|
||||
/> <t t-esc="line.account_name" /></td></tr>
|
||||
<tr><td>Date</td><td><t t-esc="line.date" /></td></tr>
|
||||
<tr><td>Due Date</td><td><t t-esc="line.date_maturity || line.date" /></td></tr>
|
||||
<tr><td>Journal</td><td><t t-esc="line.journal_id[1]" /></td></tr>
|
||||
<tr><td>Journal</td><td><t t-esc="line.journal_id.display_name" /></td></tr>
|
||||
<tr t-if="line.partner_id"><td>Partner</td><td><t
|
||||
t-esc="line.partner_name"
|
||||
/></td></tr>
|
||||
<tr><td>Label</td><td><t t-esc="line.label" /></td></tr>
|
||||
<tr t-if="line.ref"><td>Ref</td><td><t t-esc="line.ref" /></td></tr>
|
||||
<tr><td>Amount</td><td><t t-raw="line.total_amount_str" /><t
|
||||
<tr><td>Amount</td><td><t t-esc="line.total_amount_str" /><t
|
||||
t-if="line.total_amount_currency_str"
|
||||
> (<t t-esc="line.total_amount_currency_str" />)</t></td></tr>
|
||||
<tr t-if="line.is_partially_reconciled"><td>Residual</td><td>
|
||||
<t t-raw="line.amount_str" /><t t-if="line.amount_currency_str"> (<t
|
||||
<t t-esc="line.amount_str" /><t t-if="line.amount_currency_str"> (<t
|
||||
t-esc="line.amount_currency_str"
|
||||
/>)</t>
|
||||
</td></tr>
|
||||
@@ -563,7 +563,7 @@
|
||||
t-esc="state.st_line.ref"
|
||||
/></td></tr>
|
||||
<tr><td>Description</td><td><t t-esc="state.st_line.payment_ref" /></td></tr>
|
||||
<tr><td>Amount</td><td><t t-raw="state.st_line.amount_str" /><t
|
||||
<tr><td>Amount</td><td><t t-esc="state.st_line.amount_str" /><t
|
||||
t-if="state.st_line.amount_currency_str"
|
||||
> (<t t-esc="state.st_line.amount_currency_str" />)</t></td></tr>
|
||||
<tr><td>Account</td><td><t t-esc="state.st_line.account_code" /> <t
|
||||
|
||||
@@ -241,14 +241,14 @@ odoo.define(
|
||||
}
|
||||
);
|
||||
|
||||
if (rep_ln.repartition_type == "base") {
|
||||
if (rep_ln.repartition_type === "base") {
|
||||
tax_base =
|
||||
(tax.price_include
|
||||
? (amount * 100) / (100 + tax.amount)
|
||||
: amount) *
|
||||
(rep_ln.factor_percent / 100);
|
||||
base_tags = rep_ln.tag_ids;
|
||||
} else if (rep_ln.repartition_type == "tax") {
|
||||
} else if (rep_ln.repartition_type === "tax") {
|
||||
/*
|
||||
IMPORTANT :
|
||||
For simplicity of testing, we assume there is ALWAYS a
|
||||
@@ -625,7 +625,8 @@ odoo.define(
|
||||
var excluded_ids = args.splice(1, 1)[0];
|
||||
var mode = args.splice(-1, 1)[0];
|
||||
if (mode === "other") return Promise.resolve([]);
|
||||
args.splice(-1, 1); // Ignore limit
|
||||
// Ignore limit
|
||||
args.splice(-1, 1);
|
||||
var key = JSON.stringify(args);
|
||||
if (!Datas.used.mv_lines[key]) {
|
||||
throw new Error(
|
||||
@@ -668,7 +669,8 @@ odoo.define(
|
||||
},
|
||||
get_move_lines_for_manual_reconciliation: function (args) {
|
||||
var excluded_ids = args.splice(2, 1)[0];
|
||||
args.splice(-1, 1); // Ignore limit
|
||||
// Ignore limit
|
||||
args.splice(-1, 1);
|
||||
var key = JSON.stringify(args);
|
||||
if (!Datas.used.move_lines_for_manual_reconciliation[key]) {
|
||||
throw new Error(
|
||||
@@ -2426,7 +2428,7 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
"call_service",
|
||||
function (event) {
|
||||
if (
|
||||
event.data.args[1].method == "process_bank_statement_line"
|
||||
event.data.args[1].method === "process_bank_statement_line"
|
||||
) {
|
||||
assert.deepEqual(
|
||||
event.data.args[1].args,
|
||||
@@ -2672,7 +2674,7 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
[
|
||||
{
|
||||
partner_id:
|
||||
lines.length == 1
|
||||
lines.length === 1
|
||||
? lines[0].partner_id
|
||||
: false,
|
||||
counterpart_aml_dicts: [
|
||||
@@ -3655,9 +3657,12 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
assert.expect(1);
|
||||
|
||||
testUtilsMock.patch(this.params.options.context, {
|
||||
active_model: "account.journal", // On account dashboard, click "Reconcile" on a journal
|
||||
active_ids: [1, 2], // Active journals
|
||||
company_ids: [3, 4], // Active companies
|
||||
// On account dashboard, click "Reconcile" on a journal
|
||||
active_model: "account.journal",
|
||||
// Active journals
|
||||
active_ids: [1, 2],
|
||||
// Active journals
|
||||
company_ids: [3, 4],
|
||||
});
|
||||
|
||||
var clientAction = new ReconciliationClientAction.StatementAction(
|
||||
@@ -3895,7 +3900,8 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
assert.deepEqual(
|
||||
args.args,
|
||||
[
|
||||
[5], // Id of the bank statement line
|
||||
// Id of the bank statement line
|
||||
[5],
|
||||
|
||||
[
|
||||
{
|
||||
@@ -4069,7 +4075,8 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
assert.deepEqual(
|
||||
args.args,
|
||||
[
|
||||
[5], // Id of the bank statement line
|
||||
// Id of the bank statement line
|
||||
[5],
|
||||
|
||||
[
|
||||
{
|
||||
@@ -4271,7 +4278,8 @@ odoo.define("account_reconciliation_widget.reconciliation_tests", function (requ
|
||||
assert.deepEqual(
|
||||
args.args,
|
||||
[
|
||||
[5], // Id of the bank statement line
|
||||
// Id of the bank statement line
|
||||
[5],
|
||||
|
||||
[
|
||||
{
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.inherit.view.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_post']" position="before">
|
||||
<button
|
||||
name="action_bank_reconcile_bank_statements"
|
||||
string="Reconcile"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible':['|','|',('all_lines_reconciled','=',True),('line_ids','=',[]),('state', '!=', 'posted')]}"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date']" position="after">
|
||||
<field name="accounting_date" groups="base.group_no_one" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.inherit.view.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_post']" position="before">
|
||||
<button
|
||||
name="action_bank_reconcile_bank_statements"
|
||||
string="Reconcile"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible':['|','|',('all_lines_reconciled','=',True),('line_ids','=',[]),('state', '!=', 'posted')]}"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date']" position="after">
|
||||
<field name="accounting_date" groups="base.group_no_one" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -1,47 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<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="object"
|
||||
name="action_open_reconcile"
|
||||
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>
|
||||
|
||||
<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="object"
|
||||
name="action_open_reconcile"
|
||||
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>
|
||||
</t>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
<div class="col-auto text-right">
|
||||
<span>
|
||||
<t t-esc="dashboard.to_check_balance" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="action_bank_reconcile" model="ir.actions.client">
|
||||
<field name="name">Reconciliation on Bank Statements</field>
|
||||
<field name="res_model">account.bank.statement.line</field>
|
||||
<field name="tag">bank_statement_reconciliation_view</field>
|
||||
</record>
|
||||
<record id="action_bank_reconcile" model="ir.actions.client">
|
||||
<field name="name">Reconciliation on Bank Statements</field>
|
||||
<field name="res_model">account.bank.statement.line</field>
|
||||
<field name="tag">bank_statement_reconciliation_view</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_move_line_reconcile" model="ir.actions.client">
|
||||
<field name="name">Reconcile</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
<field name="binding_model_id" ref="account.model_account_move_line" />
|
||||
<field name="binding_type">action</field>
|
||||
<field name="binding_view_types">list</field>
|
||||
</record>
|
||||
<record id="action_view_account_move_line_reconcile" model="ir.actions.client">
|
||||
<field name="name">Reconcile</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
<field name="binding_model_id" ref="account.model_account_move_line" />
|
||||
<field name="binding_type">action</field>
|
||||
<field name="binding_view_types">list</field>
|
||||
</record>
|
||||
|
||||
<record id="action_manual_reconciliation" model="ir.actions.client">
|
||||
<field name="name">Reconciliation</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
</record>
|
||||
<record id="action_manual_reconciliation" model="ir.actions.client">
|
||||
<field name="name">Reconciliation</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_action_manual_reconciliation"
|
||||
parent="account.menu_finance_entries_actions"
|
||||
action="action_manual_reconciliation"
|
||||
sequence="25"
|
||||
/>
|
||||
</data>
|
||||
<menuitem
|
||||
id="menu_action_manual_reconciliation"
|
||||
parent="account.menu_finance_entries_actions"
|
||||
action="action_manual_reconciliation"
|
||||
sequence="25"
|
||||
/>
|
||||
</odoo>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="account_reconciliation_widget assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/scss"
|
||||
href="/account_reconciliation_widget/static/src/scss/account_reconciliation.scss"
|
||||
/>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_action.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_model.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_renderer.js"
|
||||
/>
|
||||
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="qunit_suite" name="account tests" inherit_id="web.qunit_suite_tests">
|
||||
<xpath expr="." position="inside">
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/account_reconciliation_widget/static/tests/account_reconciliation_tests.js"
|
||||
/>
|
||||
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user