diff --git a/purchase_next_reception_date/README.rst b/purchase_next_reception_date/README.rst new file mode 100644 index 00000000..43cf4a51 --- /dev/null +++ b/purchase_next_reception_date/README.rst @@ -0,0 +1,61 @@ +============================ +Purchase Next Reception Date +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_next_reception_date + :alt: qrtl/axls-custom + +|badge1| |badge2| |badge3| + +This module adds next_reception_date in purchase order to recognize the upcoming receipt date of the orders. + +Background +~~~~~~~~~~ + +For purchase orders with multiple order lines, each having different 'date_planned' values, +the expected arrival date field will not display the next order line's 'date_planned' after the first reception has been completed. +Due to this condition, purchase users are required to open each record individually to see the upcoming receipt dates of the other order lines. + +The 'Next Reception Date' field is designed to provide information about the upcoming reception date of orders at a glance in the purchase order list view. + +**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 smashing 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_next_reception_date/__init__.py b/purchase_next_reception_date/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/purchase_next_reception_date/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_next_reception_date/__manifest__.py b/purchase_next_reception_date/__manifest__.py new file mode 100644 index 00000000..609496d7 --- /dev/null +++ b/purchase_next_reception_date/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Purchase Next Reception Date", + "version": "16.0.1.0.0", + "author": "Quartile Limited", + "website": "https://www.quartile.co", + "category": "Purchase", + "license": "AGPL-3", + "depends": ["purchase_stock"], + "data": ["views/purchase_order_views.xml"], + "installable": True, +} diff --git a/purchase_next_reception_date/i18n/ja.po b/purchase_next_reception_date/i18n/ja.po new file mode 100644 index 00000000..f6d3fdb5 --- /dev/null +++ b/purchase_next_reception_date/i18n/ja.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_next_reception_date +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-24 09:19+0000\n" +"PO-Revision-Date: 2023-08-24 09:19+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_next_reception_date +#: model:ir.model.fields,field_description:purchase_next_reception_date.field_purchase_order__next_reception_date +msgid "Next Reception Date" +msgstr "次回入荷予定日" + +#. module: purchase_next_reception_date +#: model:ir.model,name:purchase_next_reception_date.model_purchase_order +msgid "Purchase Order" +msgstr "購買オーダ" diff --git a/purchase_next_reception_date/models/__init__.py b/purchase_next_reception_date/models/__init__.py new file mode 100644 index 00000000..9f035306 --- /dev/null +++ b/purchase_next_reception_date/models/__init__.py @@ -0,0 +1 @@ +from . import purchase_order diff --git a/purchase_next_reception_date/models/purchase_order.py b/purchase_next_reception_date/models/purchase_order.py new file mode 100644 index 00000000..b4e1d099 --- /dev/null +++ b/purchase_next_reception_date/models/purchase_order.py @@ -0,0 +1,36 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + next_reception_date = fields.Datetime( + compute="_compute_next_reception_date", store=True + ) + + @api.depends( + "order_line.product_id", + "order_line.product_qty", + "order_line.qty_received", + "order_line.qty_invoiced", + "order_line.date_planned", + ) + def _compute_next_reception_date(self): + for order in self: + lines = order.order_line.filtered( + lambda x: ( + ( + x.product_id.detailed_type != "service" + and x.qty_received < x.product_qty + ) + or ( + x.product_id.detailed_type == "service" + and x.qty_invoiced < x.product_qty + ) + ) + ) + dates = lines.mapped("date_planned") + order.next_reception_date = min(dates) if dates else False diff --git a/purchase_next_reception_date/readme/DESCRIPTION.rst b/purchase_next_reception_date/readme/DESCRIPTION.rst new file mode 100644 index 00000000..13bed1e8 --- /dev/null +++ b/purchase_next_reception_date/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ +This module adds next_reception_date in purchase order to recognize the upcoming receipt date of the orders. + +Background +~~~~~~~~~~ + +For purchase orders with multiple order lines, each having different 'date_planned' values, +the expected arrival date field will not display the next order line's 'date_planned' after the first reception has been completed. +Due to this condition, purchase users are required to open each record individually to see the upcoming receipt dates of the other order lines. + +The 'Next Reception Date' field is designed to provide information about the upcoming reception date of orders at a glance in the purchase order list view. diff --git a/purchase_next_reception_date/static/description/index.html b/purchase_next_reception_date/static/description/index.html new file mode 100644 index 00000000..93ae519f --- /dev/null +++ b/purchase_next_reception_date/static/description/index.html @@ -0,0 +1,410 @@ + + + + + + +Purchase Next Reception Date + + + +
+

Purchase Next Reception Date

+ + +

Beta License: AGPL-3 qrtl/axls-custom

+

This module adds next_reception_date in purchase order to recognize the upcoming receipt date of the orders.

+
+

Background

+

For purchase orders with multiple order lines, each having different ‘date_planned’ values, +the expected arrival date field will not display the next order line’s ‘date_planned’ after the first reception has been completed. +Due to this condition, purchase users are required to open each record individually to see the upcoming receipt dates of the other order lines.

+

The ‘Next Reception Date’ field is designed to provide information about the upcoming reception date of orders at a glance in the purchase order list view.

+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+ +
+
+

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_next_reception_date/views/purchase_order_views.xml b/purchase_next_reception_date/views/purchase_order_views.xml new file mode 100644 index 00000000..ccb139cb --- /dev/null +++ b/purchase_next_reception_date/views/purchase_order_views.xml @@ -0,0 +1,65 @@ + + + + purchase.order.form + purchase.order + + + + + + + + + purchase.order.inherit.purchase.order.kpis.tree + purchase.order + + + + + + + + + purchase.order.inherit.purchase.order.tree + purchase.order + + + + + + + + + request.quotation.select + purchase.order + + + + + + + + + + + + purchase.order.select + purchase.order + + + + + + + + + + + diff --git a/setup/purchase_next_reception_date/odoo/addons/purchase_next_reception_date b/setup/purchase_next_reception_date/odoo/addons/purchase_next_reception_date new file mode 120000 index 00000000..12e10b8c --- /dev/null +++ b/setup/purchase_next_reception_date/odoo/addons/purchase_next_reception_date @@ -0,0 +1 @@ +../../../../purchase_next_reception_date \ No newline at end of file diff --git a/setup/purchase_next_reception_date/setup.py b/setup/purchase_next_reception_date/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/purchase_next_reception_date/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)