diff --git a/product_template_multi_link_date_span/README.rst b/product_template_multi_link_date_span/README.rst new file mode 100644 index 0000000000..9eabd99a6a --- /dev/null +++ b/product_template_multi_link_date_span/README.rst @@ -0,0 +1,94 @@ +====================================== +Product Template Multi Link With Dates +====================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9c0ab48c12c28ef8261692135cc20aff2d8b7a9082fb993027d6252a67d55dac + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/18.0/product_template_multi_link_date_span + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-product_template_multi_link_date_span + :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/e-commerce&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the possibility to set a start and end date on the +links. So links can be activated only for a certain period of time. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- Thierry Ducrest + +- Trobz + + - Dung Tran + - Thien Vo + +- Simone Orsi + +Other credits +------------- + +The development of this module has been financially supported by: + +- Camptocamp + +The migration of this module from 14.0 to 18.0 was financially supported +by Camptocamp. + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_template_multi_link_date_span/__init__.py b/product_template_multi_link_date_span/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/product_template_multi_link_date_span/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_template_multi_link_date_span/__manifest__.py b/product_template_multi_link_date_span/__manifest__.py new file mode 100644 index 0000000000..9a681d4d94 --- /dev/null +++ b/product_template_multi_link_date_span/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{ + "name": "Product Template Multi Link With Dates", + "summary": "Add an optional date span for when a link is active.", + "version": "18.0.1.0.0", + "category": "Sale", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["product_template_multi_link"], + "website": "https://github.com/OCA/e-commerce", + "data": [ + "views/product_template_link_view.xml", + "views/product_template_link_type_view.xml", + ], + "installable": True, +} diff --git a/product_template_multi_link_date_span/i18n/es.po b/product_template_multi_link_date_span/i18n/es.po new file mode 100644 index 0000000000..98a4e6d2a2 --- /dev/null +++ b/product_template_multi_link_date_span/i18n/es.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_template_multi_link_date_span +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-18 17:34+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_template_multi_link_date_span +#: code:addons/product_template_multi_link_date_span/models/product_template_link.py:0 +#, python-format +msgid "A start date is required according to link type: %s" +msgstr "Se requiere una fecha de inicio según el tipo de enlace: %s" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__display_name +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_end +msgid "End Date" +msgstr "Fecha Finalización" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__id +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__id +msgid "ID" +msgstr "ID" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link____last_update +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Limited By Dates" +msgstr "Limitado Por Fechas" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Links of this type will have a limited life based on start/end dates." +msgstr "" +"Los enlaces de este tipo tendrán una vida limitada según las fechas de " +"inicio / finalización." + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "Mandatory Date Start" +msgstr "Fecha de Inicio Obligatoria" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link_type +msgid "Product Template Link Type" +msgstr "Tipo de Enlace de Plantilla de Producto" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link +msgid "Product link" +msgstr "Enlace de producto" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_start +msgid "Start Date" +msgstr "Fecha de Inicio" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "When limited by dates, make date start required." +msgstr "" +"Cuando esté limitado por fechas, haga que la fecha de inicio sea obligatoria." diff --git a/product_template_multi_link_date_span/i18n/es_AR.po b/product_template_multi_link_date_span/i18n/es_AR.po new file mode 100644 index 0000000000..779d508f0d --- /dev/null +++ b/product_template_multi_link_date_span/i18n/es_AR.po @@ -0,0 +1,89 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_template_multi_link_date_span +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-09-11 19:33+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: product_template_multi_link_date_span +#: code:addons/product_template_multi_link_date_span/models/product_template_link.py:0 +#, python-format +msgid "A start date is required according to link type: %s" +msgstr "Una fecha de inicio es requerida de acuerdo al tipo de enlace: %s" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__display_name +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_end +msgid "End Date" +msgstr "Fecha de Finalización" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__id +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__id +msgid "ID" +msgstr "ID" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link____last_update +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Limited By Dates" +msgstr "Limitado Por Fechas" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Links of this type will have a limited life based on start/end dates." +msgstr "" +"Los enlaces de este tipo tendrán una vida limitada según las fechas de " +"inicio/finalización." + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "Mandatory Date Start" +msgstr "Fecha de Inicio Obligatoria" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link_type +msgid "Product Template Link Type" +msgstr "Tipo de Enlace de Plantilla de Producto" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link +msgid "Product link" +msgstr "Enlace de producto" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_start +msgid "Start Date" +msgstr "Fecha de Inicio" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "When limited by dates, make date start required." +msgstr "" +"Cuando se encuentra limitado por fechas, haga que la fecha de inicio sea " +"obligatoria." diff --git a/product_template_multi_link_date_span/i18n/product_template_multi_link_date_span.pot b/product_template_multi_link_date_span/i18n/product_template_multi_link_date_span.pot new file mode 100644 index 0000000000..e2cf8e4a72 --- /dev/null +++ b/product_template_multi_link_date_span/i18n/product_template_multi_link_date_span.pot @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_template_multi_link_date_span +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_template_multi_link_date_span +#: code:addons/product_template_multi_link_date_span/models/product_template_link.py:0 +#, python-format +msgid "A start date is required according to link type: %s" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__display_name +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__display_name +msgid "Display Name" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_end +msgid "End Date" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__id +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__id +msgid "ID" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link____last_update +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type____last_update +msgid "Last Modified on" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Limited By Dates" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__limited_by_dates +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__limited_by_dates +msgid "Links of this type will have a limited life based on start/end dates." +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "Mandatory Date Start" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link_type +msgid "Product Template Link Type" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model,name:product_template_multi_link_date_span.model_product_template_link +msgid "Product link" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,field_description:product_template_multi_link_date_span.field_product_template_link__date_start +msgid "Start Date" +msgstr "" + +#. module: product_template_multi_link_date_span +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link__mandatory_date_start +#: model:ir.model.fields,help:product_template_multi_link_date_span.field_product_template_link_type__mandatory_date_start +msgid "When limited by dates, make date start required." +msgstr "" diff --git a/product_template_multi_link_date_span/models/__init__.py b/product_template_multi_link_date_span/models/__init__.py new file mode 100644 index 0000000000..59768f7427 --- /dev/null +++ b/product_template_multi_link_date_span/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template_link_type +from . import product_template_link diff --git a/product_template_multi_link_date_span/models/product_template_link.py b/product_template_multi_link_date_span/models/product_template_link.py new file mode 100644 index 0000000000..a07490573f --- /dev/null +++ b/product_template_multi_link_date_span/models/product_template_link.py @@ -0,0 +1,37 @@ +# Copyright 2020 Camptocamp SA (http://www.camptocamp.com) +# @author Thierry Ducrest +# @author Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, exceptions, fields, models + + +class ProductTemplateLink(models.Model): + _inherit = "product.template.link" + + date_start = fields.Date("Start Date") + date_end = fields.Date("End Date") + limited_by_dates = fields.Boolean(related="type_id.limited_by_dates") + mandatory_date_start = fields.Boolean(related="type_id.mandatory_date_start") + + @api.depends("date_start", "date_end", "type_id.limited_by_dates") + def _compute_is_link_active(self): + res = super()._compute_is_link_active() + today = fields.Date.today() + for record in self: + if record.limited_by_dates: + record.is_link_active = ( + (record.date_start or today) <= today <= (record.date_end or today) + ) + return res + + @api.constrains("type_id", "date_start") + def _check_mandatory_date_start(self): + for rec in self: + if rec.mandatory_date_start and not rec.date_start: + raise exceptions.UserError( + self.env._( + "A start date is required according to link type: %s", + rec.type_id.name, + ) + ) diff --git a/product_template_multi_link_date_span/models/product_template_link_type.py b/product_template_multi_link_date_span/models/product_template_link_type.py new file mode 100644 index 0000000000..ebb5df8ed4 --- /dev/null +++ b/product_template_multi_link_date_span/models/product_template_link_type.py @@ -0,0 +1,16 @@ +# Copyright 2021 Camptocamp SA (http://www.camptocamp.com) +# @author Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplateLinkType(models.Model): + _inherit = "product.template.link.type" + + limited_by_dates = fields.Boolean( + help="Links of this type will have a limited life based on start/end dates." + ) + mandatory_date_start = fields.Boolean( + help="When limited by dates, make date start required." + ) diff --git a/product_template_multi_link_date_span/pyproject.toml b/product_template_multi_link_date_span/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/product_template_multi_link_date_span/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_template_multi_link_date_span/readme/CONTRIBUTORS.md b/product_template_multi_link_date_span/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..8483d38020 --- /dev/null +++ b/product_template_multi_link_date_span/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Thierry Ducrest \<\> + +- Trobz + - Dung Tran \<\> + - Thien Vo \<\> + +- Simone Orsi \<\> diff --git a/product_template_multi_link_date_span/readme/CREDITS.md b/product_template_multi_link_date_span/readme/CREDITS.md new file mode 100644 index 0000000000..102074537c --- /dev/null +++ b/product_template_multi_link_date_span/readme/CREDITS.md @@ -0,0 +1,5 @@ +The development of this module has been financially supported by: + +- Camptocamp + +The migration of this module from 14.0 to 18.0 was financially supported by Camptocamp. diff --git a/product_template_multi_link_date_span/readme/DESCRIPTION.md b/product_template_multi_link_date_span/readme/DESCRIPTION.md new file mode 100644 index 0000000000..52b3d4e913 --- /dev/null +++ b/product_template_multi_link_date_span/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds the possibility to set a start and end date on the +links. So links can be activated only for a certain period of time. diff --git a/product_template_multi_link_date_span/static/description/icon.png b/product_template_multi_link_date_span/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/product_template_multi_link_date_span/static/description/icon.png differ diff --git a/product_template_multi_link_date_span/static/description/index.html b/product_template_multi_link_date_span/static/description/index.html new file mode 100644 index 0000000000..d3802618ca --- /dev/null +++ b/product_template_multi_link_date_span/static/description/index.html @@ -0,0 +1,440 @@ + + + + + +Product Template Multi Link With Dates + + + + + + diff --git a/product_template_multi_link_date_span/tests/__init__.py b/product_template_multi_link_date_span/tests/__init__.py new file mode 100644 index 0000000000..4e4f06d874 --- /dev/null +++ b/product_template_multi_link_date_span/tests/__init__.py @@ -0,0 +1 @@ +from . import test_product_template_link_date_span diff --git a/product_template_multi_link_date_span/tests/test_product_template_link_date_span.py b/product_template_multi_link_date_span/tests/test_product_template_link_date_span.py new file mode 100644 index 0000000000..2058aaedbc --- /dev/null +++ b/product_template_multi_link_date_span/tests/test_product_template_link_date_span.py @@ -0,0 +1,64 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from freezegun import freeze_time + +from odoo import exceptions +from odoo.tests.common import TransactionCase + + +@freeze_time("2020-07-29") +class TestProductTemplateLinkDateSpan(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.link_type = cls.env["product.template.link.type"].get_by_code( + "cross-selling" + ) + cls.link_type.limited_by_dates = True + cls.prod1 = prod1 = cls.env.ref("product.product_product_1") + cls.prod2 = prod2 = cls.env.ref("product.product_product_2") + cls.link = cls.env["product.template.link"].create( + { + "left_product_tmpl_id": prod1.id, + "right_product_tmpl_id": prod2.id, + "type_id": cls.link_type.id, + } + ) + + def test_active_link(self): + self.assertTrue(self.link.is_link_active) + self.link.date_start = "2020-07-29" + self.assertTrue(self.link.is_link_active) + self.link.date_start = "2020-01-29" + self.link.date_end = "2020-12-31" + self.assertTrue(self.link.is_link_active) + self.link.date_start = "" + self.assertTrue(self.link.is_link_active) + + def test_inactive_link(self): + self.link.date_start = "2021-01-01" + self.assertFalse(self.link.is_link_active) + self.link.date_start = "2020-01-01" + self.link.date_end = "2020-07-01" + self.assertFalse(self.link.is_link_active) + self.link.date_start = "" + self.link.date_end = "2020-07-28" + self.assertFalse(self.link.is_link_active) + # Exception: if limitation is off the link is active anyway + self.link_type.limited_by_dates = False + self.assertTrue(self.link.is_link_active) + + def test_mandatory_date(self): + link_type = self.env["product.template.link.type"].get_by_code("up-selling") + link_type.limited_by_dates = True + link_type.mandatory_date_start = True + message = "A start date is required according to link type" + with self.assertRaisesRegex(exceptions.UserError, message): + self.env["product.template.link"].create( + { + "left_product_tmpl_id": self.prod1.id, + "right_product_tmpl_id": self.prod2.id, + "type_id": link_type.id, + } + ) diff --git a/product_template_multi_link_date_span/views/product_template_link_type_view.xml b/product_template_multi_link_date_span/views/product_template_link_type_view.xml new file mode 100644 index 0000000000..b9b3ffd1fd --- /dev/null +++ b/product_template_multi_link_date_span/views/product_template_link_type_view.xml @@ -0,0 +1,17 @@ + + + + product.template.link.type.list.date.span + product.template.link.type + + + + + + + + + diff --git a/product_template_multi_link_date_span/views/product_template_link_view.xml b/product_template_multi_link_date_span/views/product_template_link_view.xml new file mode 100644 index 0000000000..d0e32786ea --- /dev/null +++ b/product_template_multi_link_date_span/views/product_template_link_view.xml @@ -0,0 +1,34 @@ + + + + product.template.link.list.date.span + product.template.link + + + + + + + + + + product.template.link.form.date.span + product.template.link + + + + + + + + + + + +