Skip to content

Commit

Permalink
Merge PR #1893 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by HviorForgeFlow
  • Loading branch information
OCA-git-bot committed Jun 7, 2023
2 parents bfde8b1 + da126e7 commit 023917a
Show file tree
Hide file tree
Showing 19 changed files with 755 additions and 0 deletions.
102 changes: 102 additions & 0 deletions purchase_partner_selectable_option/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
==================================
Purchase Partner Selectable Option
==================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-OCA%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/15.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-15-0/purchase-workflow-15-0-purchase_partner_selectable_option
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/142/15.0
:alt: Try me on Runbot

|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:

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

Usage
=====

To use this module, you need to:

#. Go to **Purchase > Orders > Request for Quotations**
#. 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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_partner_selectable_option%0Aversion:%2015.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
* David Jaen - Ontinet.com

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/15.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": "16.0.1.0.1",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["purchase"],
"data": ["views/res_partner_view.xml"],
"installable": True,
"maintainers": ["victoralmau"],
}
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: 2021-12-02 17:02+0100\n"
"Last-Translator: \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: \n"
"X-Generator: Poedit 2.3\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 ""

#. 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"
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 15.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
12 changes: 12 additions & 0 deletions purchase_partner_selectable_option/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

purchase_selectable = fields.Boolean(
string="Selectable in purchase orders", default=True
)
4 changes: 4 additions & 0 deletions purchase_partner_selectable_option/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

#. Go to **Contacts > Contacts**
#. Create a record and uncheck the "Selectable in purchase orders" box on the Purchase part of the "Sales & Purchases" tab.
5 changes: 5 additions & 0 deletions purchase_partner_selectable_option/readme/CONTRIBUTORS.rst
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
1 change: 1 addition & 0 deletions purchase_partner_selectable_option/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module limits the partners to be selected in the purchases orders according to the "Selectable in orders" field.
4 changes: 4 additions & 0 deletions purchase_partner_selectable_option/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To use this module, you need to:

#. Go to **Purchase > Orders > Request for Quotations**
#. 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

0 comments on commit 023917a

Please sign in to comment.