-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] fieldservice_account_analytic: Migration to 16.0
- Loading branch information
Juliette BLANC
committed
May 3, 2023
1 parent
b92d046
commit acd0218
Showing
5 changed files
with
45 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
fieldservice_account_analytic/migrations/15.0.1.0.0/post-migration.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,73 +9,76 @@ | |
|
||
|
||
class FSMAccountAnalyticCase(TransactionCase): | ||
def setUp(self): | ||
super(FSMAccountAnalyticCase, self).setUp() | ||
self.Wizard = self.env["fsm.wizard"] | ||
self.WorkOrder = self.env["fsm.order"] | ||
self.AccountInvoice = self.env["account.move"] | ||
self.AccountInvoiceLine = self.env["account.move.line"] | ||
@classmethod | ||
def setUpClass(cls): | ||
super(FSMAccountAnalyticCase, cls).setUpClass() | ||
cls.Wizard = cls.env["fsm.wizard"] | ||
cls.WorkOrder = cls.env["fsm.order"] | ||
cls.AccountInvoice = cls.env["account.move"] | ||
cls.AccountInvoiceLine = cls.env["account.move.line"] | ||
# create a Res Partner | ||
self.test_partner = self.env["res.partner"].create( | ||
cls.test_partner = cls.env["res.partner"].create( | ||
{"name": "Test Partner", "phone": "123", "email": "[email protected]"} | ||
) | ||
# create a Res Partner to be converted to FSM Location/Person | ||
self.test_loc_partner = self.env["res.partner"].create( | ||
cls.test_loc_partner = cls.env["res.partner"].create( | ||
{"name": "Test Loc Partner", "phone": "ABC", "email": "[email protected]"} | ||
) | ||
self.test_loc_partner2 = self.env["res.partner"].create( | ||
cls.test_loc_partner2 = cls.env["res.partner"].create( | ||
{"name": "Test Loc Partner 2", "phone": "123", "email": "[email protected]"} | ||
) | ||
# create expected FSM Location to compare to converted FSM Location | ||
self.test_location = self.env["fsm.location"].create( | ||
cls.test_location = cls.env["fsm.location"].create( | ||
{ | ||
"name": "Test Location", | ||
"phone": "123", | ||
"email": "[email protected]", | ||
"partner_id": self.test_loc_partner.id, | ||
"owner_id": self.test_loc_partner.id, | ||
"customer_id": self.test_loc_partner.id, | ||
"partner_id": cls.test_loc_partner.id, | ||
"owner_id": cls.test_loc_partner.id, | ||
"customer_id": cls.test_loc_partner.id, | ||
} | ||
) | ||
self.location = self.env["fsm.location"].create( | ||
cls.location = cls.env["fsm.location"].create( | ||
{ | ||
"name": "Location 1", | ||
"phone": "123", | ||
"email": "[email protected]", | ||
"partner_id": self.test_loc_partner.id, | ||
"owner_id": self.test_loc_partner.id, | ||
"customer_id": self.test_loc_partner.id, | ||
"partner_id": cls.test_loc_partner.id, | ||
"owner_id": cls.test_loc_partner.id, | ||
"customer_id": cls.test_loc_partner.id, | ||
} | ||
) | ||
self.test_analytic_account = self.env["account.analytic.account"].create( | ||
{"name": "test_analytic_account"} | ||
cls.test_analytic_plan = cls.env["account.analytic.plan"].create( | ||
{"name": "test_analytic_plan"} | ||
) | ||
self.test_location2 = self.env["fsm.location"].create( | ||
cls.test_analytic_account = cls.env["account.analytic.account"].create( | ||
{ | ||
"name": "test_analytic_account", | ||
"plan_id": cls.test_analytic_plan.id, | ||
} | ||
) | ||
cls.test_location2 = cls.env["fsm.location"].create( | ||
{ | ||
"name": "Test Location 2", | ||
"phone": "123", | ||
"email": "[email protected]", | ||
"partner_id": self.test_loc_partner2.id, | ||
"owner_id": self.test_loc_partner2.id, | ||
"customer_id": self.test_loc_partner2.id, | ||
"fsm_parent_id": self.test_location.id, | ||
"analytic_account_id": self.test_analytic_account.id, | ||
"partner_id": cls.test_loc_partner2.id, | ||
"owner_id": cls.test_loc_partner2.id, | ||
"customer_id": cls.test_loc_partner2.id, | ||
"fsm_parent_id": cls.test_location.id, | ||
"analytic_account_id": cls.test_analytic_account.id, | ||
} | ||
) | ||
self.default_account_revenue = self.env["account.account"].search( | ||
cls.default_account_revenue = cls.env["account.account"].search( | ||
[ | ||
("company_id", "=", self.env.user.company_id.id), | ||
( | ||
"user_type_id", | ||
"=", | ||
self.env.ref("account.data_account_type_revenue").id, | ||
), | ||
("company_id", "=", cls.env.user.company_id.id), | ||
("account_type", "=", "income"), | ||
], | ||
limit=1, | ||
) | ||
self.move_line = self.env["account.move.line"] | ||
self.analytic_line = self.env["account.analytic.line"] | ||
self.product1 = self.env["product.product"].create( | ||
cls.move_line = cls.env["account.move.line"] | ||
cls.analytic_line = cls.env["account.analytic.line"] | ||
cls.product1 = cls.env["product.product"].create( | ||
{ | ||
"name": "Product A", | ||
"detailed_type": "consu", | ||
|
@@ -149,7 +152,7 @@ def test_fsm_orders_1(self): | |
[ | ||
{ | ||
"account_id": self.default_account_revenue.id, | ||
"analytic_account_id": self.test_analytic_account.id, | ||
"analytic_distribution": {self.test_analytic_account.id: 100}, | ||
"fsm_order_ids": [(6, 0, order2.ids)], | ||
"move_id": general_move1.id, | ||
} | ||
|
@@ -159,7 +162,7 @@ def test_fsm_orders_1(self): | |
self.move_line.create( | ||
{ | ||
"account_id": self.default_account_revenue.id, | ||
"analytic_account_id": self.test_analytic_account.id, | ||
"analytic_account_id": {self.test_analytic_account.id: 100}, | ||
"fsm_order_ids": [(6, 0, order.ids)], | ||
} | ||
) | ||
|