mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
@@ -532,7 +532,14 @@ class AccountBankStatementLine(models.Model):
|
|||||||
res = (
|
res = (
|
||||||
self.env["account.reconcile.model"]
|
self.env["account.reconcile.model"]
|
||||||
.search(
|
.search(
|
||||||
[("rule_type", "in", ["invoice_matching", "writeoff_suggestion"])]
|
[
|
||||||
|
(
|
||||||
|
"rule_type",
|
||||||
|
"in",
|
||||||
|
["invoice_matching", "writeoff_suggestion"],
|
||||||
|
),
|
||||||
|
("company_id", "=", self.company_id.id),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
._apply_rules(self, self._retrieve_partner())
|
._apply_rules(self, self._retrieve_partner())
|
||||||
)
|
)
|
||||||
@@ -555,6 +562,8 @@ class AccountBankStatementLine(models.Model):
|
|||||||
)
|
)
|
||||||
amount -= sum(line.get("amount") for line in line_data)
|
amount -= sum(line.get("amount") for line in line_data)
|
||||||
data += line_data
|
data += line_data
|
||||||
|
if res.get("auto_reconcile"):
|
||||||
|
self.reconcile_bank_line()
|
||||||
return self._recompute_suspense_line(
|
return self._recompute_suspense_line(
|
||||||
data,
|
data,
|
||||||
reconcile_auxiliary_id,
|
reconcile_auxiliary_id,
|
||||||
@@ -750,6 +759,7 @@ class AccountBankStatementLine(models.Model):
|
|||||||
models = self.env["account.reconcile.model"].search(
|
models = self.env["account.reconcile.model"].search(
|
||||||
[
|
[
|
||||||
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
|
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
|
||||||
|
("company_id", "in", result.company_id.ids),
|
||||||
("auto_reconcile", "=", True),
|
("auto_reconcile", "=", True),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,3 +34,12 @@ class AccountJournal(models.Model):
|
|||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
return _("Well done! Everything has been reconciled")
|
return _("Well done! Everything has been reconciled")
|
||||||
|
|
||||||
|
def open_action(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if self.type not in ["bank", "cash"]:
|
||||||
|
return super().open_action()
|
||||||
|
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||||
|
"account_reconcile_oca.action_bank_statement_line_reconcile_all"
|
||||||
|
)
|
||||||
|
return action
|
||||||
|
|||||||
@@ -17,6 +17,16 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
|||||||
def setUpClass(cls, chart_template_ref=None):
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
cls.env = cls.env(context=cls._setup_context())
|
cls.env = cls.env(context=cls._setup_context())
|
||||||
|
# Auto-disable reconciliation model created automatically with
|
||||||
|
# generate_account_reconcile_model() to avoid side effects in tests
|
||||||
|
cls.invoice_matching_models = cls.env["account.reconcile.model"].search(
|
||||||
|
[
|
||||||
|
("rule_type", "=", "invoice_matching"),
|
||||||
|
("auto_reconcile", "=", True),
|
||||||
|
("company_id", "=", cls.company.id),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
cls.invoice_matching_models.active = False
|
||||||
|
|
||||||
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
||||||
@@ -995,6 +1005,8 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.invoice_matching_models.active = True
|
||||||
|
self.invoice_matching_models.match_text_location_label = False
|
||||||
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
bank_stmt_line = self.acc_bank_stmt_line_model.create(
|
||||||
{
|
{
|
||||||
"name": "testLine",
|
"name": "testLine",
|
||||||
|
|||||||
@@ -165,6 +165,11 @@
|
|||||||
string="Transaction Type"
|
string="Transaction Type"
|
||||||
context="{'group_by': 'transaction_type'}"
|
context="{'group_by': 'transaction_type'}"
|
||||||
/>
|
/>
|
||||||
|
<filter
|
||||||
|
name="date_groupby"
|
||||||
|
string="Date"
|
||||||
|
context="{'group_by': 'date'}"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user