Skip to content
Snippets Groups Projects

Draft: Port to Odoo 16.

Closed Etienne Ferriere requested to merge topic/13.0/MO16-236 into branch/13.0
Compare and Show latest version
1 file
+ 37
27
Compare changes
  • Side-by-side
  • Inline
+ 37
27
@@ -47,8 +47,8 @@
)
self.assertTrue(self.pay_journal)
self.debit_account = self._createAccount("receivable")
self.credit_account = self._createAccount("other")
self.debit_account = self._createAccount("asset_receivable")
self.credit_account = self._createAccount("income_other")
self.product = self.env.ref("product.product_product_1")
@@ -156,6 +156,5 @@
return self.env["account.account"].create(
{
"code": uuid.uuid4().hex[:8],
"internal_type": account_type,
"name": uuid.uuid4().hex,
"reconcile": True,
@@ -160,10 +159,6 @@
"name": uuid.uuid4().hex,
"reconcile": True,
"user_type_id": (
self.env["account.account.type"]
.search([("type", "=", account_type)], limit=1)
.id
),
"account_type": account_type,
}
)
@@ -307,13 +302,13 @@
:rtype: Odoo "account.period" record.
"""
# Create an account.fiscalyear
a_fiscalyear = self.env["account.fiscalyear"].create(
{
"name": "Fiscal Year X " + time.strftime("%Y"),
"code": "FY" + time.strftime("%Y"),
"company_id": self.env.ref("base.main_company").id,
"date_stop": time.strftime("%Y") + "-12-31",
}
fiscalyear = self.env["account.fiscal.year"].search(
[
("date_from", "=", time.strftime("%Y") + "-01-01"),
("date_to", "=", time.strftime("%Y") + "-12-31"),
("company_id", "=", self.env.ref("base.main_company").id),
],
limit=1,
)
@@ -318,15 +313,30 @@
)
# Create an account.period
a_period = self.env["account.period"].create(
{
"code": "FY" + time.strftime("%Y"),
"name": "Fiscal Year X " + time.strftime("%Y"),
"fiscalyear_id": a_fiscalyear.id,
"date_start": time.strftime("%Y") + "-01-01",
"date_stop": time.strftime("%Y") + "-12-31",
"company_id": self.env.ref("base.main_company").id,
}
)
if not fiscalyear:
# Create an account.fiscal.year
a_fiscalyear = self.env["account.fiscal.year"].create(
{
"name": "Fiscal Year X " + time.strftime("%Y"),
"company_id": self.env.ref("base.main_company").id,
"date_from": time.strftime("%Y") + "-01-01",
"date_to": time.strftime("%Y") + "-12-31",
}
)
# Create an account.period
a_period = self.env["account.period"].create(
{
"code": "FY" + time.strftime("%Y"),
"name": "Fiscal Year X " + time.strftime("%Y"),
"fiscalyear_id": a_fiscalyear.id,
"date_start": time.strftime("%Y") + "-01-01",
"date_stop": time.strftime("%Y") + "-12-31",
"company_id": self.env.ref("base.main_company").id,
}
)
else:
a_period = fiscalyear.period_ids[0]
return a_period
Loading