mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[UPD] missing dependency and increase unit test coverage
This commit is contained in:
@@ -7,5 +7,5 @@
|
|||||||
"website": "https://github.com/OCA/bank-statement-import",
|
"website": "https://github.com/OCA/bank-statement-import",
|
||||||
"author": "Therp BV, Odoo Community Association (OCA)",
|
"author": "Therp BV, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": ["account_bank_statement_import"],
|
"depends": ["account_bank_statement_import", "sale"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,20 @@ class TestAccountBankStatementImportGuessPartner(common.SavepointCase):
|
|||||||
transaction = self._get_completed_transaction()
|
transaction = self._get_completed_transaction()
|
||||||
self.assertNotIn("partner_id", transaction)
|
self.assertNotIn("partner_id", transaction)
|
||||||
|
|
||||||
|
def test_sale_order_name(self):
|
||||||
|
"""Test sale_order.name = transaction["ref"]."""
|
||||||
|
self._create_sale_order("name", REF)
|
||||||
|
transaction = self._get_completed_transaction()
|
||||||
|
self.assertIn("partner_id", transaction)
|
||||||
|
self.assertEqual(transaction["partner_id"], self.partner.id)
|
||||||
|
|
||||||
|
def test_sale_order_client_order_ref(self):
|
||||||
|
"""Test sale_order.client_order_ref = transaction["ref"]."""
|
||||||
|
self._create_sale_order("client_order_ref", REF)
|
||||||
|
transaction = self._get_completed_transaction()
|
||||||
|
self.assertIn("partner_id", transaction)
|
||||||
|
self.assertEqual(transaction["partner_id"], self.partner.id)
|
||||||
|
|
||||||
def _get_completed_transaction(self):
|
def _get_completed_transaction(self):
|
||||||
"""Complete statements and return first transaction in first statement."""
|
"""Complete statements and return first transaction in first statement."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
@@ -107,3 +121,8 @@ class TestAccountBankStatementImportGuessPartner(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
invoice[ref_field] = ref_value # Might also override name.
|
invoice[ref_field] = ref_value # Might also override name.
|
||||||
invoice.post()
|
invoice.post()
|
||||||
|
|
||||||
|
def _create_sale_order(self, ref_field, ref_value):
|
||||||
|
"""Create a sale order with some reference information."""
|
||||||
|
sale_order = self.env["sale.order"].create({"partner_id": self.partner.id})
|
||||||
|
sale_order[ref_field] = ref_value # Might also override name.
|
||||||
|
|||||||
Reference in New Issue
Block a user