diff --git a/purchase_default_terms_conditions/README.rst b/purchase_default_terms_conditions/README.rst new file mode 100644 index 00000000000..a47db9964e9 --- /dev/null +++ b/purchase_default_terms_conditions/README.rst @@ -0,0 +1,106 @@ +================================= +Purchase Default Terms Conditions +================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:596bc82f83013eb1a75590ce3956db8b041598899c86fee4f9c16d3927a26286 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/purchase_default_terms_conditions + :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-17-0/purchase-workflow-17-0-purchase_default_terms_conditions + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows purchase default terms & conditions from Suppler or +Company + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +1. Go to Purchase Settings +2. Enable Default Terms & Conditions +3. Set Default Terms & Conditions +4. Set Terms & Conditions in Suppler + +Usage +===== + +To use this module, you need to: + +1. Go do Purchase App +2. Create a New Purchase/Quotation Order + +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 +------- + +* Escodoo + +Contributors +------------ + +- `Escodoo `__: + + - Marcel Savegnago + - Murtaza Mithaiwala + - Quan Nguyen + +Other credits +------------- + +The development of this module has been financially supported by: + +- Escodoo + +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_default_terms_conditions/__init__.py b/purchase_default_terms_conditions/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/purchase_default_terms_conditions/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_default_terms_conditions/__manifest__.py b/purchase_default_terms_conditions/__manifest__.py new file mode 100644 index 00000000000..72c665406e8 --- /dev/null +++ b/purchase_default_terms_conditions/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2020 - TODAY, Escodoo +# Copyright (C) 2022 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Purchase Default Terms Conditions", + "summary": """ + This module allows purchase default terms & conditions""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "Escodoo,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/purchase-workflow", + "images": ["static/description/banner.png"], + "depends": [ + "purchase", + ], + "data": [ + "views/res_config_settings.xml", + "views/res_partner_views.xml", + ], +} diff --git a/purchase_default_terms_conditions/i18n/es.po b/purchase_default_terms_conditions/i18n/es.po new file mode 100644 index 00000000000..e50e382fd76 --- /dev/null +++ b/purchase_default_terms_conditions/i18n/es.po @@ -0,0 +1,78 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_default_terms_conditions +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-04-18 08:37+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "" +"" +msgstr "" +"" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_company +msgid "Companies" +msgstr "compañías" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Insert your terms & conditions here..." +msgstr "Inserte aquí sus términos y condiciones..." + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Configuración de la agrupación de adquisición de compras" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_company__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_partner__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_users__purchase_note +msgid "Purchase Default Terms and Conditions" +msgstr "Términos y condiciones predeterminados de compra" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_purchase_order +msgid "Purchase Order" +msgstr "orden de compra" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__purchase_note +msgid "Purchase Terms & Conditions" +msgstr "Términos y condiciones de compra" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Show standard terms & conditions on orders" +msgstr "Mostrar términos estándar & condiciones en pedidos" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__use_purchase_note +msgid "Use Purchase Default Terms & Conditions" +msgstr "Usar términos y condiciones predeterminados de compra" + +#~ msgid "Config Settings" +#~ msgstr "ajustes de configuración" diff --git a/purchase_default_terms_conditions/i18n/it.po b/purchase_default_terms_conditions/i18n/it.po new file mode 100644 index 00000000000..fbd212edf34 --- /dev/null +++ b/purchase_default_terms_conditions/i18n/it.po @@ -0,0 +1,78 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_default_terms_conditions +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-03-05 14:35+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "" +"" +msgstr "" +"" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_partner +msgid "Contact" +msgstr "Contatto" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Insert your terms & conditions here..." +msgstr "Inserire qui termini e condizioni..." + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Impostazioni raggruppamento approvvigionamento acquisti" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_company__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_partner__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_users__purchase_note +msgid "Purchase Default Terms and Conditions" +msgstr "Termini e condizioni acquisto predefiniti" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__purchase_note +msgid "Purchase Terms & Conditions" +msgstr "Termini e condizioni di acquisto" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Show standard terms & conditions on orders" +msgstr "Visualizza termini e condizioni predefinite negli ordini" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__use_purchase_note +msgid "Use Purchase Default Terms & Conditions" +msgstr "Usa termini e condizioni acquisto predefiniti" + +#~ msgid "Config Settings" +#~ msgstr "Impostazioni configurazione" diff --git a/purchase_default_terms_conditions/i18n/pt_BR.po b/purchase_default_terms_conditions/i18n/pt_BR.po new file mode 100644 index 00000000000..eda17091f9c --- /dev/null +++ b/purchase_default_terms_conditions/i18n/pt_BR.po @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_default_terms_conditions +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-06 20:25+0000\n" +"PO-Revision-Date: 2024-05-22 00:02+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: \n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "" +"" +msgstr "" +"" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_partner +msgid "Contact" +msgstr "Contato" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Insert your terms & conditions here..." +msgstr "Insira seus termos e condições aqui..." + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Configurações de agrupamento de compras de compras" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_company__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_partner__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_users__purchase_note +msgid "Purchase Default Terms and Conditions" +msgstr "Termos e Condições Padrão de Compra" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido de Compra" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__purchase_note +msgid "Purchase Terms & Conditions" +msgstr "Termos e Condições de Compra" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Show standard terms & conditions on orders" +msgstr "Mostre termos e condições padrão em pedidos" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__use_purchase_note +msgid "Use Purchase Default Terms & Conditions" +msgstr "Use termos e condições padrão de compra" + +#~ msgid "Config Settings" +#~ msgstr "Ajuste de Configurações" diff --git a/purchase_default_terms_conditions/i18n/purchase_default_terms_conditions.pot b/purchase_default_terms_conditions/i18n/purchase_default_terms_conditions.pot new file mode 100644 index 00000000000..c30e1596d6c --- /dev/null +++ b/purchase_default_terms_conditions/i18n/purchase_default_terms_conditions.pot @@ -0,0 +1,69 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_default_terms_conditions +# +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_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "" +"" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_company +msgid "Companies" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_company__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_partner__purchase_note +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_users__purchase_note +msgid "Purchase Default Terms and Conditions" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model,name:purchase_default_terms_conditions.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__purchase_note +msgid "Purchase Terms & Conditions" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model_terms:ir.ui.view,arch_db:purchase_default_terms_conditions.res_config_settings_view_form_purchase +msgid "Show standard terms & conditions on orders" +msgstr "" + +#. module: purchase_default_terms_conditions +#: model:ir.model.fields,field_description:purchase_default_terms_conditions.field_res_config_settings__use_purchase_note +msgid "Use Purchase Default Terms & Conditions" +msgstr "" diff --git a/purchase_default_terms_conditions/models/__init__.py b/purchase_default_terms_conditions/models/__init__.py new file mode 100644 index 00000000000..57f8c468e48 --- /dev/null +++ b/purchase_default_terms_conditions/models/__init__.py @@ -0,0 +1,4 @@ +from . import res_company +from . import res_config_settings +from . import res_partner +from . import purchase diff --git a/purchase_default_terms_conditions/models/purchase.py b/purchase_default_terms_conditions/models/purchase.py new file mode 100644 index 00000000000..07ce36990eb --- /dev/null +++ b/purchase_default_terms_conditions/models/purchase.py @@ -0,0 +1,21 @@ +# Copyright (C) 2022 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models +from odoo.tools import is_html_empty + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + @api.onchange("partner_id", "company_id") + def onchange_partner_id(self): + if not is_html_empty(self.partner_id.purchase_note): + self.notes = self.partner_id.purchase_note + elif ( + self.env["ir.config_parameter"] + .sudo() + .get_param("purchase.use_purchase_note") + ): + self.notes = self.company_id.purchase_note + return super().onchange_partner_id() diff --git a/purchase_default_terms_conditions/models/res_company.py b/purchase_default_terms_conditions/models/res_company.py new file mode 100644 index 00000000000..4ff67689aee --- /dev/null +++ b/purchase_default_terms_conditions/models/res_company.py @@ -0,0 +1,12 @@ +# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + purchase_note = fields.Html( + string="Purchase Default Terms and Conditions", translate=True + ) diff --git a/purchase_default_terms_conditions/models/res_config_settings.py b/purchase_default_terms_conditions/models/res_config_settings.py new file mode 100644 index 00000000000..7a9c3947500 --- /dev/null +++ b/purchase_default_terms_conditions/models/res_config_settings.py @@ -0,0 +1,19 @@ +# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + purchase_note = fields.Html( + related="company_id.purchase_note", + string="Purchase Terms & Conditions", + readonly=False, + ) + + use_purchase_note = fields.Boolean( + string="Use Purchase Default Terms & Conditions", + config_parameter="purchase.use_purchase_note", + ) diff --git a/purchase_default_terms_conditions/models/res_partner.py b/purchase_default_terms_conditions/models/res_partner.py new file mode 100644 index 00000000000..5916a62b497 --- /dev/null +++ b/purchase_default_terms_conditions/models/res_partner.py @@ -0,0 +1,12 @@ +# Copyright (C) 2022 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + purchase_note = fields.Html( + string="Purchase Default Terms and Conditions", translate=True + ) diff --git a/purchase_default_terms_conditions/pyproject.toml b/purchase_default_terms_conditions/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/purchase_default_terms_conditions/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/purchase_default_terms_conditions/readme/CONFIGURE.md b/purchase_default_terms_conditions/readme/CONFIGURE.md new file mode 100644 index 00000000000..1e01371d205 --- /dev/null +++ b/purchase_default_terms_conditions/readme/CONFIGURE.md @@ -0,0 +1,6 @@ +To configure this module, you need to: + +1. Go to Purchase Settings +2. Enable Default Terms & Conditions +3. Set Default Terms & Conditions +4. Set Terms & Conditions in Suppler diff --git a/purchase_default_terms_conditions/readme/CONTRIBUTORS.md b/purchase_default_terms_conditions/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..32d765a2003 --- /dev/null +++ b/purchase_default_terms_conditions/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [Escodoo](https://www.escodoo.com.br): + - Marcel Savegnago \<\> + - Murtaza Mithaiwala \<\> + - Quan Nguyen \<\> diff --git a/purchase_default_terms_conditions/readme/CREDITS.md b/purchase_default_terms_conditions/readme/CREDITS.md new file mode 100644 index 00000000000..86c8eb8ffb8 --- /dev/null +++ b/purchase_default_terms_conditions/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +- Escodoo \<\> diff --git a/purchase_default_terms_conditions/readme/DESCRIPTION.md b/purchase_default_terms_conditions/readme/DESCRIPTION.md new file mode 100644 index 00000000000..3c7a805acbe --- /dev/null +++ b/purchase_default_terms_conditions/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows purchase default terms & conditions from Suppler or +Company diff --git a/purchase_default_terms_conditions/readme/USAGE.md b/purchase_default_terms_conditions/readme/USAGE.md new file mode 100644 index 00000000000..d8e407d6b2b --- /dev/null +++ b/purchase_default_terms_conditions/readme/USAGE.md @@ -0,0 +1,4 @@ +To use this module, you need to: + +1. Go do Purchase App +2. Create a New Purchase/Quotation Order diff --git a/purchase_default_terms_conditions/static/description/banner.png b/purchase_default_terms_conditions/static/description/banner.png new file mode 100644 index 00000000000..da4f6de2a24 Binary files /dev/null and b/purchase_default_terms_conditions/static/description/banner.png differ diff --git a/purchase_default_terms_conditions/static/description/icon.png b/purchase_default_terms_conditions/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/purchase_default_terms_conditions/static/description/icon.png differ diff --git a/purchase_default_terms_conditions/static/description/index.html b/purchase_default_terms_conditions/static/description/index.html new file mode 100644 index 00000000000..ea55899039f --- /dev/null +++ b/purchase_default_terms_conditions/static/description/index.html @@ -0,0 +1,457 @@ + + + + + +Purchase Default Terms Conditions + + + +
+

Purchase Default Terms Conditions

+ + +

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

+

This module allows purchase default terms & conditions from Suppler or +Company

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Purchase Settings
  2. +
  3. Enable Default Terms & Conditions
  4. +
  5. Set Default Terms & Conditions
  6. +
  7. Set Terms & Conditions in Suppler
  8. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go do Purchase App
  2. +
  3. Create a New Purchase/Quotation Order
  4. +
+
+
+

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

+
    +
  • Escodoo
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

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_default_terms_conditions/static/index.html b/purchase_default_terms_conditions/static/index.html new file mode 100644 index 00000000000..e08177f0d66 --- /dev/null +++ b/purchase_default_terms_conditions/static/index.html @@ -0,0 +1,700 @@ + + + + + + + Purchase Default Terms Conditions + + + +
+

Purchase Default Terms Conditions

+ + +

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

+

This module allows purchase default terms & conditions

+

Table of contents

+
+ +
+
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Purchase Settings
  2. +
  3. Enable Default Terms & Conditions
  4. +
  5. Set Default Terms & Conditions
  6. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go do Purchase App
  2. +
  3. Create a New Purchase/Quotation Order
  4. +
+
+
+

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

+
    +
  • Escodoo
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

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_default_terms_conditions/tests/__init__.py b/purchase_default_terms_conditions/tests/__init__.py new file mode 100644 index 00000000000..c9290b46556 --- /dev/null +++ b/purchase_default_terms_conditions/tests/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2022 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from . import test_purchase_order diff --git a/purchase_default_terms_conditions/tests/test_purchase_order.py b/purchase_default_terms_conditions/tests/test_purchase_order.py new file mode 100644 index 00000000000..0b0e8266c6b --- /dev/null +++ b/purchase_default_terms_conditions/tests/test_purchase_order.py @@ -0,0 +1,64 @@ +# Copyright (C) 2022 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestPurchase(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + uom_unit = cls.env.ref("uom.product_uom_unit") + cls.env.ref("uom.product_uom_hour") + cls.product_order = cls.env["product.product"].create( + { + "name": "Zed+ Antivirus", + "standard_price": 235.0, + "list_price": 280.0, + "type": "consu", + "uom_id": uom_unit.id, + "uom_po_id": uom_unit.id, + "purchase_method": "purchase", + "default_code": "PROD_ORDER", + "taxes_id": False, + } + ) + cls.partner_a.write( + {"purchase_note": "Purchase Default Terms and Conditions Partner"} + ) + + def test_onchange_partner_id(self): + purchase_order = ( + self.env["purchase.order"] + .with_context(tracking_disable=True) + .sudo() + .create( + { + "partner_id": self.partner_a.id, + } + ) + ) + purchase_order.onchange_partner_id() + PurchaseOrderLine = self.env["purchase.order.line"].with_context( + tracking_disable=True + ) + PurchaseOrderLine.sudo().create( + { + "name": self.product_order.name, + "product_id": self.product_order.id, + "product_qty": 10.0, + "product_uom": self.product_order.uom_id.id, + "price_unit": self.product_order.list_price, + "order_id": purchase_order.id, + "taxes_id": False, + } + ) + + self.partner_a.write({"purchase_note": False}) + + self.env["ir.config_parameter"].set_param("purchase.use_purchase_note", "Test") + + purchase_order.onchange_partner_id() diff --git a/purchase_default_terms_conditions/views/res_config_settings.xml b/purchase_default_terms_conditions/views/res_config_settings.xml new file mode 100644 index 00000000000..a65877561ee --- /dev/null +++ b/purchase_default_terms_conditions/views/res_config_settings.xml @@ -0,0 +1,45 @@ + + + + + res.config.settings.form (in purchase_default_terms_conditions) + + res.config.settings + + + + + + +
+
+
+
+
+
+
+
+
+
+ + +
diff --git a/purchase_default_terms_conditions/views/res_partner_views.xml b/purchase_default_terms_conditions/views/res_partner_views.xml new file mode 100644 index 00000000000..9b659154573 --- /dev/null +++ b/purchase_default_terms_conditions/views/res_partner_views.xml @@ -0,0 +1,15 @@ + + + + res.partner.purchase.note.form.inherit + res.partner + + 36 + + + + + + + +