diff --git a/easy_my_coop/tests/test_base.py b/easy_my_coop/tests/test_base.py index 930f23e..b4c4472 100644 --- a/easy_my_coop/tests/test_base.py +++ b/easy_my_coop/tests/test_base.py @@ -6,6 +6,13 @@ import odoo.tests.common as common class EMCBaseCase(common.TransactionCase): + def setUp(self): + super(EMCBaseCase, self).setUp() + # todo set from demo data + user = self.env["res.users"].browse(self.uid) + cooperator_account = self.ref("easy_my_coop.account_cooperator_demo") + user.company_id.property_cooperator_account = cooperator_account + def as_user(self): self.uid = self.ref("base.user_demo") diff --git a/easy_my_coop/tests/test_emc.py b/easy_my_coop/tests/test_emc.py index d3b88a5..5fd5294 100644 --- a/easy_my_coop/tests/test_emc.py +++ b/easy_my_coop/tests/test_emc.py @@ -84,7 +84,7 @@ class EMCCase(EMCBaseCase): "date": Date.today(), "source": "manual", "ordered_parts": 3, - "share_product_id": self.ref( + "share_product_id": self.browse_ref( "easy_my_coop.product_template_share_type_2_demo" ).product_variant_id.id, "lang": "en_US", diff --git a/easy_my_coop_loan/demo/coop.xml b/easy_my_coop_loan/demo/coop.xml index 57452f2..ecd808c 100644 --- a/easy_my_coop_loan/demo/coop.xml +++ b/easy_my_coop_loan/demo/coop.xml @@ -7,7 +7,6 @@ test loan issue - @@ -17,8 +16,7 @@ 100 4000 10000 - 1000 - yearly + end diff --git a/easy_my_coop_loan/models/loan.py b/easy_my_coop_loan/models/loan.py index fb5b42b..ef7b3a7 100644 --- a/easy_my_coop_loan/models/loan.py +++ b/easy_my_coop_loan/models/loan.py @@ -1,6 +1,6 @@ import logging -from odoo import api, fields, models +from odoo import api, fields, models, _ _logger = logging.getLogger(__name__) diff --git a/easy_my_coop_loan/tests/test_emc_loan.py b/easy_my_coop_loan/tests/test_emc_loan.py index 5f18f66..6d4f089 100644 --- a/easy_my_coop_loan/tests/test_emc_loan.py +++ b/easy_my_coop_loan/tests/test_emc_loan.py @@ -14,7 +14,6 @@ class EMCLoanCase(EMCBaseCase): loan_issue_values = { "name": "test loan issue", "is_bond": False, - "is_loan": True, "default_issue": "xx", "subscription_start_date": Date.today(), "subscription_end_date": Date.today() + timedelta(days=60), @@ -24,8 +23,7 @@ class EMCLoanCase(EMCBaseCase): "face_value": 100, "minimum_amount": 4000, "maximum_amount": 10, # ? - "maximum_amount_per_sub": 1000, - "interest_payment": "yearly", + "interest_payment": "end", "by_company": True, "by_individual": True, "display_on_website": True, @@ -40,13 +38,12 @@ class EMCLoanCase(EMCBaseCase): loan_issue.action_draft() loan_issue.action_open() - def test_emc_user_cannot_manager_loan_issue(self): + def test_emc_user_cannot_manage_loan_issue(self): self.as_emc_user() loan_issue_values = { "name": "test loan issue", "is_bond": False, - "is_loan": True, "default_issue": True, "user_id": self.ref("easy_my_coop.res_users_manager_emc_demo"), "subscription_start_date": Date.today(), @@ -56,8 +53,7 @@ class EMCLoanCase(EMCBaseCase): "face_value": 100, "minimum_amount": 2000, "maximum_amount": 10000, # ? - "maximum_amount_per_sub": 1000, - "interest_payment": "yearly", + "interest_payment": "end", "by_company": True, "by_individual": True, "display_on_website": True,