From 95ede60ff0c5be5537a7138ef18773d60d10b6cf Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 27 May 2024 07:54:12 +0000 Subject: [PATCH 1/3] [ADD] product_odoo_module --- product_odoo_module/README.rst | 56 +++ product_odoo_module/__init__.py | 1 + product_odoo_module/__manifest__.py | 15 + product_odoo_module/models/__init__.py | 2 + product_odoo_module/models/product_product.py | 28 ++ .../models/product_template.py | 15 + product_odoo_module/readme/DESCRIPTION.md | 2 + .../static/description/index.html | 410 ++++++++++++++++++ .../views/product_product_views.xml | 31 ++ .../views/product_template_views.xml | 26 ++ .../odoo/addons/product_odoo_module | 1 + setup/product_odoo_module/setup.py | 6 + 12 files changed, 593 insertions(+) create mode 100644 product_odoo_module/README.rst create mode 100644 product_odoo_module/__init__.py create mode 100644 product_odoo_module/__manifest__.py create mode 100644 product_odoo_module/models/__init__.py create mode 100644 product_odoo_module/models/product_product.py create mode 100644 product_odoo_module/models/product_template.py create mode 100644 product_odoo_module/readme/DESCRIPTION.md create mode 100644 product_odoo_module/static/description/index.html create mode 100644 product_odoo_module/views/product_product_views.xml create mode 100644 product_odoo_module/views/product_template_views.xml create mode 120000 setup/product_odoo_module/odoo/addons/product_odoo_module create mode 100644 setup/product_odoo_module/setup.py diff --git a/product_odoo_module/README.rst b/product_odoo_module/README.rst new file mode 100644 index 0000000..a4236d8 --- /dev/null +++ b/product_odoo_module/README.rst @@ -0,0 +1,56 @@ +=================== +Product Odoo Module +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a2e456066195696d9c952d975a122eb0a6724401937219b667aea7525c4caab4 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-qrtl%2Fqrtl--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/qrtl-custom/tree/16.0/product_odoo_module + :alt: qrtl/qrtl-custom + +|badge1| |badge2| |badge3| + +This module adds attributes to product.template and product.product that +are required for module products. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Quartile Limited + +Maintainers +----------- + +This module is part of the `qrtl/qrtl-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/product_odoo_module/__init__.py b/product_odoo_module/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/product_odoo_module/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_odoo_module/__manifest__.py b/product_odoo_module/__manifest__.py new file mode 100644 index 0000000..224c85c --- /dev/null +++ b/product_odoo_module/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2024 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Product Odoo Module", + "version": "16.0.1.0.0", + "category": "Product", + "author": "Quartile Limited", + "website": "https://www.quartile.co", + "license": "AGPL-3", + "depends": ["product"], + "data": [ + "views/product_product_views.xml", + "views/product_template_views.xml", + ], +} diff --git a/product_odoo_module/models/__init__.py b/product_odoo_module/models/__init__.py new file mode 100644 index 0000000..049669d --- /dev/null +++ b/product_odoo_module/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template +from . import product_product diff --git a/product_odoo_module/models/product_product.py b/product_odoo_module/models/product_product.py new file mode 100644 index 0000000..618fe0a --- /dev/null +++ b/product_odoo_module/models/product_product.py @@ -0,0 +1,28 @@ +# Copyright 2024 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + technical_name = fields.Char( + related="product_tmpl_id.technical_name", store=True, readonly=False + ) + license_type = fields.Selection( + related="product_tmpl_id.license_type", store=True, readonly=False + ) + complexity = fields.Selection([("high", "High"), ("mid", "Mid"), ("low", "Low")]) + popularity_factor = fields.Float() + loc = fields.Integer(string="Lines of Code") + amount = fields.Float(compute="_compute_amount", store=True) + amount_incl_mig = fields.Float(compute="_compute_amount", store=True) + + @api.depends("list_price", "popularity_factor", "loc") + def _compute_amount(self): + for product in self: + product.amount = ( + product.list_price * product.loc * product.popularity_factor + ) + product.amount_incl_mig = product.amount * 2 diff --git a/product_odoo_module/models/product_template.py b/product_odoo_module/models/product_template.py new file mode 100644 index 0000000..a60912f --- /dev/null +++ b/product_odoo_module/models/product_template.py @@ -0,0 +1,15 @@ +# Copyright 2024 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + is_odoo_module = fields.Boolean() + technical_name = fields.Char() + license_type = fields.Selection( + [("agpl-3", "AGPL-3"), ("lgpl-3", "LGPL-3"), ("other", "Other proprietary")], + help="Select the type of license", + ) diff --git a/product_odoo_module/readme/DESCRIPTION.md b/product_odoo_module/readme/DESCRIPTION.md new file mode 100644 index 0000000..fdbedbd --- /dev/null +++ b/product_odoo_module/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds attributes to product.template and product.product that +are required for module products. diff --git a/product_odoo_module/static/description/index.html b/product_odoo_module/static/description/index.html new file mode 100644 index 0000000..9797bbb --- /dev/null +++ b/product_odoo_module/static/description/index.html @@ -0,0 +1,410 @@ + + + + + + +Product Odoo Module + + + +
+

Product Odoo Module

+ + +

Beta License: AGPL-3 qrtl/qrtl-custom

+

This module adds attributes to product.template and product.product that +are required for module products.

+

Table of contents

+ +
+

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 Limited
  • +
+
+
+

Maintainers

+

This module is part of the qrtl/qrtl-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/product_odoo_module/views/product_product_views.xml b/product_odoo_module/views/product_product_views.xml new file mode 100644 index 0000000..031e78c --- /dev/null +++ b/product_odoo_module/views/product_product_views.xml @@ -0,0 +1,31 @@ + + + product.product.form.inherit + product.product + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_odoo_module/views/product_template_views.xml b/product_odoo_module/views/product_template_views.xml new file mode 100644 index 0000000..1c6462b --- /dev/null +++ b/product_odoo_module/views/product_template_views.xml @@ -0,0 +1,26 @@ + + + product.template.form.inherit + product.template + + + + + + + + + + + + + + + + + + diff --git a/setup/product_odoo_module/odoo/addons/product_odoo_module b/setup/product_odoo_module/odoo/addons/product_odoo_module new file mode 120000 index 0000000..13a790c --- /dev/null +++ b/setup/product_odoo_module/odoo/addons/product_odoo_module @@ -0,0 +1 @@ +../../../../product_odoo_module \ No newline at end of file diff --git a/setup/product_odoo_module/setup.py b/setup/product_odoo_module/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/product_odoo_module/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 5b8b04dd45417fed6626b19cd06e459ffcf70355 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 29 May 2024 05:41:44 +0000 Subject: [PATCH 2/3] adj --- product_odoo_module/models/product_product.py | 6 ++---- product_odoo_module/models/product_template.py | 4 ---- product_odoo_module/views/product_product_views.xml | 2 +- product_odoo_module/views/product_template_views.xml | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/product_odoo_module/models/product_product.py b/product_odoo_module/models/product_product.py index 618fe0a..cb1ea02 100644 --- a/product_odoo_module/models/product_product.py +++ b/product_odoo_module/models/product_product.py @@ -7,11 +7,9 @@ class ProductProduct(models.Model): _inherit = "product.product" - technical_name = fields.Char( - related="product_tmpl_id.technical_name", store=True, readonly=False - ) license_type = fields.Selection( - related="product_tmpl_id.license_type", store=True, readonly=False + [("agpl-3", "AGPL-3"), ("lgpl-3", "LGPL-3"), ("other", "Other proprietary")], + help="Select the type of license", ) complexity = fields.Selection([("high", "High"), ("mid", "Mid"), ("low", "Low")]) popularity_factor = fields.Float() diff --git a/product_odoo_module/models/product_template.py b/product_odoo_module/models/product_template.py index a60912f..59e9819 100644 --- a/product_odoo_module/models/product_template.py +++ b/product_odoo_module/models/product_template.py @@ -9,7 +9,3 @@ class ProductTemplate(models.Model): is_odoo_module = fields.Boolean() technical_name = fields.Char() - license_type = fields.Selection( - [("agpl-3", "AGPL-3"), ("lgpl-3", "LGPL-3"), ("other", "Other proprietary")], - help="Select the type of license", - ) diff --git a/product_odoo_module/views/product_product_views.xml b/product_odoo_module/views/product_product_views.xml index 031e78c..ad8753d 100644 --- a/product_odoo_module/views/product_product_views.xml +++ b/product_odoo_module/views/product_product_views.xml @@ -15,7 +15,7 @@ string="Module Info" attrs="{'invisible': [('is_odoo_module', '=', False)]}" > - + diff --git a/product_odoo_module/views/product_template_views.xml b/product_odoo_module/views/product_template_views.xml index 1c6462b..3f9ca1c 100644 --- a/product_odoo_module/views/product_template_views.xml +++ b/product_odoo_module/views/product_template_views.xml @@ -17,7 +17,6 @@ > - From 5e9370bf1d56f9c820deab695c044e4ca429f26f Mon Sep 17 00:00:00 2001 From: Yoshi Tashiro Date: Sun, 30 Mar 2025 11:08:59 +0000 Subject: [PATCH 3/3] misc. updates --- product_odoo_module/README.rst | 2 +- product_odoo_module/__manifest__.py | 11 ++++--- product_odoo_module/data/menuitem_data.xml | 8 +++++ product_odoo_module/models/__init__.py | 3 +- .../models/product_odoo_version.py | 13 ++++++++ product_odoo_module/models/product_product.py | 26 ---------------- .../models/product_template.py | 23 +++++++++++--- product_odoo_module/models/res_company.py | 13 ++++++++ .../security/ir.model.access.csv | 3 ++ .../static/description/index.html | 3 +- .../views/product_odoo_version_views.xml | 24 ++++++++++++++ .../views/product_product_views.xml | 31 ------------------- .../views/product_template_views.xml | 29 ++++++++++++++--- .../views/res_company_views.xml | 14 +++++++++ 14 files changed, 130 insertions(+), 73 deletions(-) create mode 100644 product_odoo_module/data/menuitem_data.xml create mode 100644 product_odoo_module/models/product_odoo_version.py delete mode 100644 product_odoo_module/models/product_product.py create mode 100644 product_odoo_module/models/res_company.py create mode 100644 product_odoo_module/security/ir.model.access.csv create mode 100644 product_odoo_module/views/product_odoo_version_views.xml delete mode 100644 product_odoo_module/views/product_product_views.xml create mode 100644 product_odoo_module/views/res_company_views.xml diff --git a/product_odoo_module/README.rst b/product_odoo_module/README.rst index a4236d8..35bb9a4 100644 --- a/product_odoo_module/README.rst +++ b/product_odoo_module/README.rst @@ -46,7 +46,7 @@ Credits Authors ------- -* Quartile Limited +* Quartile Maintainers ----------- diff --git a/product_odoo_module/__manifest__.py b/product_odoo_module/__manifest__.py index 224c85c..1d95bf9 100644 --- a/product_odoo_module/__manifest__.py +++ b/product_odoo_module/__manifest__.py @@ -1,15 +1,18 @@ -# Copyright 2024 Quartile Limited -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2024-2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Product Odoo Module", "version": "16.0.1.0.0", "category": "Product", - "author": "Quartile Limited", + "author": "Quartile", "website": "https://www.quartile.co", "license": "AGPL-3", "depends": ["product"], "data": [ - "views/product_product_views.xml", + "data/menuitem_data.xml", + "security/ir.model.access.csv", + "views/product_odoo_version_views.xml", "views/product_template_views.xml", + "views/res_company_views.xml", ], } diff --git a/product_odoo_module/data/menuitem_data.xml b/product_odoo_module/data/menuitem_data.xml new file mode 100644 index 0000000..5681c05 --- /dev/null +++ b/product_odoo_module/data/menuitem_data.xml @@ -0,0 +1,8 @@ + + + diff --git a/product_odoo_module/models/__init__.py b/product_odoo_module/models/__init__.py index 049669d..7d51e3c 100644 --- a/product_odoo_module/models/__init__.py +++ b/product_odoo_module/models/__init__.py @@ -1,2 +1,3 @@ +from . import product_odoo_version from . import product_template -from . import product_product +from . import res_company diff --git a/product_odoo_module/models/product_odoo_version.py b/product_odoo_module/models/product_odoo_version.py new file mode 100644 index 0000000..0df0716 --- /dev/null +++ b/product_odoo_module/models/product_odoo_version.py @@ -0,0 +1,13 @@ +# 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 ProductOdooVersion(models.Model): + _name = "product.odoo.version" + _description = "Odoo Version" + _order = "name desc" + + name = fields.Char(required=True) + active = fields.Boolean(default=True) diff --git a/product_odoo_module/models/product_product.py b/product_odoo_module/models/product_product.py deleted file mode 100644 index cb1ea02..0000000 --- a/product_odoo_module/models/product_product.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2024 Quartile Limited -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import api, fields, models - - -class ProductProduct(models.Model): - _inherit = "product.product" - - license_type = fields.Selection( - [("agpl-3", "AGPL-3"), ("lgpl-3", "LGPL-3"), ("other", "Other proprietary")], - help="Select the type of license", - ) - complexity = fields.Selection([("high", "High"), ("mid", "Mid"), ("low", "Low")]) - popularity_factor = fields.Float() - loc = fields.Integer(string="Lines of Code") - amount = fields.Float(compute="_compute_amount", store=True) - amount_incl_mig = fields.Float(compute="_compute_amount", store=True) - - @api.depends("list_price", "popularity_factor", "loc") - def _compute_amount(self): - for product in self: - product.amount = ( - product.list_price * product.loc * product.popularity_factor - ) - product.amount_incl_mig = product.amount * 2 diff --git a/product_odoo_module/models/product_template.py b/product_odoo_module/models/product_template.py index 59e9819..56e3055 100644 --- a/product_odoo_module/models/product_template.py +++ b/product_odoo_module/models/product_template.py @@ -1,11 +1,26 @@ -# Copyright 2024 Quartile Limited -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2024-2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class ProductTemplate(models.Model): _inherit = "product.template" is_odoo_module = fields.Boolean() - technical_name = fields.Char() + odoo_version_id = fields.Many2one("product.odoo.version") + license_type = fields.Selection( + [("agpl-3", "AGPL-3"), ("lgpl-3", "LGPL-3"), ("other", "Other proprietary")], + help="Select the type of license", + ) + complexity = fields.Selection([("high", "High"), ("mid", "Mid"), ("low", "Low")]) + popularity_factor = fields.Float() + loc = fields.Integer(string="Lines of Code") + amount = fields.Float(compute="_compute_amount", store=True) + amount_incl_mig = fields.Float(compute="_compute_amount", store=True) + + @api.depends("list_price", "popularity_factor", "loc") + def _compute_amount(self): + for rec in self: + rec.amount = rec.list_price * rec.loc * rec.popularity_factor + rec.amount_incl_mig = rec.amount * 2 diff --git a/product_odoo_module/models/res_company.py b/product_odoo_module/models/res_company.py new file mode 100644 index 0000000..3695036 --- /dev/null +++ b/product_odoo_module/models/res_company.py @@ -0,0 +1,13 @@ +# 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 ResCompany(models.Model): + _inherit = "res.company" + + price_module_maint = fields.Float( + "Module Maintenance Price", + help="Standard maintenance cost per LOC (line of code).", + ) diff --git a/product_odoo_module/security/ir.model.access.csv b/product_odoo_module/security/ir.model.access.csv new file mode 100644 index 0000000..5c91165 --- /dev/null +++ b/product_odoo_module/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_product_odoo_version_user,product.odoo.version.user,model_product_odoo_version,base.group_user,1,0,0,0 +access_product_odoo_version_manager,product.odoo.version.manager,model_product_odoo_version,base.group_system,1,1,1,1 diff --git a/product_odoo_module/static/description/index.html b/product_odoo_module/static/description/index.html index 9797bbb..cf43e6b 100644 --- a/product_odoo_module/static/description/index.html +++ b/product_odoo_module/static/description/index.html @@ -1,4 +1,3 @@ - @@ -396,7 +395,7 @@

Credits

Authors

    -
  • Quartile Limited
  • +
  • Quartile
diff --git a/product_odoo_module/views/product_odoo_version_views.xml b/product_odoo_module/views/product_odoo_version_views.xml new file mode 100644 index 0000000..9b56181 --- /dev/null +++ b/product_odoo_module/views/product_odoo_version_views.xml @@ -0,0 +1,24 @@ + + + product.odoo.version.tree + product.odoo.version + + + + + + + + + Odoo Versions + product.odoo.version + tree + + + diff --git a/product_odoo_module/views/product_product_views.xml b/product_odoo_module/views/product_product_views.xml deleted file mode 100644 index ad8753d..0000000 --- a/product_odoo_module/views/product_product_views.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - product.product.form.inherit - product.product - - - - - - - - - - - - - - - - - - - - - - - diff --git a/product_odoo_module/views/product_template_views.xml b/product_odoo_module/views/product_template_views.xml index 3f9ca1c..1c6c5a8 100644 --- a/product_odoo_module/views/product_template_views.xml +++ b/product_odoo_module/views/product_template_views.xml @@ -1,8 +1,8 @@ - - product.template.form.inherit + + product.template.common.form product.template - + @@ -16,10 +16,31 @@ attrs="{'invisible': [('is_odoo_module', '=', False)]}" > - + + + + + + + + + product.template.search + product.template + + + + + + + + diff --git a/product_odoo_module/views/res_company_views.xml b/product_odoo_module/views/res_company_views.xml new file mode 100644 index 0000000..93d4927 --- /dev/null +++ b/product_odoo_module/views/res_company_views.xml @@ -0,0 +1,14 @@ + + + res.company.form + res.company + + + + + + + + + +