mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MIG] account_in_payment: Migration to 14.0
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
"name": "Account In Payment",
|
||||
"summary": """
|
||||
This module enables in-payment mode for your accounting""",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Dixmit,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-reconcile",
|
||||
"depends": ["account_reconcile_oca"],
|
||||
"depends": ["account"],
|
||||
"data": [],
|
||||
"demo": [],
|
||||
}
|
||||
|
||||
@@ -26,37 +26,13 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||
)
|
||||
cls.current_assets_account = cls.env["account.account"].search(
|
||||
[
|
||||
("account_type", "=", "asset_current"),
|
||||
("internal_type", "=", "other"),
|
||||
("internal_group", "=", "asset"),
|
||||
("company_id", "=", cls.company.id),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
cls.current_assets_account.reconcile = True
|
||||
# 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_payment(self):
|
||||
inv1 = self.create_invoice(
|
||||
@@ -79,21 +55,23 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||
"statement_id": bank_stmt.id,
|
||||
"amount": -100,
|
||||
"date": time.strftime("%Y-07-15"),
|
||||
"payment_ref": "Test Payment Ref",
|
||||
}
|
||||
)
|
||||
receivable1 = inv1.line_ids.filtered(
|
||||
lambda line: line.account_id.account_type == "liability_payable"
|
||||
payable1 = inv1.line_ids.filtered(
|
||||
lambda line: line.account_id.internal_type == "payable"
|
||||
)
|
||||
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)
|
||||
self.assertEqual(inv1.amount_residual_signed, -100)
|
||||
bank_stmt_line.reconcile_bank_line()
|
||||
bank_stmt_line.process_reconciliation(
|
||||
[
|
||||
{
|
||||
"move_line": payable1,
|
||||
"debit": abs(bank_stmt_line.amount),
|
||||
"credit": 0.0,
|
||||
"currency_id": bank_stmt_line.currency_id.id,
|
||||
}
|
||||
]
|
||||
)
|
||||
self.assertEqual(inv1.payment_state, "paid")
|
||||
|
||||
def test_in_payment(self):
|
||||
@@ -108,7 +86,7 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||
mail_create_nolog=True, **action["context"]
|
||||
)
|
||||
)
|
||||
payments = form.save()._create_payments()
|
||||
payments = form.save().action_create_payments()
|
||||
self.assertEqual(inv1.payment_state, "in_payment")
|
||||
bank_stmt = self.acc_bank_stmt_model.create(
|
||||
{
|
||||
@@ -125,21 +103,25 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||
"statement_id": bank_stmt.id,
|
||||
"amount": -100,
|
||||
"date": time.strftime("%Y-07-15"),
|
||||
"payment_ref": "Test Payment Ref",
|
||||
}
|
||||
)
|
||||
receivable1 = payments.line_ids.filtered(lambda line: not line.reconciled)
|
||||
self.assertEqual(inv1.amount_residual_signed, 0)
|
||||
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)
|
||||
payment_records = self.env["account.payment"].browse(payments["res_id"])
|
||||
receivable1 = payment_records.line_ids.filtered(
|
||||
lambda line: not line.reconciled
|
||||
)
|
||||
self.assertEqual(inv1.amount_residual_signed, 0)
|
||||
self.assertFalse(receivable1.reconciled)
|
||||
bank_stmt_line.reconcile_bank_line()
|
||||
bank_stmt_line.process_reconciliation(
|
||||
[
|
||||
{
|
||||
"move_line": receivable1,
|
||||
"debit": abs(bank_stmt_line.amount),
|
||||
"credit": 0.0,
|
||||
"currency_id": bank_stmt_line.currency_id.id,
|
||||
}
|
||||
]
|
||||
)
|
||||
self.assertEqual(inv1.payment_state, "paid")
|
||||
self.assertEqual(inv1.amount_residual_signed, 0)
|
||||
self.assertTrue(receivable1.reconciled)
|
||||
|
||||
Reference in New Issue
Block a user