%(contract)s."
),
msg=move._creation_message(),
@@ -672,8 +675,11 @@ class ContractContract(models.Model):
# Invoice by companies, so assignation emails get correct context
for company in companies:
contracts_to_invoice = contracts.filtered(
- lambda c: c.company_id == company
- and (not c.date_end or c.recurring_next_date <= c.date_end)
+ lambda contract, comp=company: contract.company_id == comp
+ and (
+ not contract.date_end
+ or contract.recurring_next_date <= contract.date_end
+ )
).with_company(company)
_recurring_create_func(contracts_to_invoice, date_ref)
return True
diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py
index 3780a59aa..40768a5c2 100644
--- a/contract/models/contract_line.py
+++ b/contract/models/contract_line.py
@@ -876,14 +876,11 @@ class ContractLine(models.Model):
if not all(self.mapped("is_cancel_allowed")):
raise ValidationError(_("Cancel not allowed for this line"))
for contract in self.mapped("contract_id"):
- lines = self.filtered(lambda l, c=contract: l.contract_id == c)
+ lines = self.filtered(lambda line, c=contract: line.contract_id == c)
msg = _(
"Contract line canceled: %s",
"
- ".join(
- [
- "
%(product)s" % {"product": name}
- for name in lines.mapped("name")
- ]
+ [f"
{name}" for name in lines.mapped("name")]
),
)
contract.message_post(body=msg)
@@ -896,14 +893,11 @@ class ContractLine(models.Model):
if not all(self.mapped("is_un_cancel_allowed")):
raise ValidationError(_("Un-cancel not allowed for this line"))
for contract in self.mapped("contract_id"):
- lines = self.filtered(lambda l, c=contract: l.contract_id == c)
+ lines = self.filtered(lambda line, c=contract: line.contract_id == c)
msg = _(
"Contract line Un-canceled: %s",
"
- ".join(
- [
- "
%(product)s" % {"product": name}
- for name in lines.mapped("name")
- ]
+ [f"
{name}" for name in lines.mapped("name")]
),
)
contract.message_post(body=msg)
diff --git a/contract/static/description/index.html b/contract/static/description/index.html
index 69be2f971..1cf89c0b9 100644
--- a/contract/static/description/index.html
+++ b/contract/static/description/index.html
@@ -1,4 +1,3 @@
-
diff --git a/contract/static/src/js/contract_portal_tour.esm.js b/contract/static/src/js/contract_portal_tour.esm.js
new file mode 100644
index 000000000..495e07e71
--- /dev/null
+++ b/contract/static/src/js/contract_portal_tour.esm.js
@@ -0,0 +1,18 @@
+/** @odoo-module **/
+
+import {registry} from "@web/core/registry";
+
+registry.category("web_tour.tours").add("contract_portal_tour", {
+ test: true,
+ url: "/my",
+ steps: () => [
+ {
+ content: "Go /my/contracts url",
+ trigger: 'a[href*="/my/contracts"]',
+ },
+ {
+ content: "Go to Contract item",
+ trigger: ".tr_contract_link:eq(0)",
+ },
+ ],
+});
diff --git a/contract/static/src/js/contract_portal_tour.js b/contract/static/src/js/contract_portal_tour.js
deleted file mode 100644
index 72bcbd1dd..000000000
--- a/contract/static/src/js/contract_portal_tour.js
+++ /dev/null
@@ -1,23 +0,0 @@
-odoo.define("contract.tour", function (require) {
- "use strict";
-
- var tour = require("web_tour.tour");
-
- tour.register(
- "contract_portal_tour",
- {
- test: true,
- url: "/my",
- },
- [
- {
- content: "Go /my/contracts url",
- trigger: 'a[href*="/my/contracts"]',
- },
- {
- content: "Go to Contract item",
- trigger: ".tr_contract_link:eq(0)",
- },
- ]
- );
-});
diff --git a/contract/static/src/js/section_and_note_fields_backend.js b/contract/static/src/js/section_and_note_fields_backend.js
deleted file mode 100644
index 3d2e25460..000000000
--- a/contract/static/src/js/section_and_note_fields_backend.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 2020 Tecnativa - Ernesto Tejeda
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- */
-/*
- If in the sub-tree view where the sections and notes are to be used
-there are fields that have defined in the XML attrs = {'invisible': ....}
-and this condition is met, then an extra space appears in the rows
-corresponding to the sections and lines.
- This js was written to deal with that problem, but a solution based on
-this can be applied directly to Odoo*/
-odoo.define("contract.section_and_note_backend", function (require) {
- "use strict";
-
- require("account.section_and_note_backend");
- var fieldRegistry = require("web.field_registry");
- var section_and_note_one2many = fieldRegistry.get("section_and_note_one2many");
-
- section_and_note_one2many.include({
- _getRenderer: function () {
- var result = this._super.apply(this, arguments);
- if (this.view.arch.tag === "tree") {
- result.include({
- _renderBodyCell: function (record) {
- var $cell = this._super.apply(this, arguments);
-
- var isSection = record.data.display_type === "line_section";
- var isNote = record.data.display_type === "line_note";
-
- if (isSection || isNote) {
- $cell.removeClass("o_invisible_modifier");
- }
- return $cell;
- },
- });
- }
- return result;
- },
- });
-});
diff --git a/contract/tests/test_contract.py b/contract/tests/test_contract.py
index 8a00501b4..b97c7266d 100644
--- a/contract/tests/test_contract.py
+++ b/contract/tests/test_contract.py
@@ -857,25 +857,15 @@ class TestContract(TestContractBase):
max_date_end,
):
return (
- "Error in case %s:"
- "date_start: %s, "
- "date_end: %s, "
- "last_date_invoiced: %s, "
- "recurring_next_date: %s, "
- "recurring_invoicing_type: %s, "
- "recurring_rule_type: %s, "
- "recurring_interval: %s, "
- "max_date_end: %s, "
- ) % (
- case,
- date_start,
- date_end,
- last_date_invoiced,
- recurring_next_date,
- recurring_invoicing_type,
- recurring_rule_type,
- recurring_interval,
- max_date_end,
+ f"Error in case {case}:"
+ f"date_start: {date_start}, "
+ f"date_end: {date_end}, "
+ f"last_date_invoiced: {last_date_invoiced}, "
+ f"recurring_next_date: {recurring_next_date}, "
+ f"recurring_invoicing_type: {recurring_invoicing_type}, "
+ f"recurring_rule_type: {recurring_rule_type}, "
+ f"recurring_interval: {recurring_interval}, "
+ f"max_date_end: {max_date_end}, "
)
Result = namedtuple(
diff --git a/contract/tests/test_multicompany.py b/contract/tests/test_multicompany.py
index 395d5d2e5..77a24a2f9 100644
--- a/contract/tests/test_multicompany.py
+++ b/contract/tests/test_multicompany.py
@@ -8,12 +8,16 @@ class ContractMulticompanyCase(TestContractBase):
@classmethod
def setUpClass(cls):
super().setUpClass()
- chart_template = cls.env.ref("l10n_generic_coa.configurable_chart_template")
cls.company_obj = cls.env["res.company"]
cls.company_1 = cls.env.ref("base.main_company")
vals = {"name": "Company 2"}
cls.company_2 = cls.company_obj.create(vals)
- chart_template.try_loading(company=cls.company_2)
+ chart_template = cls.env["account.chart.template"]._guess_chart_template(
+ cls.company_2.country_id
+ )
+ cls.env["account.chart.template"].try_loading(
+ chart_template, company=cls.company_2, install_demo=False
+ )
cls.env.user.company_ids |= cls.company_2
cls.contract_mc = (
diff --git a/contract/tests/test_portal.py b/contract/tests/test_portal.py
index f22ae9f86..50aca2abf 100644
--- a/contract/tests/test_portal.py
+++ b/contract/tests/test_portal.py
@@ -1,12 +1,12 @@
# Copyright 2020 Tecnativa - Víctor Martínez
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
-import odoo.tests
from odoo import http
+from odoo.tests import HttpCase, tagged
-@odoo.tests.tagged("post_install", "-at_install")
-class TestContractPortal(odoo.tests.HttpCase):
+@tagged("post_install", "-at_install")
+class TestContractPortal(HttpCase):
def test_tour(self):
partner = self.env["res.partner"].create({"name": "partner test contract"})
contract = self.env["contract.contract"].create(
@@ -14,12 +14,7 @@ class TestContractPortal(odoo.tests.HttpCase):
)
user_portal = self.env.ref("base.demo_user0")
contract.message_subscribe(partner_ids=user_portal.partner_id.ids)
- self.browser_js(
- "/",
- "odoo.__DEBUG__.services['web_tour.tour'].run('contract_portal_tour')",
- "odoo.__DEBUG__.services['web_tour.tour'].tours.contract_portal_tour.ready",
- login="portal",
- )
+ self.start_tour("/", "contract_portal_tour", login="portal")
# Contract access
self.authenticate("portal", "portal")
http.root.session_store.save(self.session)
diff --git a/contract/views/abstract_contract_line.xml b/contract/views/abstract_contract_line.xml
index 21bb86be6..abd0a857f 100644
--- a/contract/views/abstract_contract_line.xml
+++ b/contract/views/abstract_contract_line.xml
@@ -9,7 +9,7 @@