commit
450ce568ea
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"pull_requests": {
|
||||
"orphaned_commits": "Not needed",
|
||||
"OCA/account-reconcile#500": "Not needed",
|
||||
"OCA/account-reconcile#662": "Not needed",
|
||||
"OCA/account-reconcile#702": "Already in v17",
|
||||
"OCA/account-reconcile#758": "Cherry picked features"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2024 Dixmit
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo import models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
|
@ -13,3 +14,17 @@ class AccountBankStatement(models.Model):
|
|||
)
|
||||
action["res_id"] = self.id
|
||||
return action
|
||||
|
||||
def action_open_statement_lines(self):
|
||||
"""Open in reconciling view directly"""
|
||||
self.ensure_one()
|
||||
if not self:
|
||||
return {}
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_reconcile_oca.action_bank_statement_line_reconcile"
|
||||
)
|
||||
action["domain"] = [("statement_id", "=", self.id)]
|
||||
action["context"] = safe_eval(
|
||||
action["context"], locals_dict={"active_id": self._context.get("active_id")}
|
||||
)
|
||||
return action
|
||||
|
|
|
@ -282,6 +282,46 @@ class AccountBankStatementLine(models.Model):
|
|||
!= line.get("partner_id")
|
||||
)
|
||||
|
||||
def _get_manual_delete_vals(self):
|
||||
return {
|
||||
"manual_reference": False,
|
||||
"manual_account_id": False,
|
||||
"manual_amount": False,
|
||||
"manual_exchange_counterpart": False,
|
||||
"manual_in_currency_id": False,
|
||||
"manual_in_currency": False,
|
||||
"manual_name": False,
|
||||
"manual_partner_id": False,
|
||||
"manual_line_id": False,
|
||||
"manual_move_id": False,
|
||||
"manual_move_type": False,
|
||||
"manual_kind": False,
|
||||
"manual_original_amount": False,
|
||||
"manual_currency_id": False,
|
||||
"analytic_distribution": False,
|
||||
}
|
||||
|
||||
def _process_manual_reconcile_from_line(self, line):
|
||||
self.manual_account_id = line["account_id"][0]
|
||||
self.manual_amount = line["amount"]
|
||||
self.manual_currency_id = line["currency_id"]
|
||||
self.manual_in_currency_id = line.get("line_currency_id")
|
||||
self.manual_in_currency = line.get("line_currency_id") and line[
|
||||
"currency_id"
|
||||
] != line.get("line_currency_id")
|
||||
self.manual_amount_in_currency = line.get("currency_amount")
|
||||
self.manual_name = line["name"]
|
||||
self.manual_exchange_counterpart = line.get("is_exchange_counterpart", False)
|
||||
self.manual_partner_id = line.get("partner_id") and line["partner_id"][0]
|
||||
manual_line = self.env["account.move.line"].browse(line["id"]).exists()
|
||||
self.manual_line_id = manual_line
|
||||
self.analytic_distribution = line.get("analytic_distribution", {})
|
||||
if self.manual_line_id:
|
||||
self.manual_move_id = self.manual_line_id.move_id
|
||||
self.manual_move_type = self.manual_line_id.move_id.move_type
|
||||
self.manual_kind = line["kind"]
|
||||
self.manual_original_amount = line.get("original_amount", 0.0)
|
||||
|
||||
@api.onchange("manual_reference", "manual_delete")
|
||||
def _onchange_manual_reconcile_reference(self):
|
||||
self.ensure_one()
|
||||
|
@ -302,53 +342,10 @@ class AccountBankStatementLine(models.Model):
|
|||
continue
|
||||
if line["reference"] == self.manual_reference:
|
||||
if self.manual_delete:
|
||||
self.update(
|
||||
{
|
||||
"manual_reference": False,
|
||||
"manual_account_id": False,
|
||||
"manual_amount": False,
|
||||
"manual_exchange_counterpart": False,
|
||||
"manual_in_currency_id": False,
|
||||
"manual_in_currency": False,
|
||||
"manual_name": False,
|
||||
"manual_partner_id": False,
|
||||
"manual_line_id": False,
|
||||
"manual_move_id": False,
|
||||
"manual_move_type": False,
|
||||
"manual_kind": False,
|
||||
"manual_original_amount": False,
|
||||
"manual_currency_id": False,
|
||||
"analytic_distribution": False,
|
||||
"manual_amount_in_currency": False,
|
||||
}
|
||||
)
|
||||
self.update(self._get_manual_delete_vals())
|
||||
continue
|
||||
else:
|
||||
self.manual_account_id = line["account_id"][0]
|
||||
self.manual_amount = line["amount"]
|
||||
self.manual_currency_id = line["currency_id"]
|
||||
self.manual_in_currency_id = line.get("line_currency_id")
|
||||
self.manual_in_currency = line.get("line_currency_id") and line[
|
||||
"currency_id"
|
||||
] != line.get("line_currency_id")
|
||||
self.manual_amount_in_currency = line.get("currency_amount")
|
||||
self.manual_name = line["name"]
|
||||
self.manual_exchange_counterpart = line.get(
|
||||
"is_exchange_counterpart", False
|
||||
)
|
||||
self.manual_partner_id = (
|
||||
line.get("partner_id") and line["partner_id"][0]
|
||||
)
|
||||
manual_line = (
|
||||
self.env["account.move.line"].browse(line["id"]).exists()
|
||||
)
|
||||
self.manual_line_id = manual_line
|
||||
self.analytic_distribution = line.get("analytic_distribution", {})
|
||||
if self.manual_line_id:
|
||||
self.manual_move_id = self.manual_line_id.move_id
|
||||
self.manual_move_type = self.manual_line_id.move_id.move_type
|
||||
self.manual_kind = line["kind"]
|
||||
self.manual_original_amount = line.get("original_amount", 0.0)
|
||||
self._process_manual_reconcile_from_line(line)
|
||||
new_data.append(line)
|
||||
self.update({"manual_delete": False})
|
||||
self.reconcile_data_info = self._recompute_suspense_line(
|
||||
|
@ -369,6 +366,26 @@ class AccountBankStatementLine(models.Model):
|
|||
)
|
||||
self._onchange_manual_reconcile_vals()
|
||||
|
||||
def _get_manual_reconcile_vals(self):
|
||||
return {
|
||||
"name": self.manual_name,
|
||||
"partner_id": (
|
||||
self.manual_partner_id
|
||||
and [self.manual_partner_id.id, self.manual_partner_id.display_name]
|
||||
or (self.partner_name and (False, self.partner_name))
|
||||
or False
|
||||
),
|
||||
"account_id": (
|
||||
[self.manual_account_id.id, self.manual_account_id.display_name]
|
||||
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,
|
||||
"analytic_distribution": self.analytic_distribution,
|
||||
}
|
||||
|
||||
@api.onchange(
|
||||
"manual_account_id",
|
||||
"manual_partner_id",
|
||||
|
@ -383,35 +400,11 @@ class AccountBankStatementLine(models.Model):
|
|||
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.id,
|
||||
self.manual_partner_id.display_name,
|
||||
]
|
||||
or (self.partner_name and (False, self.partner_name))
|
||||
or False,
|
||||
"account_id": [
|
||||
self.manual_account_id.id,
|
||||
self.manual_account_id.display_name,
|
||||
]
|
||||
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,
|
||||
"analytic_distribution": self.analytic_distribution,
|
||||
"kind": line["kind"]
|
||||
if line["kind"] != "suspense"
|
||||
else "other",
|
||||
}
|
||||
line_vals = self._get_manual_reconcile_vals()
|
||||
line_vals["kind"] = (
|
||||
line["kind"] if line["kind"] != "suspense" else "other"
|
||||
)
|
||||
line.update(line_vals)
|
||||
if line["kind"] == "liquidity":
|
||||
self._update_move_partner()
|
||||
if self.manual_line_id and self.manual_line_id.id == line.get(
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
opacity: 100;
|
||||
}
|
||||
}
|
||||
.row {
|
||||
// We need to add this in order to make remove horizontal scroll
|
||||
margin: 0;
|
||||
}
|
||||
margin: 0 0 0;
|
||||
min-width: fit-content;
|
||||
width: 100%;
|
||||
|
@ -36,10 +40,12 @@
|
|||
padding: 0;
|
||||
position: relative;
|
||||
border-right: 1px solid $o-gray-300;
|
||||
overflow: auto;
|
||||
}
|
||||
.o_account_reconcile_oca_info {
|
||||
width: 70%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
.o_form_view {
|
||||
.o_form_statusbar.o_account_reconcile_oca_statusbar {
|
||||
|
|
|
@ -31,7 +31,22 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_statement_base.view_bank_statement_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
expr="//button[contains(@context,'search_default_statement_id')]"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="type">object</attribute>
|
||||
<attribute name="name">action_open_statement_lines</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="account_bank_statement_action_edit" model="ir.actions.act_window">
|
||||
<field name="name">Edit Bank Statement</field>
|
||||
<field name="res_model">account.bank.statement</field>
|
||||
|
|
Loading…
Reference in New Issue