diff --git a/purchase_order_line_deep_sort/README.rst b/purchase_order_line_deep_sort/README.rst new file mode 100644 index 00000000000..12e30b88f01 --- /dev/null +++ b/purchase_order_line_deep_sort/README.rst @@ -0,0 +1,112 @@ +============================= +Purchase Order Line Deep Sort +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ccc36ea0e0f626752edce0294558e23bb1fa873da19ce4bf2725e0099cf0c94c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_line_deep_sort + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_line_deep_sort + :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/purchase-workflow&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to extend the functionality of purchase order and allow +you to manage sort of lines. + +You can set the default sort order for the current company or you can set sort +order for a particular purchase order. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* Sort criteria items can be defined with a dot notation. This means that you + can define an order as follows: **product_id.default_code**. But the field + defined must exist in database. If you define, e.g., a calculated field, sort + criteria won't work. + +Usage +===== + +#. Go to **Purchase > Settings > Default Sort Criteria** and select one. +#. You must select sort direction too. +#. Create a new purchase and add several lines. +#. On saving purchase order you must see how the purchase lines are ordered + with your selected sort order. + +Known issues / Roadmap +====================== + +* Add support for ordering purchase lines by partner. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Vicent Cubells + * Pedro M. Baeza + * Stefan Ungureanu + +* `Prothai `_: + + * Prapassorn Sornkaew (migrate to v14) + +* Heliconia Solutions Pvt. Ltd. + +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/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_order_line_deep_sort/__init__.py b/purchase_order_line_deep_sort/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/purchase_order_line_deep_sort/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_order_line_deep_sort/__manifest__.py b/purchase_order_line_deep_sort/__manifest__.py new file mode 100644 index 00000000000..06105398242 --- /dev/null +++ b/purchase_order_line_deep_sort/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3 + +{ + "name": "Purchase Order Line Deep Sort", + "version": "16.0.1.0.0", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Purchase Management", + "website": "https://github.com/OCA/purchase-workflow", + "summary": "Purchase Order Line Sort", + "depends": ["purchase"], + "data": ["views/res_config_settings_views.xml", "views/purchase_order_views.xml"], + "installable": True, +} diff --git a/purchase_order_line_deep_sort/i18n/de.po b/purchase_order_line_deep_sort/i18n/de.po new file mode 100644 index 00000000000..f69b89c45aa --- /dev/null +++ b/purchase_order_line_deep_sort/i18n/de.po @@ -0,0 +1,104 @@ +msgid "" +msgstr "" +"Project-Id-Version: ametras-xsolutions\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: German\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-Crowdin-Project: ametras-xsolutions\n" +"X-Crowdin-Project-ID: 530964\n" +"X-Crowdin-Language: de\n" +"X-Crowdin-File: /[AmetrasIntelligence.oca-migrated] 16.0/purchase_order_line_deep_sort/i18n/purchase_order_line_deep_sort.pot\n" +"X-Crowdin-File-ID: 21402\n" +"Language: de_DE\n" +"PO-Revision-Date: 2024-09-25 12:08\n" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_direction__asc +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_direction__asc +msgid "Ascending" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__date_planned +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__date_planned +msgid "By date planned" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__name +msgid "By name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_name +msgid "By product name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_default_code +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_default_code +msgid "By product reference" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__price_unit +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__price_unit +msgid "By unit price" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_company +msgid "Companies" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default Sort Criteria" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default sort criteria for purchase order lines" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Direction" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Line Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.purchase_order_form +msgid "Other Info" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Select a default sort criteria for purchase order lines." +msgstr "" + diff --git a/purchase_order_line_deep_sort/i18n/es.po b/purchase_order_line_deep_sort/i18n/es.po new file mode 100644 index 00000000000..dc722d076ad --- /dev/null +++ b/purchase_order_line_deep_sort/i18n/es.po @@ -0,0 +1,174 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_order_line_deep_sort +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-11-26 09:12+0000\n" +"PO-Revision-Date: 2018-11-26 09:12+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_direction__asc +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_direction__asc +msgid "Ascending" +msgstr "Ascendente" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__date_planned +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__date_planned +msgid "By date planned" +msgstr "Por fecha planificada" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__name +msgid "By name" +msgstr "Por nombre" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__price_unit +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__price_unit +msgid "By price" +msgstr "Por precio" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_name +msgid "By product name" +msgstr "Por nombre de producto" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_default_code +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_default_code +msgid "By product reference" +msgstr "Por referencia del producto" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_qty +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_qty +msgid "By quantity" +msgstr "Por cantidad" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default Sort Criteria" +msgstr "Criterio de ordenación por defecto" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default sort criteria for purchase order lines" +msgstr "Criterio de ordenación por defecto de las líneas del pedido de compra" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_direction__desc +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_direction__desc +msgid "Descending" +msgstr "Descendente" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Direction" +msgstr "Dirección" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_company__display_name +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_config_settings__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_company__id +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_company____last_update +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_company__default_po_line_order +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_config_settings__po_line_order_default +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Line Order" +msgstr "Línea de pedido" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.purchase_order_form +msgid "Other Info" +msgstr "Otra información" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido de compra" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order_line +#, fuzzy +msgid "Purchase Order Line" +msgstr "Pedido de compra" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Select a default sort criteria for purchase order lines." +msgstr "" +"Selecciona un criterio de ordenación por defecto de las línieas del pedido " +"de compra." + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,help:purchase_order_line_deep_sort.field_res_company__default_po_line_order +#: model:ir.model.fields,help:purchase_order_line_deep_sort.field_res_config_settings__po_line_order_default +msgid "Select a sorting criteria for purchase order lines." +msgstr "" +"Selecciona un criterio de ordenación de las línieas del pedido de compra." + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,help:purchase_order_line_deep_sort.field_res_company__default_po_line_direction +#: model:ir.model.fields,help:purchase_order_line_deep_sort.field_res_config_settings__po_line_direction_default +msgid "Select a sorting direction for purchase order lines." +msgstr "" +"Selecciona una dirección de ordenación de las línieas del pedido de compra." + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order__line_direction +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_company__default_po_line_direction +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_res_config_settings__po_line_direction_default +msgid "Sort Direction" +msgstr "Dirección de ordenación" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields,field_description:purchase_order_line_deep_sort.field_purchase_order__line_order +msgid "Sort Lines By" +msgstr "Ordenar las líneas por" + +#, fuzzy +#~ msgid "Config Settings" +#~ msgstr "res.config.settings" diff --git a/purchase_order_line_deep_sort/i18n/fr.po b/purchase_order_line_deep_sort/i18n/fr.po new file mode 100644 index 00000000000..473f53ab1c9 --- /dev/null +++ b/purchase_order_line_deep_sort/i18n/fr.po @@ -0,0 +1,104 @@ +msgid "" +msgstr "" +"Project-Id-Version: ametras-xsolutions\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: French\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-Crowdin-Project: ametras-xsolutions\n" +"X-Crowdin-Project-ID: 530964\n" +"X-Crowdin-Language: fr\n" +"X-Crowdin-File: /[AmetrasIntelligence.oca-migrated] 16.0/purchase_order_line_deep_sort/i18n/purchase_order_line_deep_sort.pot\n" +"X-Crowdin-File-ID: 21402\n" +"Language: fr_FR\n" +"PO-Revision-Date: 2024-09-25 12:08\n" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_direction__asc +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_direction__asc +msgid "Ascending" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__date_planned +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__date_planned +msgid "By date planned" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__name +msgid "By name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_name +msgid "By product name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_default_code +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_default_code +msgid "By product reference" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__price_unit +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__price_unit +msgid "By unit price" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_company +msgid "Companies" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default Sort Criteria" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default sort criteria for purchase order lines" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Direction" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Line Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.purchase_order_form +msgid "Other Info" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Select a default sort criteria for purchase order lines." +msgstr "" + diff --git a/purchase_order_line_deep_sort/i18n/purchase_order_line_deep_sort.pot b/purchase_order_line_deep_sort/i18n/purchase_order_line_deep_sort.pot new file mode 100644 index 00000000000..8a3dbbb6c9d --- /dev/null +++ b/purchase_order_line_deep_sort/i18n/purchase_order_line_deep_sort.pot @@ -0,0 +1,100 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_order_line_deep_sort +# +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: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_direction__asc +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_direction__asc +msgid "Ascending" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__date_planned +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__date_planned +msgid "By date planned" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__name +msgid "By name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_name +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_name +msgid "By product name" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__product_id_default_code +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__product_id_default_code +msgid "By product reference" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__purchase_order__line_order__price_unit +#: model:ir.model.fields.selection,name:purchase_order_line_deep_sort.selection__res_company__default_po_line_order__price_unit +msgid "By unit price" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_company +msgid "Companies" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default Sort Criteria" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Default sort criteria for purchase order lines" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Direction" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Line Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.purchase_order_form +msgid "Other Info" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model:ir.model,name:purchase_order_line_deep_sort.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_order_line_deep_sort +#: model_terms:ir.ui.view,arch_db:purchase_order_line_deep_sort.res_config_settings_view_form +msgid "Select a default sort criteria for purchase order lines." +msgstr "" diff --git a/purchase_order_line_deep_sort/models/__init__.py b/purchase_order_line_deep_sort/models/__init__.py new file mode 100644 index 00000000000..8b19d0da10e --- /dev/null +++ b/purchase_order_line_deep_sort/models/__init__.py @@ -0,0 +1,3 @@ +from . import purchase_order +from . import res_company +from . import res_config_settings diff --git a/purchase_order_line_deep_sort/models/purchase_order.py b/purchase_order_line_deep_sort/models/purchase_order.py new file mode 100644 index 00000000000..37b07526ebb --- /dev/null +++ b/purchase_order_line_deep_sort/models/purchase_order.py @@ -0,0 +1,80 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2019 Tecnativa - Pedro M. Baeza +# Copyright 2019 Tecnativa - Sergio Teruel +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3 + +from odoo import api, fields, models + +from .res_company import SORTING_CRITERIA, SORTING_DIRECTION + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + line_order = fields.Selection( + selection=SORTING_CRITERIA, + string="Sort Lines By", + default=lambda self: self.env.user.company_id.default_po_line_order, + ) + line_direction = fields.Selection( + selection=SORTING_DIRECTION, + string="Sort Direction", + default=lambda self: self.env.user.company_id.default_po_line_direction, + ) + + @api.onchange("line_order") + def onchange_line_order(self): + if not self.line_order: + self.line_direction = False + + def _sort_purchase_line(self): + def resolve_subfields(obj, line_order): + subfields = line_order.split(".") + res = obj + str_fields = ("text", "varchar", "timestamp", "date") + for subfield in subfields: + if res._fields[subfield].column_type[0] in str_fields: + res = getattr(res, subfield) or "" + else: + res = getattr(res, subfield) + return res + + if not self.line_order and not self.line_direction: + return + reverse = self.line_direction == "desc" + sequence = 0 + sorted_lines = self.order_line.sorted( + key=lambda p: resolve_subfields(p, self.line_order), + reverse=reverse, + ) + for line in sorted_lines: + sequence += 10 + if line.sequence == sequence: + continue + line.sequence = sequence + + def write(self, values): + res = super().write(values) + if ( + "order_line" in values + or "line_order" in values + or "line_direction" in values + ): + self._sort_purchase_line() + return res + + @api.model + def create(self, values): + purchase = super().create(values) + purchase._sort_purchase_line() + return purchase + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + @api.model + def create(self, vals): + line = super().create(vals) + line.order_id._sort_purchase_line() + return line diff --git a/purchase_order_line_deep_sort/models/res_company.py b/purchase_order_line_deep_sort/models/res_company.py new file mode 100644 index 00000000000..258d1ebdd89 --- /dev/null +++ b/purchase_order_line_deep_sort/models/res_company.py @@ -0,0 +1,33 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3 + +from odoo import fields, models + +SORTING_CRITERIA = [ + ("name", "By name"), + ("product_id.name", "By product name"), + ("product_id.default_code", "By product reference"), + ("date_planned", "By date planned"), + ("price_unit", "By unit price"), + ("product_qty", "By quantity"), +] + +SORTING_DIRECTION = [ + ("asc", "Ascending"), + ("desc", "Descending"), +] + + +class ResCompany(models.Model): + _inherit = "res.company" + + default_po_line_order = fields.Selection( + selection=SORTING_CRITERIA, + string="Line Order", + help="Select a sorting criteria for purchase order lines.", + ) + default_po_line_direction = fields.Selection( + selection=SORTING_DIRECTION, + string="Sort Direction", + help="Select a sorting direction for purchase order lines.", + ) diff --git a/purchase_order_line_deep_sort/models/res_config_settings.py b/purchase_order_line_deep_sort/models/res_config_settings.py new file mode 100644 index 00000000000..ba97ae5ee43 --- /dev/null +++ b/purchase_order_line_deep_sort/models/res_config_settings.py @@ -0,0 +1,25 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3 + +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + po_line_order_default = fields.Selection( + related="company_id.default_po_line_order", + string="Line Order", + readonly=False, + ) + po_line_direction_default = fields.Selection( + related="company_id.default_po_line_direction", + string="Sort Direction", + readonly=False, + ) + + @api.onchange("po_line_order_default") + def onchange_po_line_order_default(self): + """Reset direction line order when user remove order field value""" + if not self.po_line_order_default: + self.po_line_direction_default = False diff --git a/purchase_order_line_deep_sort/readme/CONFIGURE.rst b/purchase_order_line_deep_sort/readme/CONFIGURE.rst new file mode 100644 index 00000000000..102dc1866f7 --- /dev/null +++ b/purchase_order_line_deep_sort/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +* Sort criteria items can be defined with a dot notation. This means that you + can define an order as follows: **product_id.default_code**. But the field + defined must exist in database. If you define, e.g., a calculated field, sort + criteria won't work. diff --git a/purchase_order_line_deep_sort/readme/CONTRIBUTORS.rst b/purchase_order_line_deep_sort/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..4fdd394d759 --- /dev/null +++ b/purchase_order_line_deep_sort/readme/CONTRIBUTORS.rst @@ -0,0 +1,11 @@ +* `Tecnativa `_: + + * Vicent Cubells + * Pedro M. Baeza + * Stefan Ungureanu + +* `Prothai `_: + + * Prapassorn Sornkaew (migrate to v14) + +* Heliconia Solutions Pvt. Ltd. diff --git a/purchase_order_line_deep_sort/readme/DESCRIPTION.rst b/purchase_order_line_deep_sort/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..30a6cc53362 --- /dev/null +++ b/purchase_order_line_deep_sort/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module was written to extend the functionality of purchase order and allow +you to manage sort of lines. + +You can set the default sort order for the current company or you can set sort +order for a particular purchase order. diff --git a/purchase_order_line_deep_sort/readme/ROADMAP.rst b/purchase_order_line_deep_sort/readme/ROADMAP.rst new file mode 100644 index 00000000000..073d75e19d4 --- /dev/null +++ b/purchase_order_line_deep_sort/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Add support for ordering purchase lines by partner. diff --git a/purchase_order_line_deep_sort/readme/USAGE.rst b/purchase_order_line_deep_sort/readme/USAGE.rst new file mode 100644 index 00000000000..f719e1dba61 --- /dev/null +++ b/purchase_order_line_deep_sort/readme/USAGE.rst @@ -0,0 +1,5 @@ +#. Go to **Purchase > Settings > Default Sort Criteria** and select one. +#. You must select sort direction too. +#. Create a new purchase and add several lines. +#. On saving purchase order you must see how the purchase lines are ordered + with your selected sort order. diff --git a/purchase_order_line_deep_sort/static/description/icon.png b/purchase_order_line_deep_sort/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/purchase_order_line_deep_sort/static/description/icon.png differ diff --git a/purchase_order_line_deep_sort/static/description/index.html b/purchase_order_line_deep_sort/static/description/index.html new file mode 100644 index 00000000000..ad499505b6a --- /dev/null +++ b/purchase_order_line_deep_sort/static/description/index.html @@ -0,0 +1,469 @@ + + + + + +Purchase Order Line Deep Sort + + + +
+

Purchase Order Line Deep Sort

+ + +

Beta License: AGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runboat

+

This module was written to extend the functionality of purchase order and allow +you to manage sort of lines.

+

You can set the default sort order for the current company or you can set sort +order for a particular purchase order.

+

Table of contents

+ +
+

Configuration

+
    +
  • Sort criteria items can be defined with a dot notation. This means that you +can define an order as follows: product_id.default_code. But the field +defined must exist in database. If you define, e.g., a calculated field, sort +criteria won’t work.
  • +
+
+
+

Usage

+
    +
  1. Go to Purchase > Settings > Default Sort Criteria and select one.
  2. +
  3. You must select sort direction too.
  4. +
  5. Create a new purchase and add several lines.
  6. +
  7. On saving purchase order you must see how the purchase lines are ordered +with your selected sort order.
  8. +
+
+
+

Known issues / Roadmap

+
    +
  • Add support for ordering purchase lines by partner.
  • +
+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

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/purchase-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/purchase_order_line_deep_sort/tests/__init__.py b/purchase_order_line_deep_sort/tests/__init__.py new file mode 100644 index 00000000000..d49bc46f73d --- /dev/null +++ b/purchase_order_line_deep_sort/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_order_line_deep_sort diff --git a/purchase_order_line_deep_sort/tests/test_purchase_order_line_deep_sort.py b/purchase_order_line_deep_sort/tests/test_purchase_order_line_deep_sort.py new file mode 100644 index 00000000000..53fa6d3bf6a --- /dev/null +++ b/purchase_order_line_deep_sort/tests/test_purchase_order_line_deep_sort.py @@ -0,0 +1,165 @@ +# Copyright 2018 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields +from odoo.tests import common + + +class TestPurchaseOrderLineDeepSort(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + po_model = cls.env["purchase.order"] + cls.po_line_model = cls.env["purchase.order.line"] + cls.product_obj = cls.env["product.product"] + cls.product_1 = cls.product_obj.create( + {"name": "Test product 1", "default_code": "CDE", "standard_price": 7.5} + ) + cls.product_2 = cls.product_obj.create( + {"name": "Test product 2", "default_code": "BCD", "standard_price": 7.3} + ) + cls.product_3 = cls.product_obj.create( + {"name": "Test product 3", "default_code": "ABC", "standard_price": 7.4} + ) + supplier = cls.env["res.partner"].create({"name": "Supplier"}) + cls.po = po_model.create({"partner_id": supplier.id}) + cls.po_line_1 = cls.po_line_model.create( + { + "order_id": cls.po.id, + "product_id": cls.product_1.id, + "date_planned": "2018-11-01", + "name": "Test 1", + "product_qty": 3.0, + "product_uom": cls.product_1.uom_id.id, + "price_unit": 10.0, + } + ) + cls.po_line_2 = cls.po_line_model.create( + { + "order_id": cls.po.id, + "product_id": cls.product_2.id, + "date_planned": "2018-11-05", + "name": "Test 2", + "product_qty": 4.0, + "product_uom": cls.product_2.uom_id.id, + "price_unit": 6.0, + } + ) + cls.po_line_3 = cls.po_line_model.create( + { + "order_id": cls.po.id, + "product_id": cls.product_3.id, + "date_planned": "2018-11-03", + "name": "Test 3", + "product_qty": 2.0, + "product_uom": cls.product_3.uom_id.id, + "price_unit": 3.0, + } + ) + + def _check_value(self, lines, value1, value2): + self.assertEqual(lines[0].product_id, value1) + self.assertEqual(lines[2].product_id, value2) + + def test_without_line_order(self): + self.assertEqual(self.po.order_line[0].product_id, self.product_1) + self.assertEqual(self.po.order_line[2].product_id, self.product_3) + + def test_line_by_name(self): + """Test if lines are ordered by purchase line name""" + self.po.write({"line_order": "name", "line_direction": "asc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_1, self.product_3) + self.assertEqual(lines[1].name, "Test 2") + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_3, self.product_1) + self.assertEqual(lines[1].name, "Test 2") + + def test_line_by_product_name(self): + """Test if lines are ordered by product name""" + self.po.write({"line_order": "product_id.name", "line_direction": "asc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_1, self.product_3) + self.assertEqual(lines[1].product_id.name, "Test product 2") + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search( + [("order_id", "=", self.po.id)], order="sequence" + ) + self._check_value(lines, self.product_3, self.product_1) + self.assertEqual(lines[1].product_id.name, "Test product 2") + + def test_line_by_product_code(self): + """Test if lines are ordered by product code""" + self.po.write( + {"line_order": "product_id.default_code", "line_direction": "asc"} + ) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_3, self.product_1) + self.assertEqual(lines[1].product_id.default_code, "BCD") + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_1, self.product_3) + self.assertEqual(lines[1].product_id.default_code, "BCD") + + def test_line_by_date_planned(self): + """Test if lines are ordered by purchase line date planned""" + self.po.write({"line_order": "date_planned", "line_direction": "asc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_1, self.product_2) + self.assertEqual(fields.Date.to_string(lines[1].date_planned), "2018-11-03") + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_2, self.product_1) + self.assertEqual(fields.Date.to_string(lines[1].date_planned), "2018-11-03") + + def test_line_by_price_unit(self): + """Test if lines are ordered by purchase line price""" + self.po.write({"line_order": "price_unit", "line_direction": "asc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_3, self.product_1) + self.assertAlmostEqual(lines[1].price_unit, 6.0) + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_1, self.product_3) + self.assertAlmostEqual(lines[1].price_unit, 6.0) + + def test_line_by_product_qty(self): + """Test if lines are ordered by purchase line product_qty""" + self.po.write({"line_order": "product_qty", "line_direction": "asc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_3, self.product_2) + self.assertAlmostEqual(lines[1].product_qty, 3.0) + self.po.write({"line_direction": "desc"}) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self._check_value(lines, self.product_2, self.product_3) + self.assertAlmostEqual(lines[1].product_qty, 3.0) + + def test_product_sort_false_values(self): + """ + Test purchase order lines sorted lines with False values and + string values (default_code). + Test sort lines with numeric values with False values + """ + self.product_2.default_code = False + self.po.write( + {"line_order": "product_id.default_code", "line_direction": "asc"} + ) + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self.assertEqual(lines[0].product_id, self.product_2) + self.po.write({"line_order": "price_unit", "line_direction": "asc"}) + self.po_line_3.price_unit = 0.0 + lines = self.po_line_model.search([("order_id", "=", self.po.id)]) + self.assertEqual(lines[0], self.po_line_3) + + def test_res_config_settings(self): + purchase_config = ( + self.env["res.config.settings"] + .sudo() + .create( + {"po_line_order_default": "name", "po_line_direction_default": "asc"} + ) + ) + purchase_config.po_line_order_default = False + purchase_config.onchange_po_line_order_default() + self.assertFalse(purchase_config.po_line_direction_default) diff --git a/purchase_order_line_deep_sort/views/purchase_order_views.xml b/purchase_order_line_deep_sort/views/purchase_order_views.xml new file mode 100644 index 00000000000..90b6eb06db2 --- /dev/null +++ b/purchase_order_line_deep_sort/views/purchase_order_views.xml @@ -0,0 +1,26 @@ + + + + purchase.order + + + + + + + + + + + diff --git a/purchase_order_line_deep_sort/views/res_config_settings_views.xml b/purchase_order_line_deep_sort/views/res_config_settings_views.xml new file mode 100644 index 00000000000..f730dfd8dd1 --- /dev/null +++ b/purchase_order_line_deep_sort/views/res_config_settings_views.xml @@ -0,0 +1,57 @@ + + + + res.config.settings.purchase.sort + res.config.settings + + + +
+
+
+
+
+ + + + diff --git a/setup/purchase_order_line_deep_sort/odoo/addons/purchase_order_line_deep_sort b/setup/purchase_order_line_deep_sort/odoo/addons/purchase_order_line_deep_sort new file mode 120000 index 00000000000..a16a032e0d3 --- /dev/null +++ b/setup/purchase_order_line_deep_sort/odoo/addons/purchase_order_line_deep_sort @@ -0,0 +1 @@ +../../../../purchase_order_line_deep_sort \ No newline at end of file diff --git a/setup/purchase_order_line_deep_sort/setup.py b/setup/purchase_order_line_deep_sort/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/purchase_order_line_deep_sort/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)