From 494a12962daf2ca6f12a5fd09f8068daa94fb394 Mon Sep 17 00:00:00 2001 From: "Yoshi Tashiro (Quartile)" Date: Wed, 4 Dec 2024 09:53:31 +0900 Subject: [PATCH] [5006][ADD] purchase_acceptance_tester (#105) --- purchase_acceptance_tester/README.rst | 67 +++ purchase_acceptance_tester/__init__.py | 1 + purchase_acceptance_tester/__manifest__.py | 17 + purchase_acceptance_tester/i18n/ja.po | 81 ++++ purchase_acceptance_tester/models/__init__.py | 4 + .../models/purchase_order.py | 25 ++ .../models/res_company.py | 10 + .../models/res_config_settings.py | 16 + .../models/res_partner.py | 13 + .../readme/CONFIGURE.md | 6 + .../readme/DESCRIPTION.md | 2 + .../static/description/index.html | 419 ++++++++++++++++++ .../views/purchase_order_views.xml | 76 ++++ .../views/res_config_settings_views.xml | 32 ++ .../views/res_partner_views.xml | 13 + .../odoo/addons/purchase_acceptance_tester | 1 + setup/purchase_acceptance_tester/setup.py | 6 + 17 files changed, 789 insertions(+) create mode 100644 purchase_acceptance_tester/README.rst create mode 100644 purchase_acceptance_tester/__init__.py create mode 100644 purchase_acceptance_tester/__manifest__.py create mode 100644 purchase_acceptance_tester/i18n/ja.po create mode 100644 purchase_acceptance_tester/models/__init__.py create mode 100644 purchase_acceptance_tester/models/purchase_order.py create mode 100644 purchase_acceptance_tester/models/res_company.py create mode 100644 purchase_acceptance_tester/models/res_config_settings.py create mode 100644 purchase_acceptance_tester/models/res_partner.py create mode 100644 purchase_acceptance_tester/readme/CONFIGURE.md create mode 100644 purchase_acceptance_tester/readme/DESCRIPTION.md create mode 100644 purchase_acceptance_tester/static/description/index.html create mode 100644 purchase_acceptance_tester/views/purchase_order_views.xml create mode 100644 purchase_acceptance_tester/views/res_config_settings_views.xml create mode 100644 purchase_acceptance_tester/views/res_partner_views.xml create mode 120000 setup/purchase_acceptance_tester/odoo/addons/purchase_acceptance_tester create mode 100644 setup/purchase_acceptance_tester/setup.py diff --git a/purchase_acceptance_tester/README.rst b/purchase_acceptance_tester/README.rst new file mode 100644 index 00000000..94313771 --- /dev/null +++ b/purchase_acceptance_tester/README.rst @@ -0,0 +1,67 @@ +========================== +Purchase Acceptance Tester +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:fa735a6e728fd196674c48fe5bae6b865e0a20e9e027ccf32140de84c8869e05 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Faxls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/axls-custom/tree/16.0/purchase_acceptance_tester + :alt: qrtl/axls-custom + +|badge1| |badge2| |badge3| + +This module adds an Acceptance Tester field to the purchase order to +indicate to whom an acceptance test request should be routed. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Go to purchase settings and select 'Enable Acceptance Tester Check' to +make the Acceptance Tester field of purchase orders required on certain +conditions (i.e. the order contains a non-service product that has not +been fully received). + +For contact records that are to be used as Acceptance Testers, select +the 'Is Acceptance Tester' field in the contact form. + +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/axls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/purchase_acceptance_tester/__init__.py b/purchase_acceptance_tester/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/purchase_acceptance_tester/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_acceptance_tester/__manifest__.py b/purchase_acceptance_tester/__manifest__.py new file mode 100644 index 00000000..45d0763a --- /dev/null +++ b/purchase_acceptance_tester/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Quartile +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Purchase Acceptance Tester", + "version": "16.0.1.0.0", + "author": "Quartile Limited", + "website": "https://www.quartile.co", + "category": "purchase", + "license": "AGPL-3", + "depends": ["purchase"], + "data": [ + "views/purchase_order_views.xml", + "views/res_config_settings_views.xml", + "views/res_partner_views.xml", + ], + "installable": True, +} diff --git a/purchase_acceptance_tester/i18n/ja.po b/purchase_acceptance_tester/i18n/ja.po new file mode 100644 index 00000000..de9afa08 --- /dev/null +++ b/purchase_acceptance_tester/i18n/ja.po @@ -0,0 +1,81 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_acceptance_tester +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-03 08:31+0000\n" +"PO-Revision-Date: 2024-12-03 08:31+0000\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: purchase_acceptance_tester +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_purchase_order__acceptance_tester_id +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_res_partner__is_acceptance_tester +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_res_users__is_acceptance_tester +#: model_terms:ir.ui.view,arch_db:purchase_acceptance_tester.purchase_order_view_search +#: model_terms:ir.ui.view,arch_db:purchase_acceptance_tester.view_purchase_order_filter +msgid "Acceptance Tester" +msgstr "受入検査依頼先" + +#. module: purchase_acceptance_tester +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_res_config_settings__enable_acceptance_tester_check +msgid "Acceptance Tester Check" +msgstr "受入検査依頼先チェック" + +#. module: purchase_acceptance_tester +#: model:ir.model,name:purchase_acceptance_tester.model_res_company +msgid "Companies" +msgstr "会社" + +#. module: purchase_acceptance_tester +#: model:ir.model,name:purchase_acceptance_tester.model_res_config_settings +msgid "Config Settings" +msgstr "コンフィグ設定" + +#. module: purchase_acceptance_tester +#: model:ir.model,name:purchase_acceptance_tester.model_res_partner +msgid "Contact" +msgstr "連絡先" + +#. module: purchase_acceptance_tester +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_res_company__enable_acceptance_tester_check +#: model_terms:ir.ui.view,arch_db:purchase_acceptance_tester.res_config_settings_view_form_purchase +msgid "Enable Acceptance Tester Check" +msgstr "受入検査依頼先項目へのチェックを有効化" + +#. module: purchase_acceptance_tester +#: model:ir.model.fields,help:purchase_acceptance_tester.field_res_config_settings__enable_acceptance_tester_check +msgid "" +"Enable the check on the Acceptance Tester field in purchase orders to " +"determine whether setting a value is required or not." +msgstr "購買オーダの受入検査依頼先項目への必須/任意のチェックを有効化します。" + +#. module: purchase_acceptance_tester +#: model_terms:ir.ui.view,arch_db:purchase_acceptance_tester.res_config_settings_view_form_purchase +msgid "" +"If this option is ticked, the Acceptance Tester field in purchase orders " +"becomes required under certain conditions." +msgstr "このオプションを選択すると、購買オーダの受入検査依頼先項目が所定の条件に応じて必須となります。" + +#. module: purchase_acceptance_tester +#: model:ir.model.fields,field_description:purchase_acceptance_tester.field_purchase_order__need_acceptance_test +msgid "Need Acceptance Test" +msgstr "要受入検査" + +#. module: purchase_acceptance_tester +#: model:ir.model,name:purchase_acceptance_tester.model_purchase_order +msgid "Purchase Order" +msgstr "購買オーダ" + +#. module: purchase_acceptance_tester +#: model:ir.model.fields,help:purchase_acceptance_tester.field_res_partner__is_acceptance_tester +#: model:ir.model.fields,help:purchase_acceptance_tester.field_res_users__is_acceptance_tester +msgid "Select this field if the partner is an acceptance tester." +msgstr "取引先が検査依頼先の場合は、この項目を選択してください。" diff --git a/purchase_acceptance_tester/models/__init__.py b/purchase_acceptance_tester/models/__init__.py new file mode 100644 index 00000000..eba22b70 --- /dev/null +++ b/purchase_acceptance_tester/models/__init__.py @@ -0,0 +1,4 @@ +from . import purchase_order +from . import res_company +from . import res_config_settings +from . import res_partner diff --git a/purchase_acceptance_tester/models/purchase_order.py b/purchase_acceptance_tester/models/purchase_order.py new file mode 100644 index 00000000..4fe35535 --- /dev/null +++ b/purchase_acceptance_tester/models/purchase_order.py @@ -0,0 +1,25 @@ +# Copyright 2024 Quartile +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + acceptance_tester_id = fields.Many2one( + "res.partner", domain=[("is_acceptance_tester", "=", True)] + ) + need_acceptance_test = fields.Boolean(compute="_compute_need_acceptance_test") + + def _compute_need_acceptance_test(self): + for order in self: + order.need_acceptance_test = False + if not order.company_id.enable_acceptance_tester_check: + continue + if order.order_line.filtered( + lambda x: x.product_id + and x.product_type != "service" + and x.qty_received != x.product_qty + ): + order.need_acceptance_test = True diff --git a/purchase_acceptance_tester/models/res_company.py b/purchase_acceptance_tester/models/res_company.py new file mode 100644 index 00000000..f5b00021 --- /dev/null +++ b/purchase_acceptance_tester/models/res_company.py @@ -0,0 +1,10 @@ +# Copyright 2024 Quartile +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + enable_acceptance_tester_check = fields.Boolean() diff --git a/purchase_acceptance_tester/models/res_config_settings.py b/purchase_acceptance_tester/models/res_config_settings.py new file mode 100644 index 00000000..2e30d739 --- /dev/null +++ b/purchase_acceptance_tester/models/res_config_settings.py @@ -0,0 +1,16 @@ +# Copyright 2024 Quartile +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + enable_acceptance_tester_check = fields.Boolean( + "Acceptance Tester Check", + related="company_id.enable_acceptance_tester_check", + readonly=False, + help="Enable the check on the Acceptance Tester field in purchase orders " + "to determine whether setting a value is required or not.", + ) diff --git a/purchase_acceptance_tester/models/res_partner.py b/purchase_acceptance_tester/models/res_partner.py new file mode 100644 index 00000000..4711ec42 --- /dev/null +++ b/purchase_acceptance_tester/models/res_partner.py @@ -0,0 +1,13 @@ +# Copyright 2024 Quartile +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + is_acceptance_tester = fields.Boolean( + "Acceptance Tester", + help="Select this field if the partner is an acceptance tester.", + ) diff --git a/purchase_acceptance_tester/readme/CONFIGURE.md b/purchase_acceptance_tester/readme/CONFIGURE.md new file mode 100644 index 00000000..43817dd7 --- /dev/null +++ b/purchase_acceptance_tester/readme/CONFIGURE.md @@ -0,0 +1,6 @@ +Go to purchase settings and select 'Enable Acceptance Tester Check' to make the +Acceptance Tester field of purchase orders required on certain conditions (i.e. the +order contains a non-service product that has not been fully received). + +For contact records that are to be used as Acceptance Testers, select the 'Is Acceptance +Tester' field in the contact form. diff --git a/purchase_acceptance_tester/readme/DESCRIPTION.md b/purchase_acceptance_tester/readme/DESCRIPTION.md new file mode 100644 index 00000000..dc790183 --- /dev/null +++ b/purchase_acceptance_tester/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds an Acceptance Tester field to the purchase order to indicate to whom an +acceptance test request should be routed. diff --git a/purchase_acceptance_tester/static/description/index.html b/purchase_acceptance_tester/static/description/index.html new file mode 100644 index 00000000..638d4cae --- /dev/null +++ b/purchase_acceptance_tester/static/description/index.html @@ -0,0 +1,419 @@ + + + + + +Purchase Acceptance Tester + + + +
+

Purchase Acceptance Tester

+ + +

Beta License: AGPL-3 qrtl/axls-custom

+

This module adds an Acceptance Tester field to the purchase order to +indicate to whom an acceptance test request should be routed.

+

Table of contents

+ +
+

Configuration

+

Go to purchase settings and select ‘Enable Acceptance Tester Check’ to +make the Acceptance Tester field of purchase orders required on certain +conditions (i.e. the order contains a non-service product that has not +been fully received).

+

For contact records that are to be used as Acceptance Testers, select +the ‘Is Acceptance Tester’ field in the contact form.

+
+
+

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/axls-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/purchase_acceptance_tester/views/purchase_order_views.xml b/purchase_acceptance_tester/views/purchase_order_views.xml new file mode 100644 index 00000000..93ef08b4 --- /dev/null +++ b/purchase_acceptance_tester/views/purchase_order_views.xml @@ -0,0 +1,76 @@ + + + + purchase.order.form + purchase.order + + + + + + + + + + purchase.order.view.tree + purchase.order + + + + + + + + + purchase.order.inherit.purchase.order.tree + purchase.order + + + + + + + + + purchase.order.select + purchase.order + + + + + + + + + + + + request.quotation.select + purchase.order + + + + + + + + + + + diff --git a/purchase_acceptance_tester/views/res_config_settings_views.xml b/purchase_acceptance_tester/views/res_config_settings_views.xml new file mode 100644 index 00000000..6fd26855 --- /dev/null +++ b/purchase_acceptance_tester/views/res_config_settings_views.xml @@ -0,0 +1,32 @@ + + + + res.config.settings.view.form.inherit.purchase + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
diff --git a/purchase_acceptance_tester/views/res_partner_views.xml b/purchase_acceptance_tester/views/res_partner_views.xml new file mode 100644 index 00000000..ca6b241c --- /dev/null +++ b/purchase_acceptance_tester/views/res_partner_views.xml @@ -0,0 +1,13 @@ + + + + res.partner.form + res.partner + + + + + + + + diff --git a/setup/purchase_acceptance_tester/odoo/addons/purchase_acceptance_tester b/setup/purchase_acceptance_tester/odoo/addons/purchase_acceptance_tester new file mode 120000 index 00000000..ed49eb4d --- /dev/null +++ b/setup/purchase_acceptance_tester/odoo/addons/purchase_acceptance_tester @@ -0,0 +1 @@ +../../../../purchase_acceptance_tester \ No newline at end of file diff --git a/setup/purchase_acceptance_tester/setup.py b/setup/purchase_acceptance_tester/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/purchase_acceptance_tester/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)