Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] sale_partner_selectable_option: Migration to 18.0 #3575

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
aa95f99
[ADD] sale_partner_selectable_option: This module limits the partners…
victoralmau Nov 16, 2021
d1fb5e4
[IMP] sale_partner_selectable_option: Change position field.
victoralmau Dec 2, 2021
62bfa92
[OU-FIX] sale_partner_selectable_option: Change 13.0.2 migration script.
victoralmau Dec 3, 2021
f85776b
[FIX] sale_partner_selectable_option: Improve domain in partner_id fi…
victoralmau Dec 13, 2021
42b9fdb
[IMP] sale_partner_selectable_option: Improve sale button in contact …
victoralmau Jan 17, 2022
ab548c3
[MIG] sale_partner_selectable_option: Migration to 15.0
cesar-tecnativa Jun 2, 2022
cb61e1c
[FIX] Update deprecated unit tests
Oct 11, 2022
ffbd160
sale_partner_selectable_option 15.0.1.0.1
OCA-git-bot Oct 20, 2022
ec6cff6
[MIG] sale_partner_selectable_option: Migration to 16.0
Yadier-Tecnativa Apr 27, 2023
94b5d0f
[UPD] Update sale_partner_selectable_option.pot
May 6, 2023
ca834c1
[UPD] README.rst
OCA-git-bot May 6, 2023
b5c3118
Translated using Weblate (Spanish)
Ivorra78 Jul 25, 2023
51673eb
[UPD] README.rst
OCA-git-bot Sep 3, 2023
7d81afa
Added translation using Weblate (Italian)
mymage Dec 1, 2023
b844fe6
Translated using Weblate (Italian)
mymage Dec 4, 2023
9484b9f
[IMP] sale_partner_selectable_option
AungKoKoLin1997 Jan 24, 2024
570b6cc
[BOT] post-merge updates
OCA-git-bot Feb 5, 2024
b96fe5e
[IMP] sale_partner_selectable_option: pre-commit auto fixes
Deriman-Alonso May 8, 2024
412f5b9
[MIG] sale_partner_selectable_option: Migration to 17.0
Deriman-Alonso May 8, 2024
fd08793
[UPD] Update sale_partner_selectable_option.pot
Dec 6, 2024
ea97b2f
[BOT] post-merge updates
OCA-git-bot Dec 6, 2024
e8c667c
[IMP] sale_partner_selectable_option: pre-commit auto fixes
juancarlosonate-tecnativa Feb 7, 2025
0ad5039
[MIG] sale_partner_selectable_option: Migration to 18.0
juancarlosonate-tecnativa Feb 7, 2025
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
114 changes: 114 additions & 0 deletions sale_partner_selectable_option/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
==============================
Sale Partner Selectable Option
==============================

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

.. |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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_partner_selectable_option
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_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/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

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

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

**Table of contents**

.. contents::
:local:

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

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

Usage
=====

To use this module, you need to:

1. Go to **Contacts > Contacts**
2. Create a record and uncheck the "Selectable in orders" box on the
Sales part of the "Sales & Purchases" tab.
3. Go to **Sales > Orders > Quotations**
4. Create a record and the previously created partner will not appear in
the Customer field.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-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/sale-workflow/issues/new?body=module:%20sale_partner_selectable_option%0Aversion:%2018.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 <[email protected]>
- Juan Carlos Oñate

- `Binhex Systems Solutions <https://binhex.cloud/>`__:

- Deriman Alonso <[email protected]>

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/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_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 sale_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 sale_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": "Sale Partner Selectable Option",
"version": "18.0.1.0.0",
"category": "Sales Management",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["sale"],
"data": ["data/ir_config_parameter.xml", "views/res_partner_view.xml"],
"installable": True,
"maintainers": ["victoralmau"],
}
9 changes: 9 additions & 0 deletions sale_partner_selectable_option/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- System Parameter for default sale_selectable -->
<record id="param_deafault_sale_selectable" model="ir.config_parameter">
<field name="key">sale_partner_selectable_option.default_sale_selectable</field>
<field name="value">1</field>
<!-- Default is True -->
</record>
</odoo>
39 changes: 39 additions & 0 deletions sale_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:
# * sale_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-02 15:52+0000\n"
"PO-Revision-Date: 2023-07-25 12:10+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\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: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_sale_order
msgid "Sales Order"
msgstr "Orden de Venta"

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

#. module: sale_partner_selectable_option
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_partner__sale_selectable
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_users__sale_selectable
msgid "Selectable in sale orders"
msgstr "Seleccionable en pedidos de venta"
38 changes: 38 additions & 0 deletions sale_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:
# * sale_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-04 06:35+0000\n"
"Last-Translator: mymage <[email protected]>\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: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_sale_order
msgid "Sales Order"
msgstr "Ordine di vendita"

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

#. module: sale_partner_selectable_option
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_partner__sale_selectable
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_users__sale_selectable
msgid "Selectable in sale orders"
msgstr "Selezionabile negli ordini di vendita"
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:
# * sale_partner_selectable_option
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_res_partner
msgid "Contact"
msgstr ""

#. module: sale_partner_selectable_option
#: model:ir.model,name:sale_partner_selectable_option.model_sale_order
msgid "Sales Order"
msgstr ""

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

#. module: sale_partner_selectable_option
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_partner__sale_selectable
#: model:ir.model.fields,field_description:sale_partner_selectable_option.field_res_users__sale_selectable
msgid "Selectable in sale orders"
msgstr ""
4 changes: 4 additions & 0 deletions sale_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 sale_order
22 changes: 22 additions & 0 deletions sale_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"

sale_selectable = fields.Boolean(
string="Selectable in sale orders",
default=lambda self: self._default_sale_selectable(),
)

@api.model
def _default_sale_selectable(self):
param = (
self.env["ir.config_parameter"]
.sudo()
.get_param("sale_partner_selectable_option.default_sale_selectable")
)
return False if param == "0" else True
24 changes: 24 additions & 0 deletions sale_partner_selectable_option/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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 SaleOrder(models.Model):
_inherit = "sale.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":
order_xml = etree.XML(res["arch"])
partner_id_fields = order_xml.xpath("//field[@name='partner_id']")
if partner_id_fields:
partner_id_field = partner_id_fields[0]
domain = partner_id_field.get("domain", "[]").replace(
"[", "[('sale_selectable', '=', True),"
)
partner_id_field.attrib["domain"] = domain
res["arch"] = etree.tostring(order_xml)
return res
3 changes: 3 additions & 0 deletions sale_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"
4 changes: 4 additions & 0 deletions sale_partner_selectable_option/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The "Selectable in sale orders" field is set to True by default. To
change this default to False, adjust the system parameter
'sale_partner_selectable_option.default_sale_selectable' by setting it
to "0".
8 changes: 8 additions & 0 deletions sale_partner_selectable_option/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- César A. Sánchez \<<[email protected]>\>
- Juan Carlos Oñate

- [Binhex Systems Solutions](https://binhex.cloud/):
- Deriman Alonso \<<[email protected]>\>
2 changes: 2 additions & 0 deletions sale_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 sales orders
according to the "Selectable in orders" field.
8 changes: 8 additions & 0 deletions sale_partner_selectable_option/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To use this module, you need to:

1. Go to **Contacts \> Contacts**
2. Create a record and uncheck the "Selectable in orders" box on the
Sales part of the "Sales & Purchases" tab.
3. Go to **Sales \> Orders \> Quotations**
4. Create a record and the previously created partner will not appear
in the Customer 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