diff --git a/account_cutoff_base/README.rst b/account_cutoff_base/README.rst
index 5020f50219d..c524bd76a87 100644
--- a/account_cutoff_base/README.rst
+++ b/account_cutoff_base/README.rst
@@ -17,13 +17,13 @@ Account Cut-off Base
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--closing-lightgray.png?logo=github
- :target: https://github.com/OCA/account-closing/tree/17.0/account_cutoff_base
+ :target: https://github.com/OCA/account-closing/tree/18.0/account_cutoff_base
:alt: OCA/account-closing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/account-closing-17-0/account-closing-17-0-account_cutoff_base
+ :target: https://translation.odoo-community.org/projects/account-closing-18-0/account-closing-18-0-account_cutoff_base
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
- :target: https://runboat.odoo-community.org/builds?repo=OCA/account-closing&target_branch=17.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/account-closing&target_branch=18.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -129,6 +129,6 @@ Current `maintainer `__:
|maintainer-alexis-via|
-This module is part of the `OCA/account-closing `_ project on GitHub.
+This module is part of the `OCA/account-closing `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_cutoff_base/__manifest__.py b/account_cutoff_base/__manifest__.py
index 05db1e199a6..f7d27dd0926 100644
--- a/account_cutoff_base/__manifest__.py
+++ b/account_cutoff_base/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Account Cut-off Base",
- "version": "17.0.1.1.0",
+ "version": "18.0.1.0.0",
"category": "Accounting & Finance",
"summary": "Base module for Account Cut-offs",
"author": "Akretion,Odoo Community Association (OCA)",
diff --git a/account_cutoff_base/models/account_cutoff.py b/account_cutoff_base/models/account_cutoff.py
index b33526f0d7f..63c114c3fc8 100644
--- a/account_cutoff_base/models/account_cutoff.py
+++ b/account_cutoff_base/models/account_cutoff.py
@@ -7,8 +7,8 @@
from dateutil.relativedelta import relativedelta
-from odoo import _, api, fields, models
-from odoo.exceptions import UserError
+from odoo import api, fields, models
+from odoo.exceptions import UserError, ValidationError
from odoo.tools import date_utils, float_is_zero
from odoo.tools.misc import format_date
@@ -35,10 +35,10 @@ def _compute_total_cutoff(self):
@property
def cutoff_type_label_map(self):
return {
- "accrued_expense": _("Accrued Expense"),
- "accrued_revenue": _("Accrued Revenue"),
- "prepaid_revenue": _("Prepaid Revenue"),
- "prepaid_expense": _("Prepaid Expense"),
+ "accrued_expense": self.env._("Accrued Expense"),
+ "accrued_revenue": self.env._("Accrued Revenue"),
+ "prepaid_revenue": self.env._("Prepaid Revenue"),
+ "prepaid_expense": self.env._("Prepaid Expense"),
}
@api.model
@@ -118,7 +118,7 @@ def _default_cutoff_account_id(self):
cutoff_account_id = fields.Many2one(
comodel_name="account.account",
string="Cut-off Account",
- domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
+ domain="[('deprecated', '=', False)]",
default=lambda self: self._default_cutoff_account_id(),
check_company=True,
tracking=True,
@@ -162,13 +162,25 @@ def _default_cutoff_account_id(self):
"the state is set to 'Done' and the fields become read-only.",
)
- _sql_constraints = [
- (
- "date_type_company_uniq",
- "unique(cutoff_date, company_id, cutoff_type)",
- _("A cutoff of the same type already exists with this cut-off date !"),
- )
- ]
+ @api.constrains("cutoff_date", "company_ids", "cutoff_type")
+ def _check_unique_cutoff(self):
+ for record in self:
+ existing = self.search(
+ [
+ ("id", "!=", record.id),
+ ("cutoff_date", "=", record.cutoff_date),
+ ("company_ids", "in", record.company_id.id),
+ ("cutoff_type", "=", record.cutoff_type),
+ ],
+ limit=1,
+ )
+ if existing:
+ raise ValidationError(
+ record.env._(
+ "A cutoff of the same type already exists "
+ "with this cut-off date!"
+ )
+ )
def _compute_display_name(self):
type2label = self.cutoff_type_label_map
@@ -292,14 +304,14 @@ def create_move(self):
move_obj = self.env["account.move"]
if self.move_id:
raise UserError(
- _(
+ self.env._(
"The Cut-off Journal Entry already exists. You should "
"delete it before running this function."
)
)
if not self.line_ids:
raise UserError(
- _(
+ self.env._(
"There are no lines on this Cut-off, so we can't create "
"a Journal Entry."
)
@@ -315,12 +327,12 @@ def create_move(self):
if self.company_id.post_cutoff_move:
move._post(soft=False)
self.write({"move_id": move.id, "state": "done"})
- self.message_post(body=_("Journal entry generated"))
+ self.message_post(body=self.env._("Journal entry generated"))
action = self.env.ref("account.action_move_journal_line").sudo().read()[0]
action.update(
{
- "view_mode": "form,tree",
+ "view_mode": "form,list",
"res_id": move.id,
"view_id": False,
"views": False,
@@ -336,20 +348,22 @@ def get_lines(self):
# (e.g. account_cutoff_start_end_dates) add additional states
# and don't require self.cutoff_date
if self.state == "draft" and not self.cutoff_date:
- raise UserError(_("Cutoff date is not set."))
+ raise UserError(self.env._("Cutoff date is not set."))
# Delete existing lines
self.line_ids.unlink()
- self.message_post(body=_("Cut-off lines re-generated"))
+ self.message_post(body=self.env._("Cut-off lines re-generated"))
def unlink(self):
for rec in self:
if rec.state == "done":
raise UserError(
- _("You cannot delete cutoff records that are in done state.")
+ self.env._(
+ "You cannot delete cutoff records that are in done state."
+ )
)
return super().unlink()
- def button_line_tree(self):
+ def button_line_list(self):
action = self.env["ir.actions.actions"]._for_xml_id(
"account_cutoff_base.account_cutoff_line_action"
)
@@ -394,17 +408,17 @@ def _prepare_tax_lines(self, tax_compute_all_res, currency):
tax.account_accrued_expense_id
or self.company_id.default_accrued_expense_tax_account_id
)
- tax_account_field_label = _("Accrued Expense Tax Account")
+ tax_account_field_label = self.env._("Accrued Expense Tax Account")
elif self.cutoff_type == "accrued_revenue":
tax_accrual_account = (
tax.account_accrued_revenue_id
or self.company_id.default_accrued_revenue_tax_account_id
)
- tax_account_field_label = _("Accrued Revenue Tax Account")
+ tax_account_field_label = self.env._("Accrued Revenue Tax Account")
if not tax_accrual_account:
raise UserError(
- _(
+ self.env._(
"Missing '%(tax_account_field_label)s'. You must configure it "
"on the tax '%(tax_display_name)s' or on the accounting "
"configuration page of the company '%(company)s'.",
diff --git a/account_cutoff_base/models/account_cutoff_mapping.py b/account_cutoff_base/models/account_cutoff_mapping.py
index 7fc8b6f426c..709eb3f4b61 100644
--- a/account_cutoff_base/models/account_cutoff_mapping.py
+++ b/account_cutoff_base/models/account_cutoff_mapping.py
@@ -20,14 +20,14 @@ class AccountCutoffMapping(models.Model):
account_id = fields.Many2one(
"account.account",
string="Regular Account",
- domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
+ domain="[('deprecated', '=', False)]",
required=True,
check_company=True,
)
cutoff_account_id = fields.Many2one(
"account.account",
string="Cut-off Account",
- domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
+ domain="[('deprecated', '=', False)]",
required=True,
check_company=True,
)
diff --git a/account_cutoff_base/models/account_tax.py b/account_cutoff_base/models/account_tax.py
index cc9efba2000..64fdb9c47cd 100644
--- a/account_cutoff_base/models/account_tax.py
+++ b/account_cutoff_base/models/account_tax.py
@@ -12,12 +12,12 @@ class AccountTax(models.Model):
account_accrued_revenue_id = fields.Many2one(
comodel_name="account.account",
string="Accrued Revenue Tax Account",
- domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
+ domain="[('deprecated', '=', False)]",
check_company=True,
)
account_accrued_expense_id = fields.Many2one(
comodel_name="account.account",
string="Accrued Expense Tax Account",
- domain="[('deprecated', '=', False), ('company_id', '=', company_id)]",
+ domain="[('deprecated', '=', False)]",
check_company=True,
)
diff --git a/account_cutoff_base/static/description/index.html b/account_cutoff_base/static/description/index.html
index 3b3f56fe729..5f7a6d49274 100644
--- a/account_cutoff_base/static/description/index.html
+++ b/account_cutoff_base/static/description/index.html
@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }
-pre.code .ln { color: grey; } /* line numbers */
+pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
span.pre {
white-space: pre }
-span.problematic {
+span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -368,7 +369,7 @@ Account Cut-off Base
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c91fa0d8a0b963e99f75960f254698491d21ad27e7073b99dd7676e8c158e912
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module contains the technical basis for other cut-off modules ; it
doesn’t provide useful features by itself. You need to install other
cut-off modules to get the useful features:
@@ -416,7 +417,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -452,13 +453,15 @@
This module is maintained by the OCA.
-
+
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
Current maintainer:
-
This module is part of the OCA/account-closing project on GitHub.
+
This module is part of the OCA/account-closing project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_cutoff_base/tests/test_account_cutoff.py b/account_cutoff_base/tests/test_account_cutoff.py
index 95cd8cd4cb9..930840dfd6c 100644
--- a/account_cutoff_base/tests/test_account_cutoff.py
+++ b/account_cutoff_base/tests/test_account_cutoff.py
@@ -10,7 +10,7 @@ def test_default_cutoff_account_id(self):
company = self.env.company
random_account = self.env["account.account"].search(
- [("company_id", "=", company.id)], limit=1
+ [("company_ids", "in", company.id)], limit=1
)
if random_account:
company.default_accrued_expense_account_id = random_account.id
diff --git a/account_cutoff_base/views/account_cutoff.xml b/account_cutoff_base/views/account_cutoff.xml
index c045589dfe9..c56bf94f8e8 100644
--- a/account_cutoff_base/views/account_cutoff.xml
+++ b/account_cutoff_base/views/account_cutoff.xml
@@ -44,7 +44,7 @@