Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions purchase_partner_selectable_option/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Purchase Partner Selectable Option
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:373f6786652d9de79637bb6c6433139c46ae818d0de3d1a53ce93d667ec42713
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.0/purchase_partner_selectable_option
: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-19-0/purchase-workflow-19-0-purchase_partner_selectable_option
: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=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module limits the partners to be selected in the purchases orders
according to the "Selectable in orders" field.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to **Contacts > Contacts**
2. Create a record and uncheck the "Selectable in purchase orders" box
on the Purchase part of the "Sales & Purchases" tab.

The "Selectable in purchase orders" field is set to True by default. To
change this default to False, adjust the system parameter
'purchase_partner_selectable_option.default_purchase_selectable' by
setting it to "0".

Usage
=====

To use this module, you need to:

1. Go to **Purchase > Orders > Request for Quotations**
2. Create a record and the previously created partner will not appear in
the Vendor field.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/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 <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_partner_selectable_option%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Pedro M. Baeza
- César A. Sánchez
- Juan Carlos Oñate

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.

.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/19.0/purchase_partner_selectable_option>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions purchase_partner_selectable_option/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
14 changes: 14 additions & 0 deletions purchase_partner_selectable_option/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase Partner Selectable Option",
"version": "19.0.1.0.0",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["purchase"],
"data": ["data/ir_config_parameter.xml", "views/res_partner_view.xml"],
"installable": True,
"maintainers": ["victoralmau"],
}
11 changes: 11 additions & 0 deletions purchase_partner_selectable_option/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- System Parameter for default purchase_selectable -->
<record id="param_deafault_purchase_selectable" model="ir.config_parameter">
<field
name="key"
>purchase_partner_selectable_option.default_purchase_selectable</field>
<field name="value">1</field>
<!-- Default is True -->
</record>
</odoo>
39 changes: 39 additions & 0 deletions purchase_partner_selectable_option/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-02 16:01+0000\n"
"PO-Revision-Date: 2023-07-20 23:11+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: \n"
"Language: es\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_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: purchase_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_purchase_order
msgid "Purchase Order"
msgstr "orden de compra"

#. module: purchase_partner_selectable_option
#: model_terms:ir.ui.view,arch_db:purchase_partner_selectable_option.view_partner_form
msgid "Selectable in orders"
msgstr "Seleccionable en pedidos"

#. module: purchase_partner_selectable_option
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_partner__purchase_selectable
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_users__purchase_selectable
msgid "Selectable in purchase orders"
msgstr "Seleccionable en pedidos de compra"
38 changes: 38 additions & 0 deletions purchase_partner_selectable_option/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-20 18:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: purchase_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"

#. module: purchase_partner_selectable_option
#: model_terms:ir.ui.view,arch_db:purchase_partner_selectable_option.view_partner_form
msgid "Selectable in orders"
msgstr "Selezionabile negli ordini"

#. module: purchase_partner_selectable_option
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_partner__purchase_selectable
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_users__purchase_selectable
msgid "Selectable in purchase orders"
msgstr "Selezionabile negli ordini di acquisto"
38 changes: 38 additions & 0 deletions purchase_partner_selectable_option/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-28 23:57+0000\n"
"Last-Translator: Adriano Prado <adrianojprado@gmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\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_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr "Contato"

#. module: purchase_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido deCompra"

#. module: purchase_partner_selectable_option
#: model_terms:ir.ui.view,arch_db:purchase_partner_selectable_option.view_partner_form
msgid "Selectable in orders"
msgstr "Selecionável em pedidos"

#. module: purchase_partner_selectable_option
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_partner__purchase_selectable
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_users__purchase_selectable
msgid "Selectable in purchase orders"
msgstr "Selecionável em pedidos de compra"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr ""

#. module: purchase_partner_selectable_option
#: model:ir.model,name:purchase_partner_selectable_option.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_partner_selectable_option
#: model_terms:ir.ui.view,arch_db:purchase_partner_selectable_option.view_partner_form
msgid "Selectable in orders"
msgstr ""

#. module: purchase_partner_selectable_option
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_partner__purchase_selectable
#: model:ir.model.fields,field_description:purchase_partner_selectable_option.field_res_users__purchase_selectable
msgid "Selectable in purchase orders"
msgstr ""
4 changes: 4 additions & 0 deletions purchase_partner_selectable_option/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import res_partner
from . import purchase_order
28 changes: 28 additions & 0 deletions purchase_partner_selectable_option/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from lxml import etree

from odoo import api, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

@api.model
def get_view(self, view_id=None, view_type="form", **options):
res = super().get_view(view_id, view_type, **options)

if view_type == "form":
purchase_xml = etree.XML(res["arch"])
partner_fields = purchase_xml.xpath('//field[@name="partner_id"]')

if partner_fields:
partner_fields = partner_fields[0]
domain = partner_fields.get("domain", "[]").replace(
"[", "[('purchase_selectable', '=', True),"
)
partner_fields.attrib["domain"] = domain
res["arch"] = etree.tostring(purchase_xml, encoding="unicode")

return res
22 changes: 22 additions & 0 deletions purchase_partner_selectable_option/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class Partner(models.Model):
_inherit = "res.partner"

purchase_selectable = fields.Boolean(
string="Selectable in purchase orders",
default=lambda self: self._default_purchase_selectable(),
)

@api.model
def _default_purchase_selectable(self):
param = (
self.env["ir.config_parameter"]
.sudo()
.get_param("purchase_partner_selectable_option.default_purchase_selectable")
)
return False if param == "0" else True
3 changes: 3 additions & 0 deletions purchase_partner_selectable_option/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
10 changes: 10 additions & 0 deletions purchase_partner_selectable_option/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
To configure this module, you need to:

1. Go to **Contacts \> Contacts**
2. Create a record and uncheck the "Selectable in purchase orders" box
on the Purchase part of the "Sales & Purchases" tab.

The "Selectable in purchase orders" field is set to True by default. To
change this default to False, adjust the system parameter
'purchase_partner_selectable_option.default_purchase_selectable' by
setting it to "0".
5 changes: 5 additions & 0 deletions purchase_partner_selectable_option/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- César A. Sánchez
- Juan Carlos Oñate
2 changes: 2 additions & 0 deletions purchase_partner_selectable_option/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module limits the partners to be selected in the purchases orders
according to the "Selectable in orders" field.
5 changes: 5 additions & 0 deletions purchase_partner_selectable_option/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

1. Go to **Purchase \> Orders \> Request for Quotations**
2. Create a record and the previously created partner will not appear
in the Vendor field.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading