From 2a5d2f906264620bb61d5ec87f0639864ce11eeb Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 26 Feb 2024 14:52:44 +0630 Subject: [PATCH 01/18] [ADD] report_qweb_field_option --- report_qweb_field_option/README.rst | 119 +++++ report_qweb_field_option/__init__.py | 1 + report_qweb_field_option/__manifest__.py | 20 + report_qweb_field_option/models/__init__.py | 2 + report_qweb_field_option/models/ir_qweb.py | 32 ++ .../models/qweb_field_options.py | 116 +++++ report_qweb_field_option/readme/CONFIGURE.rst | 12 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 3 + report_qweb_field_option/readme/ROADMAP.rst | 8 + report_qweb_field_option/readme/USAGE.rst | 6 + .../security/ir.model.access.csv | 3 + .../security/qweb_field_options_security.xml | 10 + .../static/description/index.html | 461 ++++++++++++++++++ report_qweb_field_option/tests/__init__.py | 1 + report_qweb_field_option/tests/test_models.py | 12 + .../tests/test_report_qweb_field_options.py | 125 +++++ .../views/qweb_field_options_views.xml | 77 +++ 18 files changed, 1012 insertions(+) create mode 100644 report_qweb_field_option/README.rst create mode 100644 report_qweb_field_option/__init__.py create mode 100644 report_qweb_field_option/__manifest__.py create mode 100644 report_qweb_field_option/models/__init__.py create mode 100644 report_qweb_field_option/models/ir_qweb.py create mode 100644 report_qweb_field_option/models/qweb_field_options.py create mode 100644 report_qweb_field_option/readme/CONFIGURE.rst create mode 100644 report_qweb_field_option/readme/CONTRIBUTORS.rst create mode 100644 report_qweb_field_option/readme/DESCRIPTION.rst create mode 100644 report_qweb_field_option/readme/ROADMAP.rst create mode 100644 report_qweb_field_option/readme/USAGE.rst create mode 100644 report_qweb_field_option/security/ir.model.access.csv create mode 100644 report_qweb_field_option/security/qweb_field_options_security.xml create mode 100644 report_qweb_field_option/static/description/index.html create mode 100644 report_qweb_field_option/tests/__init__.py create mode 100644 report_qweb_field_option/tests/test_models.py create mode 100644 report_qweb_field_option/tests/test_report_qweb_field_options.py create mode 100644 report_qweb_field_option/views/qweb_field_options_views.xml diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst new file mode 100644 index 0000000000..9e284643f0 --- /dev/null +++ b/report_qweb_field_option/README.rst @@ -0,0 +1,119 @@ +======================== +Report Qweb Field Option +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:57f77e238517a4774ef6dd76a5487221564468ed0f58e18caa48f32632ac56a7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_field_option + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_field_option + :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/reporting-engine&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows administrators to define the decimal precision of float fields and +add option values to fields (e.g., adding a date widget option to datetime fields) for +QWeb report and view presentation. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Go to *Settings > Technical > Reporting > Qweb Field Options*, and create records +according to your needs. + +For each record: + +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** only for fields + of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., ``{"widget": "date"}``, + ``{"widget": "monetary"}``, or ``{'widget': 'contact', 'fields': ['name', 'phone']}`` +- Set **Digits** (only for float-type fields). The value is ignored if Options is set + +Usage +===== + +Print a QWeb report (quotation, invoice, purchase order, etc.), and the value +presentation for fields like line quantity, price unit and date order are adjusted +according to the Qweb Field Options configuration. + +Note that among matching configuration records, the one with the strictest condition will be +applied. + +Known issues / Roadmap +====================== + +Assigning Options in a QWeb Field Options record can cause UI issues if a field is +defined twice with different widgets in a view. + +For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase order +can result in two dates appearing under the Confirmation Date column in the portal view. +This occurs because the field is defined twice with different widgets. + +Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 + +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 +~~~~~~~ + +* Quartile + +Contributors +~~~~~~~~~~~~ + +* `Quartile `_: + + * Yoshi Tashiro + * Aung Ko Ko Lin + +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/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_field_option/__init__.py b/report_qweb_field_option/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/report_qweb_field_option/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py new file mode 100644 index 0000000000..9082bf2bf4 --- /dev/null +++ b/report_qweb_field_option/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2024-2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Report Qweb Field Option", + "version": "16.0.1.0.0", + "category": "Technical Settings", + "license": "AGPL-3", + "author": "Quartile, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/reporting-engine", + "depends": ["uom"], + "external_dependencies": { + "python": ["odoo_test_helper"], + }, + "data": [ + "security/ir.model.access.csv", + "security/qweb_field_options_security.xml", + "views/qweb_field_options_views.xml", + ], + "installable": True, +} diff --git a/report_qweb_field_option/models/__init__.py b/report_qweb_field_option/models/__init__.py new file mode 100644 index 0000000000..0d0c2c02f0 --- /dev/null +++ b/report_qweb_field_option/models/__init__.py @@ -0,0 +1,2 @@ +from . import ir_qweb +from . import qweb_field_options diff --git a/report_qweb_field_option/models/ir_qweb.py b/report_qweb_field_option/models/ir_qweb.py new file mode 100644 index 0000000000..64be869059 --- /dev/null +++ b/report_qweb_field_option/models/ir_qweb.py @@ -0,0 +1,32 @@ +# Copyright 2024-2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class IrQweb(models.AbstractModel): + _inherit = "ir.qweb" + + @api.model + def _get_field( + self, record, field_name, expression, tagName, field_options, values + ): + if values.get("report_type") == "pdf": + company = getattr(record, "company_id", False) or self.env.company + options_recs = self.env["qweb.field.options"].search( + [ + ("res_model_name", "=", record._name), + ("field_name", "=", field_name), + "|", + ("company_id", "=", company.id), + ("company_id", "=", False), + ] + ) + if options_recs: + options_rec = max( + options_recs, default=None, key=lambda r: r._get_score(record) + ) + field_options = options_rec._update_field_options(record, field_options) + return super()._get_field( + record, field_name, expression, tagName, field_options, values + ) diff --git a/report_qweb_field_option/models/qweb_field_options.py b/report_qweb_field_option/models/qweb_field_options.py new file mode 100644 index 0000000000..91c4b35e0a --- /dev/null +++ b/report_qweb_field_option/models/qweb_field_options.py @@ -0,0 +1,116 @@ +# Copyright 2024-2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import ast +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + +_logger = logging.getLogger(__name__) + + +class QwebFieldOptions(models.Model): + _name = "qweb.field.options" + _description = "Qweb Field Options" + _order = "res_model_id, field_id" + + res_model_id = fields.Many2one( + "ir.model", string="Model", ondelete="cascade", required=True + ) + res_model_name = fields.Char("Model Name", related="res_model_id.model", store=True) + field_id = fields.Many2one( + "ir.model.fields", + domain="[('model_id', '=', res_model_id)]", + string="Field", + ondelete="cascade", + required=True, + ) + field_type = fields.Selection(related="field_id.ttype") + field_name = fields.Char("Field Name", related="field_id.name", store=True) + uom_id = fields.Many2one("uom.uom", string="UoM", ondelete="cascade") + uom_field_id = fields.Many2one( + "ir.model.fields", + domain="[('model_id', '=', res_model_id), ('relation', '=', 'uom.uom')]", + string="UoM Field", + ondelete="cascade", + ) + currency_id = fields.Many2one("res.currency", string="Currency", ondelete="cascade") + currency_field_id = fields.Many2one( + "ir.model.fields", + domain="[('model_id', '=', res_model_id), ('relation', '=', 'res.currency')]", + string="Currency Field", + ondelete="cascade", + ) + field_options = fields.Char( + "Options", + help="A string representation of a dictionary to specify field formatting " + "options. Examples:\n" + "{'widget': 'date'}\n" + "{'widget': 'monetary'}\n" + "{'widget': 'contact', 'fields': ['name', 'phone']}", + ) + digits = fields.Integer() + company_id = fields.Many2one("res.company", string="Company") + + @api.constrains("field_options") + def _check_field_options_format(self): + for rec in self: + if not rec.field_options: + continue + field_options = False + try: + field_options = ast.literal_eval(rec.field_options) + except Exception as e: + raise ValidationError( + _( + "Invalid string for the Options field: %(field_options)s.\n" + "Error: %(error)s" + ) + % {"field_options": rec.field_options, "error": e} + ) from e + if not isinstance(field_options, dict): + raise ValidationError( + _("Options must be a dictionary, but got %s") % type(field_options) + ) + + def _get_score(self, record): + self.ensure_one() + score = 1 + # Just increment the score as the record already matches the company_id, + # which has been filtered prior to calling this method. + if self.company_id: + score += 1 + if self.uom_id: + if record[self.uom_field_id.sudo().name] == self.uom_id: + score += 1 + else: + return -1 + if self.currency_id: + if record[self.currency_field_id.sudo().name] == self.currency_id: + score += 1 + else: + return -1 + return score + + def _update_field_options(self, record, field_options): + self.ensure_one() + if self.field_options: + try: + extra_options = ast.literal_eval(self.field_options) + if extra_options.get("widget") == "monetary": + extra_options["display_currency"] = ( + self.currency_id + or hasattr(record, "company_id") + and record.company_id.currency_id + or self.env.company.currency_id + ) + field_options.update(extra_options) + except Exception as e: + _logger.error( + "Failed to parse field options as a dictionary: " + f"{self.field_options}. Error: {e}" + ) + elif self.field_type == "float": + field_options["precision"] = self.digits + return field_options diff --git a/report_qweb_field_option/readme/CONFIGURE.rst b/report_qweb_field_option/readme/CONFIGURE.rst new file mode 100644 index 0000000000..ee0d8fa8cc --- /dev/null +++ b/report_qweb_field_option/readme/CONFIGURE.rst @@ -0,0 +1,12 @@ +Go to *Settings > Technical > Reporting > Qweb Field Options*, and create records +according to your needs. + +For each record: + +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** only for fields + of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., ``{"widget": "date"}``, + ``{"widget": "monetary"}``, or ``{'widget': 'contact', 'fields': ['name', 'phone']}`` +- Set **Digits** (only for float-type fields). The value is ignored if Options is set diff --git a/report_qweb_field_option/readme/CONTRIBUTORS.rst b/report_qweb_field_option/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..0ec4343483 --- /dev/null +++ b/report_qweb_field_option/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Quartile `_: + + * Yoshi Tashiro + * Aung Ko Ko Lin diff --git a/report_qweb_field_option/readme/DESCRIPTION.rst b/report_qweb_field_option/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..0273eb5bbd --- /dev/null +++ b/report_qweb_field_option/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows administrators to define the decimal precision of float fields and +add option values to fields (e.g., adding a date widget option to datetime fields) for +QWeb report and view presentation. diff --git a/report_qweb_field_option/readme/ROADMAP.rst b/report_qweb_field_option/readme/ROADMAP.rst new file mode 100644 index 0000000000..a749d21cde --- /dev/null +++ b/report_qweb_field_option/readme/ROADMAP.rst @@ -0,0 +1,8 @@ +Assigning Options in a QWeb Field Options record can cause UI issues if a field is +defined twice with different widgets in a view. + +For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase order +can result in two dates appearing under the Confirmation Date column in the portal view. +This occurs because the field is defined twice with different widgets. + +Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 diff --git a/report_qweb_field_option/readme/USAGE.rst b/report_qweb_field_option/readme/USAGE.rst new file mode 100644 index 0000000000..a159f81871 --- /dev/null +++ b/report_qweb_field_option/readme/USAGE.rst @@ -0,0 +1,6 @@ +Print a QWeb report (quotation, invoice, purchase order, etc.), and the value +presentation for fields like line quantity, price unit and date order are adjusted +according to the Qweb Field Options configuration. + +Note that among matching configuration records, the one with the strictest condition will be +applied. diff --git a/report_qweb_field_option/security/ir.model.access.csv b/report_qweb_field_option/security/ir.model.access.csv new file mode 100644 index 0000000000..6ab8337393 --- /dev/null +++ b/report_qweb_field_option/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_qweb_field_options_all,access.qweb.field.options.all,model_qweb_field_options,,1,0,0,0 +access_qweb_field_options_admin,access.qweb.field.options.admin,model_qweb_field_options,base.group_system,1,1,1,1 diff --git a/report_qweb_field_option/security/qweb_field_options_security.xml b/report_qweb_field_option/security/qweb_field_options_security.xml new file mode 100644 index 0000000000..fa28417209 --- /dev/null +++ b/report_qweb_field_option/security/qweb_field_options_security.xml @@ -0,0 +1,10 @@ + + + + Qweb Field Options Multi-company + + ['|', ('company_id', 'in', company_ids), ('company_id', '=', False)] + + diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html new file mode 100644 index 0000000000..04d5d8a840 --- /dev/null +++ b/report_qweb_field_option/static/description/index.html @@ -0,0 +1,461 @@ + + + + + +Report Qweb Field Option + + + +
+

Report Qweb Field Option

+ + +

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

This module allows administrators to define the decimal precision of float fields and +add option values to fields (e.g., adding a date widget option to datetime fields) for +QWeb report and view presentation.

+

Table of contents

+ +
+

Configuration

+

Go to Settings > Technical > Reporting > Qweb Field Options, and create records +according to your needs.

+

For each record:

+
    +
  • Set Model and Field (required)
  • +
  • Set UoM and UoM Field, or Currency and Currency Field only for fields +of float type (optional)
  • +
  • Set Company (optional)
  • +
  • Set Options as a string representation of a dictionary. E.g., {"widget": "date"}, +{"widget": "monetary"}, or {'widget': 'contact', 'fields': ['name', 'phone']}
  • +
  • Set Digits (only for float-type fields). The value is ignored if Options is set
  • +
+
+
+

Usage

+

Print a QWeb report (quotation, invoice, purchase order, etc.), and the value +presentation for fields like line quantity, price unit and date order are adjusted +according to the Qweb Field Options configuration.

+

Note that among matching configuration records, the one with the strictest condition will be +applied.

+
+
+

Known issues / Roadmap

+

Assigning Options in a QWeb Field Options record can cause UI issues if a field is +defined twice with different widgets in a view.

+

For example, adding {"widget": "date"} to the date_approve field in a purchase order +can result in two dates appearing under the Confirmation Date column in the portal view. +This occurs because the field is defined twice with different widgets.

+

Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

+
+
+

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

+
    +
  • Quartile
  • +
+
+
+

Contributors

+
    +
  • Quartile:
      +
    • Yoshi Tashiro
    • +
    • Aung Ko Ko Lin
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/reporting-engine project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/report_qweb_field_option/tests/__init__.py b/report_qweb_field_option/tests/__init__.py new file mode 100644 index 0000000000..0c4db8b9c1 --- /dev/null +++ b/report_qweb_field_option/tests/__init__.py @@ -0,0 +1 @@ +from . import test_report_qweb_field_options diff --git a/report_qweb_field_option/tests/test_models.py b/report_qweb_field_option/tests/test_models.py new file mode 100644 index 0000000000..fa2978edf3 --- /dev/null +++ b/report_qweb_field_option/tests/test_models.py @@ -0,0 +1,12 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class TestQwebFieldModel(models.Model): + _name = "test.qweb.field.options" + + name = fields.Char() + value = fields.Float(string="Rounding Factor") + currency_id = fields.Many2one("res.currency") + company_id = fields.Many2one("res.company") diff --git a/report_qweb_field_option/tests/test_report_qweb_field_options.py b/report_qweb_field_option/tests/test_report_qweb_field_options.py new file mode 100644 index 0000000000..ed7d4ba3c0 --- /dev/null +++ b/report_qweb_field_option/tests/test_report_qweb_field_options.py @@ -0,0 +1,125 @@ +# Copyright 2024 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo_test_helper import FakeModelLoader + +from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase + + +class TestQwebFieldOptions(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.loader = FakeModelLoader(cls.env, cls.__module__) + cls.loader.backup_registry() + from .test_models import TestQwebFieldModel + + cls.loader.update_registry((TestQwebFieldModel,)) + cls.test_model = cls.env.ref( + "report_qweb_field_option.model_test_qweb_field_options" + ) + cls.value_field = cls.env["ir.model.fields"]._get( + "test.qweb.field.options", "value" + ) + cls.currency_field = cls.env["ir.model.fields"]._get( + "test.qweb.field.options", "currency_id" + ) + cls.IrQweb = cls.env["ir.qweb"] + cls.test_currency = cls.env["res.currency"].create( + {"name": "Test Currency", "symbol": "$"} + ) + cls.test_record = cls.env["test.qweb.field.options"].create( + { + "name": "Test", + "value": 1.00, + "currency_id": cls.test_currency.id, + "company_id": cls.env.company.id, + } + ) + cls.qweb_options_rec = cls.env["qweb.field.options"].create( + { + "res_model_id": cls.test_model.id, + "field_id": cls.value_field.id, + "currency_id": cls.test_currency.id, + "currency_field_id": cls.currency_field.id, + "digits": 0, + } + ) + + @classmethod + def tearDownClass(cls): + cls.loader.restore_registry() + return super().tearDownClass() + + def test_qweb_field_option(self): + values = {"report_type": "pdf"} + # Test with 0 digits + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertEqual(content, "1") + + # Test with 2 digits + self.qweb_options_rec.digits = 2 + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertEqual(content, "1.00") + + # Test with 3 digits + self.qweb_options_rec.digits = 3 + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertEqual(content, "1.000") + + # Test with widget + self.qweb_options_rec.field_options = "{'widget': 'monetary'}" + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertIn("$", content) + + # Test that an error is raised when the input value is incorrect. + with self.assertRaises(ValidationError): + self.qweb_options_rec.field_options = ( + "{'widget': 'monetary', 'currency_field': self.test_record}" + ) + + with self.assertRaises(ValidationError): + self.qweb_options_rec.field_options = "'widget': 'monetary'" + + def test_qweb_field_option_with_multiple_record(self): + values = {"report_type": "pdf"} + qweb_options_company_rec = self.env["qweb.field.options"].create( + { + "res_model_id": self.test_model.id, + "field_id": self.value_field.id, + "currency_id": self.test_currency.id, + "currency_field_id": self.currency_field.id, + "company_id": self.env.company.id, + "digits": 1, + } + ) + + # If there are two records, one with and one without a company, + # it should prioritize the record with the company_id + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertEqual(content, "1.0") + + qweb_options_company_rec.field_options = "{'widget': 'monetary'}" + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertIn("$", content) + + # Test after unlinking the options record + qweb_options_company_rec.unlink() + _, content, _ = self.IrQweb._get_field( + self.test_record, "value", False, False, {}, values + ) + self.assertNotEqual(content, "1.0") + self.assertNotIn("$", content) diff --git a/report_qweb_field_option/views/qweb_field_options_views.xml b/report_qweb_field_option/views/qweb_field_options_views.xml new file mode 100644 index 0000000000..82a1bcbfb1 --- /dev/null +++ b/report_qweb_field_option/views/qweb_field_options_views.xml @@ -0,0 +1,77 @@ + + + + qweb.field.options.tree + qweb.field.options + tree + + + + + + + + + + + + + + + + + qweb.field.options.search + qweb.field.options + + + + + + + + + + + + + + + + Qweb Field Options + qweb.field.options + tree + + + + From fbe8a1b9a565b4aff31feddc75a85c9eac1efbce Mon Sep 17 00:00:00 2001 From: oca-ci Date: Thu, 13 Mar 2025 08:28:33 +0000 Subject: [PATCH 02/18] [UPD] Update report_qweb_field_option.pot --- .../i18n/report_qweb_field_option.pot | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 report_qweb_field_option/i18n/report_qweb_field_option.pot diff --git a/report_qweb_field_option/i18n/report_qweb_field_option.pot b/report_qweb_field_option/i18n/report_qweb_field_option.pot new file mode 100644 index 0000000000..f8c1ee006e --- /dev/null +++ b/report_qweb_field_option/i18n/report_qweb_field_option.pot @@ -0,0 +1,157 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_field_option +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: report_qweb_field_option +#: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options +msgid "" +"A string representation of a dictionary to specify field formatting options. Examples:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id +msgid "Company" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid +msgid "Created by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date +msgid "Created on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id +msgid "Currency" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id +msgid "Currency Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits +msgid "Digits" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name +msgid "Display Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id +msgid "Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name +msgid "Field Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type +msgid "Field Type" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Group By" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id +msgid "ID" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +#, python-format +msgid "" +"Invalid string for the Options field: %(field_options)s.\n" +"Error: %(error)s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options____last_update +msgid "Last Modified on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date +msgid "Last Updated on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Model" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name +msgid "Model Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options +msgid "Options" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +#, python-format +msgid "Options must be a dictionary, but got %s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model,name:report_qweb_field_option.model_ir_qweb +msgid "Qweb" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view +#: model:ir.model,name:report_qweb_field_option.model_qweb_field_options +#: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options +msgid "Qweb Field Options" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Qweb Field Options Search" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id +msgid "UoM" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id +msgid "UoM Field" +msgstr "" From e2bcd9299de5a122066e1041e24853f13cb00f99 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 13 Mar 2025 08:32:40 +0000 Subject: [PATCH 03/18] [BOT] post-merge updates --- report_qweb_field_option/README.rst | 2 +- .../static/description/icon.png | Bin 0 -> 10254 bytes .../static/description/index.html | 13 ++++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 report_qweb_field_option/static/description/icon.png diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index 9e284643f0..e5564e13ce 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -7,7 +7,7 @@ Report Qweb Field Option !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:57f77e238517a4774ef6dd76a5487221564468ed0f58e18caa48f32632ac56a7 + !! source digest: sha256:d1a8032a109004d8ce4b54259be2c034fae34da3aefacd135a413c15722eb4a0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/report_qweb_field_option/static/description/icon.png b/report_qweb_field_option/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1dcc49c24f364e9adf0afbc6fc0bac6dbecdeb11 GIT binary patch literal 10254 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 Qweb Field Option !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:57f77e238517a4774ef6dd76a5487221564468ed0f58e18caa48f32632ac56a7 +!! source digest: sha256:d1a8032a109004d8ce4b54259be2c034fae34da3aefacd135a413c15722eb4a0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module allows administrators to define the decimal precision of float fields and @@ -448,7 +449,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

From 656cd1418451332bb538b232639800645ce3c4bf Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Fri, 14 Mar 2025 05:04:44 +0000 Subject: [PATCH 04/18] [IMP] report_qweb_field_option: remove odoo_test_helper from manifest --- report_qweb_field_option/__manifest__.py | 3 --- .../static/description/index.html | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py index 9082bf2bf4..c4131b2d3f 100644 --- a/report_qweb_field_option/__manifest__.py +++ b/report_qweb_field_option/__manifest__.py @@ -8,9 +8,6 @@ "author": "Quartile, Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "depends": ["uom"], - "external_dependencies": { - "python": ["odoo_test_helper"], - }, "data": [ "security/ir.model.access.csv", "security/qweb_field_options_security.xml", diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 8ab885a467..5c7e6c959d 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -8,11 +8,10 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ +:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z 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. @@ -275,7 +274,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: gray; } /* line numbers */ +pre.code .ln { color: grey; } /* 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 } @@ -301,7 +300,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -449,9 +448,7 @@

Contributors

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

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.

From 45b36e5b9ba3b6438987bb60f1db76f27aed2140 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 14 Mar 2025 07:17:30 +0000 Subject: [PATCH 05/18] [BOT] post-merge updates --- report_qweb_field_option/README.rst | 2 +- report_qweb_field_option/__manifest__.py | 2 +- .../static/description/index.html | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index e5564e13ce..9246bcf080 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -7,7 +7,7 @@ Report Qweb Field Option !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:d1a8032a109004d8ce4b54259be2c034fae34da3aefacd135a413c15722eb4a0 + !! source digest: sha256:4d7a21349927626f4c4d13d7cdfc44101ee60a67b7cbb3d72aa53484f5822ede !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py index c4131b2d3f..3ca631b6c8 100644 --- a/report_qweb_field_option/__manifest__.py +++ b/report_qweb_field_option/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Report Qweb Field Option", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "category": "Technical Settings", "license": "AGPL-3", "author": "Quartile, Odoo Community Association (OCA)", diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 5c7e6c959d..a86ce37bdb 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/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 { @@ -366,7 +367,7 @@

Report Qweb Field Option

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:d1a8032a109004d8ce4b54259be2c034fae34da3aefacd135a413c15722eb4a0 +!! source digest: sha256:4d7a21349927626f4c4d13d7cdfc44101ee60a67b7cbb3d72aa53484f5822ede !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module allows administrators to define the decimal precision of float fields and @@ -448,7 +449,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

From d77d15121ae5c7ce6fcd1a80fedeef6c028705b0 Mon Sep 17 00:00:00 2001 From: mymage Date: Tue, 18 Mar 2025 16:30:02 +0000 Subject: [PATCH 06/18] Added translation using Weblate (Italian) --- report_qweb_field_option/i18n/it.po | 158 ++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 report_qweb_field_option/i18n/it.po diff --git a/report_qweb_field_option/i18n/it.po b/report_qweb_field_option/i18n/it.po new file mode 100644 index 0000000000..8b4e520746 --- /dev/null +++ b/report_qweb_field_option/i18n/it.po @@ -0,0 +1,158 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_field_option +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\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" + +#. module: report_qweb_field_option +#: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options +msgid "" +"A string representation of a dictionary to specify field formatting options. Examples:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id +msgid "Company" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid +msgid "Created by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date +msgid "Created on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id +msgid "Currency" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id +msgid "Currency Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits +msgid "Digits" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name +msgid "Display Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id +msgid "Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name +msgid "Field Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type +msgid "Field Type" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Group By" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id +msgid "ID" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +#, python-format +msgid "" +"Invalid string for the Options field: %(field_options)s.\n" +"Error: %(error)s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options____last_update +msgid "Last Modified on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date +msgid "Last Updated on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Model" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name +msgid "Model Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options +msgid "Options" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +#, python-format +msgid "Options must be a dictionary, but got %s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model,name:report_qweb_field_option.model_ir_qweb +msgid "Qweb" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view +#: model:ir.model,name:report_qweb_field_option.model_qweb_field_options +#: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options +msgid "Qweb Field Options" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Qweb Field Options Search" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id +msgid "UoM" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id +msgid "UoM Field" +msgstr "" From 28766195ad6d1a3f1fe87c5459cc5addf3480c3d Mon Sep 17 00:00:00 2001 From: mymage Date: Sun, 30 Mar 2025 18:36:04 +0000 Subject: [PATCH 07/18] Translated using Weblate (Italian) Currently translated at 100.0% (26 of 26 strings) Translation: reporting-engine-16.0/reporting-engine-16.0-report_qweb_field_option Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_field_option/it/ --- report_qweb_field_option/i18n/it.po | 59 +++++++++++++++++------------ 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/report_qweb_field_option/i18n/it.po b/report_qweb_field_option/i18n/it.po index 8b4e520746..9db58d4b83 100644 --- a/report_qweb_field_option/i18n/it.po +++ b/report_qweb_field_option/i18n/it.po @@ -6,13 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2025-03-30 21:06+0000\n" +"Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\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 5.10.2\n" #. module: report_qweb_field_option #: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options @@ -22,66 +24,71 @@ msgid "" "{'widget': 'monetary'}\n" "{'widget': 'contact', 'fields': ['name', 'phone']}" msgstr "" +"Una stringa che rappresenta un dizionario per indicare le opzioni di " +"formattazione dei campi. Esempi:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id msgid "Company" -msgstr "" +msgstr "Azienda" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid msgid "Created by" -msgstr "" +msgstr "Creato da" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date msgid "Created on" -msgstr "" +msgstr "Creato il" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id msgid "Currency" -msgstr "" +msgstr "Valuta" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id msgid "Currency Field" -msgstr "" +msgstr "Campo valuta" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits msgid "Digits" -msgstr "" +msgstr "Cifre" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name msgid "Display Name" -msgstr "" +msgstr "Nome visualizzato" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id msgid "Field" -msgstr "" +msgstr "Campo" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name msgid "Field Name" -msgstr "" +msgstr "Nome campo" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type msgid "Field Type" -msgstr "" +msgstr "Tipo campo" #. module: report_qweb_field_option #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Group By" -msgstr "" +msgstr "Raggruppa per" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id msgid "ID" -msgstr "" +msgstr "ID" #. module: report_qweb_field_option #. odoo-python @@ -91,68 +98,70 @@ msgid "" "Invalid string for the Options field: %(field_options)s.\n" "Error: %(error)s" msgstr "" +"Stringa non valida per il campo opzioni: %(field_options)s.\n" +"Errore: %(error)s" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options____last_update msgid "Last Modified on" -msgstr "" +msgstr "Ultima modifica il" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Ultimo aggiornamento di" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date msgid "Last Updated on" -msgstr "" +msgstr "Ultimo aggiornamento il" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Model" -msgstr "" +msgstr "Modello" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name msgid "Model Name" -msgstr "" +msgstr "Nome modello" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options msgid "Options" -msgstr "" +msgstr "Opzioni" #. module: report_qweb_field_option #. odoo-python #: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 #, python-format msgid "Options must be a dictionary, but got %s" -msgstr "" +msgstr "Le opzioni devono essere un dizionario, ma sono %s" #. module: report_qweb_field_option #: model:ir.model,name:report_qweb_field_option.model_ir_qweb msgid "Qweb" -msgstr "" +msgstr "Qweb" #. module: report_qweb_field_option #: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view #: model:ir.model,name:report_qweb_field_option.model_qweb_field_options #: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options msgid "Qweb Field Options" -msgstr "" +msgstr "Opzioni campo Qweb" #. module: report_qweb_field_option #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Qweb Field Options Search" -msgstr "" +msgstr "Ricerca opzioni campo Qweb" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id msgid "UoM" -msgstr "" +msgstr "UdM" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id msgid "UoM Field" -msgstr "" +msgstr "Campo UdM" From 8cfd4154e790a452c473c410181fd8e098fef48f Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Thu, 12 Jun 2025 08:26:47 +0000 Subject: [PATCH 08/18] [IMP] report_qweb_field_option: pre-commit auto fixes --- report_qweb_field_option/README.rst | 72 ++++++++++--------- report_qweb_field_option/pyproject.toml | 3 + report_qweb_field_option/readme/CONFIGURE.md | 14 ++++ report_qweb_field_option/readme/CONFIGURE.rst | 12 ---- .../readme/CONTRIBUTORS.md | 3 + .../readme/CONTRIBUTORS.rst | 4 -- .../readme/DESCRIPTION.md | 3 + .../readme/DESCRIPTION.rst | 3 - report_qweb_field_option/readme/ROADMAP.md | 10 +++ report_qweb_field_option/readme/ROADMAP.rst | 8 --- report_qweb_field_option/readme/USAGE.md | 6 ++ report_qweb_field_option/readme/USAGE.rst | 6 -- .../static/description/index.html | 63 ++++++++-------- 13 files changed, 109 insertions(+), 98 deletions(-) create mode 100644 report_qweb_field_option/pyproject.toml create mode 100644 report_qweb_field_option/readme/CONFIGURE.md delete mode 100644 report_qweb_field_option/readme/CONFIGURE.rst create mode 100644 report_qweb_field_option/readme/CONTRIBUTORS.md delete mode 100644 report_qweb_field_option/readme/CONTRIBUTORS.rst create mode 100644 report_qweb_field_option/readme/DESCRIPTION.md delete mode 100644 report_qweb_field_option/readme/DESCRIPTION.rst create mode 100644 report_qweb_field_option/readme/ROADMAP.md delete mode 100644 report_qweb_field_option/readme/ROADMAP.rst create mode 100644 report_qweb_field_option/readme/USAGE.md delete mode 100644 report_qweb_field_option/readme/USAGE.rst diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index 9246bcf080..b7fcfc05e2 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -17,20 +17,20 @@ Report Qweb Field Option :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_field_option + :target: https://github.com/OCA/reporting-engine/tree/18.0/report_qweb_field_option :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_field_option + :target: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_qweb_field_option :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/reporting-engine&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows administrators to define the decimal precision of float fields and -add option values to fields (e.g., adding a date widget option to datetime fields) for -QWeb report and view presentation. +This module allows administrators to define the decimal precision of +float fields and add option values to fields (e.g., adding a date widget +option to datetime fields) for QWeb report and view presentation. **Table of contents** @@ -40,40 +40,44 @@ QWeb report and view presentation. Configuration ============= -Go to *Settings > Technical > Reporting > Qweb Field Options*, and create records -according to your needs. +Go to *Settings > Technical > Reporting > Qweb Field Options*, and +create records according to your needs. For each record: -- Set **Model** and **Field** (required) -- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** only for fields - of float type (optional) -- Set **Company** (optional) -- Set **Options** as a string representation of a dictionary. E.g., ``{"widget": "date"}``, - ``{"widget": "monetary"}``, or ``{'widget': 'contact', 'fields': ['name', 'phone']}`` -- Set **Digits** (only for float-type fields). The value is ignored if Options is set +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** + only for fields of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., + ``{"widget": "date"}``, ``{"widget": "monetary"}``, or + ``{'widget': 'contact', 'fields': ['name', 'phone']}`` +- Set **Digits** (only for float-type fields). The value is ignored if + Options is set Usage ===== -Print a QWeb report (quotation, invoice, purchase order, etc.), and the value -presentation for fields like line quantity, price unit and date order are adjusted -according to the Qweb Field Options configuration. +Print a QWeb report (quotation, invoice, purchase order, etc.), and the +value presentation for fields like line quantity, price unit and date +order are adjusted according to the Qweb Field Options configuration. -Note that among matching configuration records, the one with the strictest condition will be -applied. +Note that among matching configuration records, the one with the +strictest condition will be applied. Known issues / Roadmap ====================== -Assigning Options in a QWeb Field Options record can cause UI issues if a field is -defined twice with different widgets in a view. +Assigning Options in a QWeb Field Options record can cause UI issues if +a field is defined twice with different widgets in a view. -For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase order -can result in two dates appearing under the Confirmation Date column in the portal view. -This occurs because the field is defined twice with different widgets. +For example, adding ``{"widget": "date"}`` to the date_approve field in +a purchase order can result in two dates appearing under the +Confirmation Date column in the portal view. This occurs because the +field is defined twice with different widgets. -Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 +Reference: +https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 Bug Tracker =========== @@ -81,7 +85,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. @@ -89,20 +93,20 @@ Credits ======= Authors -~~~~~~~ +------- * Quartile Contributors -~~~~~~~~~~~~ +------------ -* `Quartile `_: +- `Quartile `__: - * Yoshi Tashiro - * Aung Ko Ko Lin + - Yoshi Tashiro + - Aung Ko Ko Lin Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -114,6 +118,6 @@ 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/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_field_option/pyproject.toml b/report_qweb_field_option/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/report_qweb_field_option/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/report_qweb_field_option/readme/CONFIGURE.md b/report_qweb_field_option/readme/CONFIGURE.md new file mode 100644 index 0000000000..3ee9330c05 --- /dev/null +++ b/report_qweb_field_option/readme/CONFIGURE.md @@ -0,0 +1,14 @@ +Go to *Settings \> Technical \> Reporting \> Qweb Field Options*, and +create records according to your needs. + +For each record: + +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** + only for fields of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., + `{"widget": "date"}`, `{"widget": "monetary"}`, or + `{'widget': 'contact', 'fields': ['name', 'phone']}` +- Set **Digits** (only for float-type fields). The value is ignored if + Options is set diff --git a/report_qweb_field_option/readme/CONFIGURE.rst b/report_qweb_field_option/readme/CONFIGURE.rst deleted file mode 100644 index ee0d8fa8cc..0000000000 --- a/report_qweb_field_option/readme/CONFIGURE.rst +++ /dev/null @@ -1,12 +0,0 @@ -Go to *Settings > Technical > Reporting > Qweb Field Options*, and create records -according to your needs. - -For each record: - -- Set **Model** and **Field** (required) -- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** only for fields - of float type (optional) -- Set **Company** (optional) -- Set **Options** as a string representation of a dictionary. E.g., ``{"widget": "date"}``, - ``{"widget": "monetary"}``, or ``{'widget': 'contact', 'fields': ['name', 'phone']}`` -- Set **Digits** (only for float-type fields). The value is ignored if Options is set diff --git a/report_qweb_field_option/readme/CONTRIBUTORS.md b/report_qweb_field_option/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..4d16bdc25a --- /dev/null +++ b/report_qweb_field_option/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Quartile](https://www.quartile.co): + - Yoshi Tashiro + - Aung Ko Ko Lin diff --git a/report_qweb_field_option/readme/CONTRIBUTORS.rst b/report_qweb_field_option/readme/CONTRIBUTORS.rst deleted file mode 100644 index 0ec4343483..0000000000 --- a/report_qweb_field_option/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* `Quartile `_: - - * Yoshi Tashiro - * Aung Ko Ko Lin diff --git a/report_qweb_field_option/readme/DESCRIPTION.md b/report_qweb_field_option/readme/DESCRIPTION.md new file mode 100644 index 0000000000..52521f23fd --- /dev/null +++ b/report_qweb_field_option/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module allows administrators to define the decimal precision of +float fields and add option values to fields (e.g., adding a date widget +option to datetime fields) for QWeb report and view presentation. diff --git a/report_qweb_field_option/readme/DESCRIPTION.rst b/report_qweb_field_option/readme/DESCRIPTION.rst deleted file mode 100644 index 0273eb5bbd..0000000000 --- a/report_qweb_field_option/readme/DESCRIPTION.rst +++ /dev/null @@ -1,3 +0,0 @@ -This module allows administrators to define the decimal precision of float fields and -add option values to fields (e.g., adding a date widget option to datetime fields) for -QWeb report and view presentation. diff --git a/report_qweb_field_option/readme/ROADMAP.md b/report_qweb_field_option/readme/ROADMAP.md new file mode 100644 index 0000000000..8064f04184 --- /dev/null +++ b/report_qweb_field_option/readme/ROADMAP.md @@ -0,0 +1,10 @@ +Assigning Options in a QWeb Field Options record can cause UI issues if +a field is defined twice with different widgets in a view. + +For example, adding `{"widget": "date"}` to the date_approve field in a +purchase order can result in two dates appearing under the Confirmation +Date column in the portal view. This occurs because the field is defined +twice with different widgets. + +Reference: + diff --git a/report_qweb_field_option/readme/ROADMAP.rst b/report_qweb_field_option/readme/ROADMAP.rst deleted file mode 100644 index a749d21cde..0000000000 --- a/report_qweb_field_option/readme/ROADMAP.rst +++ /dev/null @@ -1,8 +0,0 @@ -Assigning Options in a QWeb Field Options record can cause UI issues if a field is -defined twice with different widgets in a view. - -For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase order -can result in two dates appearing under the Confirmation Date column in the portal view. -This occurs because the field is defined twice with different widgets. - -Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 diff --git a/report_qweb_field_option/readme/USAGE.md b/report_qweb_field_option/readme/USAGE.md new file mode 100644 index 0000000000..491184a26f --- /dev/null +++ b/report_qweb_field_option/readme/USAGE.md @@ -0,0 +1,6 @@ +Print a QWeb report (quotation, invoice, purchase order, etc.), and the +value presentation for fields like line quantity, price unit and date +order are adjusted according to the Qweb Field Options configuration. + +Note that among matching configuration records, the one with the +strictest condition will be applied. diff --git a/report_qweb_field_option/readme/USAGE.rst b/report_qweb_field_option/readme/USAGE.rst deleted file mode 100644 index a159f81871..0000000000 --- a/report_qweb_field_option/readme/USAGE.rst +++ /dev/null @@ -1,6 +0,0 @@ -Print a QWeb report (quotation, invoice, purchase order, etc.), and the value -presentation for fields like line quantity, price unit and date order are adjusted -according to the Qweb Field Options configuration. - -Note that among matching configuration records, the one with the strictest condition will be -applied. diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index a86ce37bdb..9bf2fb7840 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -8,11 +8,10 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ +:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z 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. @@ -275,7 +274,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: gray; } /* line numbers */ +pre.code .ln { color: grey; } /* 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 } @@ -301,7 +300,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -369,10 +368,10 @@

Report Qweb Field Option

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:4d7a21349927626f4c4d13d7cdfc44101ee60a67b7cbb3d72aa53484f5822ede !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

-

This module allows administrators to define the decimal precision of float fields and -add option values to fields (e.g., adding a date widget option to datetime fields) for -QWeb report and view presentation.

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

This module allows administrators to define the decimal precision of +float fields and add option values to fields (e.g., adding a date widget +option to datetime fields) for QWeb report and view presentation.

Table of contents

    @@ -390,42 +389,46 @@

    Report Qweb Field Option

Configuration

-

Go to Settings > Technical > Reporting > Qweb Field Options, and create records -according to your needs.

+

Go to Settings > Technical > Reporting > Qweb Field Options, and +create records according to your needs.

For each record:

  • Set Model and Field (required)
  • -
  • Set UoM and UoM Field, or Currency and Currency Field only for fields -of float type (optional)
  • +
  • Set UoM and UoM Field, or Currency and Currency Field +only for fields of float type (optional)
  • Set Company (optional)
  • -
  • Set Options as a string representation of a dictionary. E.g., {"widget": "date"}, -{"widget": "monetary"}, or {'widget': 'contact', 'fields': ['name', 'phone']}
  • -
  • Set Digits (only for float-type fields). The value is ignored if Options is set
  • +
  • Set Options as a string representation of a dictionary. E.g., +{"widget": "date"}, {"widget": "monetary"}, or +{'widget': 'contact', 'fields': ['name', 'phone']}
  • +
  • Set Digits (only for float-type fields). The value is ignored if +Options is set

Usage

-

Print a QWeb report (quotation, invoice, purchase order, etc.), and the value -presentation for fields like line quantity, price unit and date order are adjusted -according to the Qweb Field Options configuration.

-

Note that among matching configuration records, the one with the strictest condition will be -applied.

+

Print a QWeb report (quotation, invoice, purchase order, etc.), and the +value presentation for fields like line quantity, price unit and date +order are adjusted according to the Qweb Field Options configuration.

+

Note that among matching configuration records, the one with the +strictest condition will be applied.

Known issues / Roadmap

-

Assigning Options in a QWeb Field Options record can cause UI issues if a field is -defined twice with different widgets in a view.

-

For example, adding {"widget": "date"} to the date_approve field in a purchase order -can result in two dates appearing under the Confirmation Date column in the portal view. -This occurs because the field is defined twice with different widgets.

-

Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

+

Assigning Options in a QWeb Field Options record can cause UI issues if +a field is defined twice with different widgets in a view.

+

For example, adding {"widget": "date"} to the date_approve field in +a purchase order can result in two dates appearing under the +Confirmation Date column in the portal view. This occurs because the +field is defined twice with different widgets.

+

Reference: +https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

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.

@@ -449,13 +452,11 @@

Contributors

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

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/reporting-engine project on GitHub.

+

This module is part of the OCA/reporting-engine project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

From b6424c12008f1291b7e2391e524b465e14c1f0f6 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Thu, 12 Jun 2025 09:50:35 +0000 Subject: [PATCH 09/18] [MIG] report_qweb_field_option: Migration to 18.0 --- report_qweb_field_option/__manifest__.py | 2 +- .../security/ir.model.access.csv | 4 ++- report_qweb_field_option/tests/test_models.py | 1 + .../views/qweb_field_options_views.xml | 32 ++++++++----------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py index 3ca631b6c8..0bf473c1c8 100644 --- a/report_qweb_field_option/__manifest__.py +++ b/report_qweb_field_option/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Report Qweb Field Option", - "version": "16.0.1.0.1", + "version": "18.0.1.0.0", "category": "Technical Settings", "license": "AGPL-3", "author": "Quartile, Odoo Community Association (OCA)", diff --git a/report_qweb_field_option/security/ir.model.access.csv b/report_qweb_field_option/security/ir.model.access.csv index 6ab8337393..8472348b35 100644 --- a/report_qweb_field_option/security/ir.model.access.csv +++ b/report_qweb_field_option/security/ir.model.access.csv @@ -1,3 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_qweb_field_options_all,access.qweb.field.options.all,model_qweb_field_options,,1,0,0,0 +access_qweb_field_options_public,access.qweb.field.options.public,model_qweb_field_options,base.group_public,1,0,0,0 +access_qweb_field_options_portal,access.qweb.field.options.portal,model_qweb_field_options,base.group_portal,1,0,0,0 +access_qweb_field_options_user,access.qweb.field.options.user,model_qweb_field_options,base.group_user,1,0,0,0 access_qweb_field_options_admin,access.qweb.field.options.admin,model_qweb_field_options,base.group_system,1,1,1,1 diff --git a/report_qweb_field_option/tests/test_models.py b/report_qweb_field_option/tests/test_models.py index fa2978edf3..0299230299 100644 --- a/report_qweb_field_option/tests/test_models.py +++ b/report_qweb_field_option/tests/test_models.py @@ -5,6 +5,7 @@ class TestQwebFieldModel(models.Model): _name = "test.qweb.field.options" + _description = "Test Qweb Field Options" name = fields.Char() value = fields.Float(string="Rounding Factor") diff --git a/report_qweb_field_option/views/qweb_field_options_views.xml b/report_qweb_field_option/views/qweb_field_options_views.xml index 82a1bcbfb1..679477d4d5 100644 --- a/report_qweb_field_option/views/qweb_field_options_views.xml +++ b/report_qweb_field_option/views/qweb_field_options_views.xml @@ -1,32 +1,31 @@ - qweb.field.options.tree + qweb.field.options.list qweb.field.options - tree + list - + - - + + - - + + @@ -65,7 +61,7 @@ Qweb Field Options qweb.field.options - tree + list Date: Wed, 23 Jul 2025 03:43:31 +0000 Subject: [PATCH 10/18] [FIX] report_qweb_field_option: fix not working for uom specific --- report_qweb_field_option/models/ir_qweb.py | 1 + report_qweb_field_option/tests/test_models.py | 2 ++ .../tests/test_report_qweb_field_options.py | 30 +++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/report_qweb_field_option/models/ir_qweb.py b/report_qweb_field_option/models/ir_qweb.py index 64be869059..b37b903358 100644 --- a/report_qweb_field_option/models/ir_qweb.py +++ b/report_qweb_field_option/models/ir_qweb.py @@ -22,6 +22,7 @@ def _get_field( ("company_id", "=", False), ] ) + options_recs = [r for r in options_recs if r._get_score(record) > 0] if options_recs: options_rec = max( options_recs, default=None, key=lambda r: r._get_score(record) diff --git a/report_qweb_field_option/tests/test_models.py b/report_qweb_field_option/tests/test_models.py index 0299230299..521131845c 100644 --- a/report_qweb_field_option/tests/test_models.py +++ b/report_qweb_field_option/tests/test_models.py @@ -8,6 +8,8 @@ class TestQwebFieldModel(models.Model): _description = "Test Qweb Field Options" name = fields.Char() + quantity = fields.Float() + uom_id = fields.Many2one("uom.uom") value = fields.Float(string="Rounding Factor") currency_id = fields.Many2one("res.currency") company_id = fields.Many2one("res.company") diff --git a/report_qweb_field_option/tests/test_report_qweb_field_options.py b/report_qweb_field_option/tests/test_report_qweb_field_options.py index ed7d4ba3c0..e55e439a6a 100644 --- a/report_qweb_field_option/tests/test_report_qweb_field_options.py +++ b/report_qweb_field_option/tests/test_report_qweb_field_options.py @@ -19,6 +19,12 @@ def setUpClass(cls): cls.test_model = cls.env.ref( "report_qweb_field_option.model_test_qweb_field_options" ) + cls.quantity_field = cls.env["ir.model.fields"]._get( + "test.qweb.field.options", "quantity" + ) + cls.uom_field = cls.env["ir.model.fields"]._get( + "test.qweb.field.options", "uom_id" + ) cls.value_field = cls.env["ir.model.fields"]._get( "test.qweb.field.options", "value" ) @@ -29,9 +35,11 @@ def setUpClass(cls): cls.test_currency = cls.env["res.currency"].create( {"name": "Test Currency", "symbol": "$"} ) + cls.unit_uom = cls.env.ref("uom.product_uom_unit") cls.test_record = cls.env["test.qweb.field.options"].create( { "name": "Test", + "quantity": 1.00, "value": 1.00, "currency_id": cls.test_currency.id, "company_id": cls.env.company.id, @@ -46,6 +54,15 @@ def setUpClass(cls): "digits": 0, } ) + cls.env["qweb.field.options"].create( + { + "res_model_id": cls.test_model.id, + "field_id": cls.quantity_field.id, + "uom_id": cls.unit_uom.id, + "uom_field_id": cls.uom_field.id, + "digits": 3, + } + ) @classmethod def tearDownClass(cls): @@ -123,3 +140,16 @@ def test_qweb_field_option_with_multiple_record(self): ) self.assertNotEqual(content, "1.0") self.assertNotIn("$", content) + + def test_qweb_field_option_with_uom(self): + values = {"report_type": "pdf"} + self.test_record.uom_id = self.unit_uom.id + _, content, _ = self.IrQweb._get_field( + self.test_record, "quantity", False, False, {}, values + ) + self.assertEqual(content, "1.000") + self.test_record.uom_id = self.env.ref("uom.product_uom_dozen").id + _, content, _ = self.IrQweb._get_field( + self.test_record, "quantity", False, False, {}, values + ) + self.assertEqual(content, "1.0") From 9f4e2b827be566aeed9ff199960cf938cdf4fec3 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 10 Sep 2025 14:12:51 +0000 Subject: [PATCH 11/18] [UPD] Update report_qweb_field_option.pot --- .../i18n/report_qweb_field_option.pot | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/report_qweb_field_option/i18n/report_qweb_field_option.pot b/report_qweb_field_option/i18n/report_qweb_field_option.pot index f8c1ee006e..7dd2a3f640 100644 --- a/report_qweb_field_option/i18n/report_qweb_field_option.pot +++ b/report_qweb_field_option/i18n/report_qweb_field_option.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -85,17 +85,11 @@ msgstr "" #. module: report_qweb_field_option #. odoo-python #: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 -#, python-format msgid "" "Invalid string for the Options field: %(field_options)s.\n" "Error: %(error)s" msgstr "" -#. module: report_qweb_field_option -#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options____last_update -msgid "Last Modified on" -msgstr "" - #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid msgid "Last Updated by" @@ -125,7 +119,6 @@ msgstr "" #. module: report_qweb_field_option #. odoo-python #: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 -#, python-format msgid "Options must be a dictionary, but got %s" msgstr "" From 4234a6630cb3ef7d6bf343f92efe5d32d49f5175 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 10 Sep 2025 14:15:55 +0000 Subject: [PATCH 12/18] [BOT] post-merge updates --- report_qweb_field_option/README.rst | 32 ++++++++------ .../static/description/index.html | 43 +++++++++++-------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index b7fcfc05e2..b0dc1d3f8d 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ======================== Report Qweb Field Option ======================== @@ -7,13 +11,13 @@ Report Qweb Field Option !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:4d7a21349927626f4c4d13d7cdfc44101ee60a67b7cbb3d72aa53484f5822ede + !! source digest: sha256:9f92f02a3f0144fa239be9348673fd9b15602d13d9e6fcb626eeecfb48e16cc9 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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 +.. |badge2| image:: https://img.shields.io/badge/license-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%2Freporting--engine-lightgray.png?logo=github @@ -45,15 +49,15 @@ create records according to your needs. For each record: -- Set **Model** and **Field** (required) -- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** - only for fields of float type (optional) -- Set **Company** (optional) -- Set **Options** as a string representation of a dictionary. E.g., - ``{"widget": "date"}``, ``{"widget": "monetary"}``, or - ``{'widget': 'contact', 'fields': ['name', 'phone']}`` -- Set **Digits** (only for float-type fields). The value is ignored if - Options is set +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** + only for fields of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., + ``{"widget": "date"}``, ``{"widget": "monetary"}``, or + ``{'widget': 'contact', 'fields': ['name', 'phone']}`` +- Set **Digits** (only for float-type fields). The value is ignored if + Options is set Usage ===== @@ -100,10 +104,10 @@ Authors Contributors ------------ -- `Quartile `__: +- `Quartile `__: - - Yoshi Tashiro - - Aung Ko Ko Lin + - Yoshi Tashiro + - Aung Ko Ko Lin Maintainers ----------- diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 9bf2fb7840..83d3c0242e 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -3,15 +3,16 @@ -Report Qweb Field Option +README.rst -
-

Report Qweb Field Option

+
+ + +Odoo Community Association + +
+

Report Qweb Field Option

-

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module allows administrators to define the decimal precision of float fields and add option values to fields (e.g., adding a date widget option to datetime fields) for QWeb report and view presentation.

@@ -388,7 +394,7 @@

Report Qweb Field Option

-

Configuration

+

Configuration

Go to Settings > Technical > Reporting > Qweb Field Options, and create records according to your needs.

For each record:

@@ -405,7 +411,7 @@

Configuration

-

Usage

+

Usage

Print a QWeb report (quotation, invoice, purchase order, etc.), and the value presentation for fields like line quantity, price unit and date order are adjusted according to the Qweb Field Options configuration.

@@ -413,7 +419,7 @@

Usage

strictest condition will be applied.

-

Known issues / Roadmap

+

Known issues / Roadmap

Assigning Options in a QWeb Field Options record can cause UI issues if a field is defined twice with different widgets in a view.

For example, adding {"widget": "date"} to the date_approve field in @@ -424,7 +430,7 @@

Known issues / Roadmap

https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

-

Bug Tracker

+

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 @@ -432,15 +438,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Quartile
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

@@ -461,5 +469,6 @@

Maintainers

+
From 53c27aff80be5a61baabe7acb9bf8fd26e99b37f Mon Sep 17 00:00:00 2001 From: Bosd Date: Thu, 11 Sep 2025 07:08:14 +0000 Subject: [PATCH 13/18] Added translation using Weblate (Dutch) --- report_qweb_field_option/i18n/nl.po | 151 ++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 report_qweb_field_option/i18n/nl.po diff --git a/report_qweb_field_option/i18n/nl.po b/report_qweb_field_option/i18n/nl.po new file mode 100644 index 0000000000..9df525e55a --- /dev/null +++ b/report_qweb_field_option/i18n/nl.po @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_field_option +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: nl\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" + +#. module: report_qweb_field_option +#: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options +msgid "" +"A string representation of a dictionary to specify field formatting options. Examples:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id +msgid "Company" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid +msgid "Created by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date +msgid "Created on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id +msgid "Currency" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id +msgid "Currency Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits +msgid "Digits" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name +msgid "Display Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id +msgid "Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name +msgid "Field Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type +msgid "Field Type" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Group By" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id +msgid "ID" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +msgid "" +"Invalid string for the Options field: %(field_options)s.\n" +"Error: %(error)s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date +msgid "Last Updated on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Model" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name +msgid "Model Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options +msgid "Options" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +msgid "Options must be a dictionary, but got %s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model,name:report_qweb_field_option.model_ir_qweb +msgid "Qweb" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view +#: model:ir.model,name:report_qweb_field_option.model_qweb_field_options +#: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options +msgid "Qweb Field Options" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Qweb Field Options Search" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id +msgid "UoM" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id +msgid "UoM Field" +msgstr "" From 96037f9311a02a6a6262678c4472f406750dff35 Mon Sep 17 00:00:00 2001 From: Bosd Date: Thu, 11 Sep 2025 07:10:20 +0000 Subject: [PATCH 14/18] Added translation using Weblate (Dutch (nl_NL)) --- report_qweb_field_option/i18n/nl_NL.po | 151 +++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 report_qweb_field_option/i18n/nl_NL.po diff --git a/report_qweb_field_option/i18n/nl_NL.po b/report_qweb_field_option/i18n/nl_NL.po new file mode 100644 index 0000000000..354ddf58e1 --- /dev/null +++ b/report_qweb_field_option/i18n/nl_NL.po @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_field_option +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: nl_NL\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" + +#. module: report_qweb_field_option +#: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options +msgid "" +"A string representation of a dictionary to specify field formatting options. Examples:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id +msgid "Company" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid +msgid "Created by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date +msgid "Created on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id +msgid "Currency" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id +msgid "Currency Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits +msgid "Digits" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name +msgid "Display Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id +msgid "Field" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name +msgid "Field Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type +msgid "Field Type" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Group By" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id +msgid "ID" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +msgid "" +"Invalid string for the Options field: %(field_options)s.\n" +"Error: %(error)s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date +msgid "Last Updated on" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Model" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name +msgid "Model Name" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options +msgid "Options" +msgstr "" + +#. module: report_qweb_field_option +#. odoo-python +#: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 +msgid "Options must be a dictionary, but got %s" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model,name:report_qweb_field_option.model_ir_qweb +msgid "Qweb" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view +#: model:ir.model,name:report_qweb_field_option.model_qweb_field_options +#: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options +msgid "Qweb Field Options" +msgstr "" + +#. module: report_qweb_field_option +#: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh +msgid "Qweb Field Options Search" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id +msgid "UoM" +msgstr "" + +#. module: report_qweb_field_option +#: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id +msgid "UoM Field" +msgstr "" From abd19271630bb76e1bc0a3ae0fc4fcfd02a8393a Mon Sep 17 00:00:00 2001 From: nobuQuartile Date: Thu, 11 Sep 2025 06:59:14 +0000 Subject: [PATCH 15/18] [IMP] report_qweb_field_option: Update ROADMAP --- report_qweb_field_option/README.rst | 23 +++++--- report_qweb_field_option/readme/CONFIGURE.md | 2 +- report_qweb_field_option/readme/ROADMAP.md | 23 +++++--- .../static/description/index.html | 58 ++++++++++--------- 4 files changed, 61 insertions(+), 45 deletions(-) diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index b0dc1d3f8d..07b285ce3c 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ======================== Report Qweb Field Option ======================== @@ -17,7 +13,7 @@ Report Qweb Field Option .. |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/license-AGPL--3-blue.png +.. |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%2Freporting--engine-lightgray.png?logo=github @@ -55,7 +51,7 @@ For each record: - Set **Company** (optional) - Set **Options** as a string representation of a dictionary. E.g., ``{"widget": "date"}``, ``{"widget": "monetary"}``, or - ``{'widget': 'contact', 'fields': ['name', 'phone']}`` + ``{"widget": "contact", "fields": ["name", "phone"]}`` - Set **Digits** (only for float-type fields). The value is ignored if Options is set @@ -72,8 +68,19 @@ strictest condition will be applied. Known issues / Roadmap ====================== -Assigning Options in a QWeb Field Options record can cause UI issues if -a field is defined twice with different widgets in a view. +| #. QWeb field option settings only apply to fields rendered with + ``t-field``. +| They don’t work with ``t-esc`` or other expressions not using + ``t-field``. + +As a workaround, you could create a module that adds a computed field +holding the same value currently computed and displayed in the QWeb +report using ``t-esc``, and adjust the report template to display the +field value using ``t-field``. This would allow you to adjust the +decimal precision as needed. + +#. Assigning Options in a QWeb Field Options record can cause UI issues +if a field is defined twice with different widgets in a view. For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase order can result in two dates appearing under the diff --git a/report_qweb_field_option/readme/CONFIGURE.md b/report_qweb_field_option/readme/CONFIGURE.md index 3ee9330c05..e8532ad73a 100644 --- a/report_qweb_field_option/readme/CONFIGURE.md +++ b/report_qweb_field_option/readme/CONFIGURE.md @@ -9,6 +9,6 @@ For each record: - Set **Company** (optional) - Set **Options** as a string representation of a dictionary. E.g., `{"widget": "date"}`, `{"widget": "monetary"}`, or - `{'widget': 'contact', 'fields': ['name', 'phone']}` + `{"widget": "contact", "fields": ["name", "phone"]}` - Set **Digits** (only for float-type fields). The value is ignored if Options is set diff --git a/report_qweb_field_option/readme/ROADMAP.md b/report_qweb_field_option/readme/ROADMAP.md index 8064f04184..94caec7c82 100644 --- a/report_qweb_field_option/readme/ROADMAP.md +++ b/report_qweb_field_option/readme/ROADMAP.md @@ -1,10 +1,17 @@ -Assigning Options in a QWeb Field Options record can cause UI issues if -a field is defined twice with different widgets in a view. +#. QWeb field option settings only apply to fields rendered with ``t-field``. + They don’t work with ``t-esc`` or other expressions not using ``t-field``. -For example, adding `{"widget": "date"}` to the date_approve field in a -purchase order can result in two dates appearing under the Confirmation -Date column in the portal view. This occurs because the field is defined -twice with different widgets. + As a workaround, you could create a module that adds a computed field holding the + same value currently computed and displayed in the QWeb report using ``t-esc``, and + adjust the report template to display the field value using ``t-field``. This would + allow you to adjust the decimal precision as needed. -Reference: - + +#. Assigning Options in a QWeb Field Options record can cause UI issues if a field is + defined twice with different widgets in a view. + + For example, adding ``{"widget": "date"}`` to the date_approve field in a purchase + order can result in two dates appearing under the Confirmation Date column in the + portal view. This occurs because the field is defined twice with different widgets. + + Reference: https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102 \ No newline at end of file diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 83d3c0242e..0d7e74577f 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -3,16 +3,15 @@ -README.rst +Report Qweb Field Option -
+
+

Report Qweb Field Option

- - -Odoo Community Association - -
-

Report Qweb Field Option

-

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module allows administrators to define the decimal precision of float fields and add option values to fields (e.g., adding a date widget option to datetime fields) for QWeb report and view presentation.

@@ -394,7 +388,7 @@

Report Qweb Field Option

-

Configuration

+

Configuration

Go to Settings > Technical > Reporting > Qweb Field Options, and create records according to your needs.

For each record:

@@ -405,13 +399,13 @@

Configuration

  • Set Company (optional)
  • Set Options as a string representation of a dictionary. E.g., {"widget": "date"}, {"widget": "monetary"}, or -{'widget': 'contact', 'fields': ['name', 'phone']}
  • +{"widget": "contact", "fields": ["name", "phone"]}
  • Set Digits (only for float-type fields). The value is ignored if Options is set
  • -

    Usage

    +

    Usage

    Print a QWeb report (quotation, invoice, purchase order, etc.), and the value presentation for fields like line quantity, price unit and date order are adjusted according to the Qweb Field Options configuration.

    @@ -419,9 +413,20 @@

    Usage

    strictest condition will be applied.

    -

    Known issues / Roadmap

    -

    Assigning Options in a QWeb Field Options record can cause UI issues if -a field is defined twice with different widgets in a view.

    +

    Known issues / Roadmap

    +
    +
    #. QWeb field option settings only apply to fields rendered with +t-field.
    +
    They don’t work with t-esc or other expressions not using +t-field.
    +
    +

    As a workaround, you could create a module that adds a computed field +holding the same value currently computed and displayed in the QWeb +report using t-esc, and adjust the report template to display the +field value using t-field. This would allow you to adjust the +decimal precision as needed.

    +

    #. Assigning Options in a QWeb Field Options record can cause UI issues +if a field is defined twice with different widgets in a view.

    For example, adding {"widget": "date"} to the date_approve field in a purchase order can result in two dates appearing under the Confirmation Date column in the portal view. This occurs because the @@ -430,7 +435,7 @@

    Known issues / Roadmap

    https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

    -

    Bug Tracker

    +

    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 @@ -438,15 +443,15 @@

    Bug Tracker

    Do not contact contributors directly about support or help with technical issues.

    -

    Credits

    +

    Credits

    -

    Authors

    +

    Authors

    • Quartile
    -

    Contributors

    +

    Contributors

    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    - -Odoo Community Association - +Odoo Community Association

    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.

    @@ -469,6 +472,5 @@

    Maintainers

    -
    From 739dfb00f81e4b933b1731764d5a3022119c8621 Mon Sep 17 00:00:00 2001 From: Bosd Date: Thu, 11 Sep 2025 07:10:37 +0000 Subject: [PATCH 16/18] Translated using Weblate (Dutch (nl_NL)) Currently translated at 100.0% (25 of 25 strings) Translation: reporting-engine-18.0/reporting-engine-18.0-report_qweb_field_option Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_qweb_field_option/nl_NL/ --- report_qweb_field_option/i18n/nl_NL.po | 57 +++++++++++++++----------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/report_qweb_field_option/i18n/nl_NL.po b/report_qweb_field_option/i18n/nl_NL.po index 354ddf58e1..c6e2604734 100644 --- a/report_qweb_field_option/i18n/nl_NL.po +++ b/report_qweb_field_option/i18n/nl_NL.po @@ -6,13 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2025-09-11 09:42+0000\n" +"Last-Translator: Bosd \n" "Language-Team: none\n" "Language: nl_NL\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 5.10.4\n" #. module: report_qweb_field_option #: model:ir.model.fields,help:report_qweb_field_option.field_qweb_field_options__field_options @@ -22,66 +24,71 @@ msgid "" "{'widget': 'monetary'}\n" "{'widget': 'contact', 'fields': ['name', 'phone']}" msgstr "" +"Een stringweergave van een woordenboek om veldopmaakopties te specificeren. " +"Voorbeelden:\n" +"{'widget': 'date'}\n" +"{'widget': 'monetary'}\n" +"{'widget': 'contact', 'fields': ['name', 'phone']}" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__company_id msgid "Company" -msgstr "" +msgstr "Bedrijf" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_uid msgid "Created by" -msgstr "" +msgstr "Aangemaakt door" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__create_date msgid "Created on" -msgstr "" +msgstr "Aangemaakt op" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_id msgid "Currency" -msgstr "" +msgstr "Valuta" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__currency_field_id msgid "Currency Field" -msgstr "" +msgstr "Valutaveld" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__digits msgid "Digits" -msgstr "" +msgstr "Cijfers" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__display_name msgid "Display Name" -msgstr "" +msgstr "Weergavenaam" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_id msgid "Field" -msgstr "" +msgstr "Veld" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_name msgid "Field Name" -msgstr "" +msgstr "Veldnaam" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_type msgid "Field Type" -msgstr "" +msgstr "Veldtype" #. module: report_qweb_field_option #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Group By" -msgstr "" +msgstr "Groeperen op" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__id msgid "ID" -msgstr "" +msgstr "ID" #. module: report_qweb_field_option #. odoo-python @@ -90,62 +97,64 @@ msgid "" "Invalid string for the Options field: %(field_options)s.\n" "Error: %(error)s" msgstr "" +"Ongeldige string voor het veld Opties: %(field_options)s.\n" +"Fout: %(error)s" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Laatst bijgewerkt door" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__write_date msgid "Last Updated on" -msgstr "" +msgstr "Laatst bijgewerkt op" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_id #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Model" -msgstr "" +msgstr "Model" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__res_model_name msgid "Model Name" -msgstr "" +msgstr "Modelnaam" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__field_options msgid "Options" -msgstr "" +msgstr "Opties" #. module: report_qweb_field_option #. odoo-python #: code:addons/report_qweb_field_option/models/qweb_field_options.py:0 msgid "Options must be a dictionary, but got %s" -msgstr "" +msgstr "Opties moeten een woordenboek zijn, maar kregen %s" #. module: report_qweb_field_option #: model:ir.model,name:report_qweb_field_option.model_ir_qweb msgid "Qweb" -msgstr "" +msgstr "Qweb" #. module: report_qweb_field_option #: model:ir.actions.act_window,name:report_qweb_field_option.action_qweb_field_options_view #: model:ir.model,name:report_qweb_field_option.model_qweb_field_options #: model:ir.ui.menu,name:report_qweb_field_option.menu_qweb_field_options msgid "Qweb Field Options" -msgstr "" +msgstr "Qweb Veldopties" #. module: report_qweb_field_option #: model_terms:ir.ui.view,arch_db:report_qweb_field_option.view_qweb_field_options_searh msgid "Qweb Field Options Search" -msgstr "" +msgstr "Zoeken in Qweb Veldopties" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_id msgid "UoM" -msgstr "" +msgstr "Eenheid" #. module: report_qweb_field_option #: model:ir.model.fields,field_description:report_qweb_field_option.field_qweb_field_options__uom_field_id msgid "UoM Field" -msgstr "" +msgstr "Eenheid Veld" From 6580a9f6b3a586a349d131dec3135c3abe71b61d Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 12 Sep 2025 19:20:44 +0000 Subject: [PATCH 17/18] [BOT] post-merge updates --- report_qweb_field_option/README.rst | 8 +++- report_qweb_field_option/__manifest__.py | 2 +- .../static/description/index.html | 43 +++++++++++-------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index 07b285ce3c..ee4a44ca34 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ======================== Report Qweb Field Option ======================== @@ -7,13 +11,13 @@ Report Qweb Field Option !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:9f92f02a3f0144fa239be9348673fd9b15602d13d9e6fcb626eeecfb48e16cc9 + !! source digest: sha256:6a839e0b8361541500cea7946ac9d7bfbcbe37ab2a102576061a2940c4343c5c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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 +.. |badge2| image:: https://img.shields.io/badge/license-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%2Freporting--engine-lightgray.png?logo=github diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py index 0bf473c1c8..10d68fd497 100644 --- a/report_qweb_field_option/__manifest__.py +++ b/report_qweb_field_option/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Report Qweb Field Option", - "version": "18.0.1.0.0", + "version": "18.0.1.0.1", "category": "Technical Settings", "license": "AGPL-3", "author": "Quartile, Odoo Community Association (OCA)", diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 0d7e74577f..65f598bd40 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -3,15 +3,16 @@ -Report Qweb Field Option +README.rst -
    -

    Report Qweb Field Option

    +
    + + +Odoo Community Association + +
    +

    Report Qweb Field Option

    -

    Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

    +

    Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

    This module allows administrators to define the decimal precision of float fields and add option values to fields (e.g., adding a date widget option to datetime fields) for QWeb report and view presentation.

    @@ -388,7 +394,7 @@

    Report Qweb Field Option

    -

    Configuration

    +

    Configuration

    Go to Settings > Technical > Reporting > Qweb Field Options, and create records according to your needs.

    For each record:

    @@ -405,7 +411,7 @@

    Configuration

    -

    Usage

    +

    Usage

    Print a QWeb report (quotation, invoice, purchase order, etc.), and the value presentation for fields like line quantity, price unit and date order are adjusted according to the Qweb Field Options configuration.

    @@ -413,7 +419,7 @@

    Usage

    strictest condition will be applied.

    -

    Known issues / Roadmap

    +

    Known issues / Roadmap

    #. QWeb field option settings only apply to fields rendered with t-field.
    @@ -435,7 +441,7 @@

    Known issues / Roadmap

    https://github.com/odoo/odoo/blob/5eec379/addons/purchase/views/portal_templates.xml#L101-L102

    -

    Bug Tracker

    +

    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 @@ -443,15 +449,15 @@

    Bug Tracker

    Do not contact contributors directly about support or help with technical issues.

    -

    Credits

    +

    Credits

    -

    Authors

    +

    Authors

    • Quartile
    -

    Contributors

    +

    Contributors

    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    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.

    @@ -472,5 +480,6 @@

    Maintainers

    +
    From 467ab9761e0512391b3800a8883240a4d32918bc Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Thu, 9 Oct 2025 04:22:05 +0000 Subject: [PATCH 18/18] [MIG] report_qweb_field_option: Migration to 19.0 --- report_qweb_field_option/README.rst | 34 +++++++++---------- report_qweb_field_option/__manifest__.py | 2 +- .../models/qweb_field_options.py | 13 ++++--- .../static/description/index.html | 6 ++-- .../tests/test_report_qweb_field_options.py | 19 ++++------- .../views/qweb_field_options_views.xml | 2 +- 6 files changed, 37 insertions(+), 39 deletions(-) diff --git a/report_qweb_field_option/README.rst b/report_qweb_field_option/README.rst index ee4a44ca34..c23713d6b5 100644 --- a/report_qweb_field_option/README.rst +++ b/report_qweb_field_option/README.rst @@ -21,13 +21,13 @@ Report Qweb Field Option :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/18.0/report_qweb_field_option + :target: https://github.com/OCA/reporting-engine/tree/19.0/report_qweb_field_option :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_qweb_field_option + :target: https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_qweb_field_option :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/reporting-engine&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,15 +49,15 @@ create records according to your needs. For each record: -- Set **Model** and **Field** (required) -- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** - only for fields of float type (optional) -- Set **Company** (optional) -- Set **Options** as a string representation of a dictionary. E.g., - ``{"widget": "date"}``, ``{"widget": "monetary"}``, or - ``{"widget": "contact", "fields": ["name", "phone"]}`` -- Set **Digits** (only for float-type fields). The value is ignored if - Options is set +- Set **Model** and **Field** (required) +- Set **UoM** and **UoM Field**, or **Currency** and **Currency Field** + only for fields of float type (optional) +- Set **Company** (optional) +- Set **Options** as a string representation of a dictionary. E.g., + ``{"widget": "date"}``, ``{"widget": "monetary"}``, or + ``{"widget": "contact", "fields": ["name", "phone"]}`` +- Set **Digits** (only for float-type fields). The value is ignored if + Options is set Usage ===== @@ -100,7 +100,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. @@ -115,10 +115,10 @@ Authors Contributors ------------ -- `Quartile `__: +- `Quartile `__: - - Yoshi Tashiro - - Aung Ko Ko Lin + - Yoshi Tashiro + - Aung Ko Ko Lin Maintainers ----------- @@ -133,6 +133,6 @@ 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/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_field_option/__manifest__.py b/report_qweb_field_option/__manifest__.py index 10d68fd497..f0f6061730 100644 --- a/report_qweb_field_option/__manifest__.py +++ b/report_qweb_field_option/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Report Qweb Field Option", - "version": "18.0.1.0.1", + "version": "19.0.1.0.0", "category": "Technical Settings", "license": "AGPL-3", "author": "Quartile, Odoo Community Association (OCA)", diff --git a/report_qweb_field_option/models/qweb_field_options.py b/report_qweb_field_option/models/qweb_field_options.py index 91c4b35e0a..ca1fb3216b 100644 --- a/report_qweb_field_option/models/qweb_field_options.py +++ b/report_qweb_field_option/models/qweb_field_options.py @@ -4,7 +4,7 @@ import ast import logging -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) @@ -63,15 +63,18 @@ def _check_field_options_format(self): field_options = ast.literal_eval(rec.field_options) except Exception as e: raise ValidationError( - _( + self.env._( "Invalid string for the Options field: %(field_options)s.\n" - "Error: %(error)s" + "Error: %(error)s", + field_options=rec.field_options, + error=e, ) - % {"field_options": rec.field_options, "error": e} ) from e if not isinstance(field_options, dict): raise ValidationError( - _("Options must be a dictionary, but got %s") % type(field_options) + self.env._( + "Options must be a dictionary, but got %s", type(field_options) + ) ) def _get_score(self, record): diff --git a/report_qweb_field_option/static/description/index.html b/report_qweb_field_option/static/description/index.html index 65f598bd40..7bca445033 100644 --- a/report_qweb_field_option/static/description/index.html +++ b/report_qweb_field_option/static/description/index.html @@ -374,7 +374,7 @@

    Report Qweb Field Option

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:6a839e0b8361541500cea7946ac9d7bfbcbe37ab2a102576061a2940c4343c5c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

    +

    Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

    This module allows administrators to define the decimal precision of float fields and add option values to fields (e.g., adding a date widget option to datetime fields) for QWeb report and view presentation.

    @@ -445,7 +445,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.

    @@ -475,7 +475,7 @@

    Maintainers

    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/reporting-engine project on GitHub.

    +

    This module is part of the OCA/reporting-engine project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/report_qweb_field_option/tests/test_report_qweb_field_options.py b/report_qweb_field_option/tests/test_report_qweb_field_options.py index e55e439a6a..83931f69c1 100644 --- a/report_qweb_field_option/tests/test_report_qweb_field_options.py +++ b/report_qweb_field_option/tests/test_report_qweb_field_options.py @@ -1,9 +1,8 @@ # Copyright 2024 Quartile (https://www.quartile.co) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo_test_helper import FakeModelLoader - from odoo.exceptions import ValidationError +from odoo.orm.model_classes import add_to_registry from odoo.tests.common import TransactionCase @@ -11,14 +10,15 @@ class TestQwebFieldOptions(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() - cls.loader = FakeModelLoader(cls.env, cls.__module__) - cls.loader.backup_registry() from .test_models import TestQwebFieldModel - cls.loader.update_registry((TestQwebFieldModel,)) - cls.test_model = cls.env.ref( - "report_qweb_field_option.model_test_qweb_field_options" + add_to_registry(cls.registry, TestQwebFieldModel) + cls.registry._setup_models__(cls.env.cr, ["test.qweb.field.options"]) + cls.registry.init_models( + cls.env.cr, ["test.qweb.field.options"], {"models_to_check": True} ) + cls.addClassCleanup(cls.registry.__delitem__, "test.qweb.field.options") + cls.test_model = cls.env["ir.model"]._get("test.qweb.field.options") cls.quantity_field = cls.env["ir.model.fields"]._get( "test.qweb.field.options", "quantity" ) @@ -64,11 +64,6 @@ def setUpClass(cls): } ) - @classmethod - def tearDownClass(cls): - cls.loader.restore_registry() - return super().tearDownClass() - def test_qweb_field_option(self): values = {"report_type": "pdf"} # Test with 0 digits diff --git a/report_qweb_field_option/views/qweb_field_options_views.xml b/report_qweb_field_option/views/qweb_field_options_views.xml index 679477d4d5..8d9bcddaad 100644 --- a/report_qweb_field_option/views/qweb_field_options_views.xml +++ b/report_qweb_field_option/views/qweb_field_options_views.xml @@ -48,7 +48,7 @@ - +