Skip to content

Commit

Permalink
[ADD] sale_order_restrict_customer_field
Browse files Browse the repository at this point in the history
  • Loading branch information
IriaAlonso committed Nov 29, 2024
1 parent 2ce57d7 commit f3a0224
Show file tree
Hide file tree
Showing 10 changed files with 529 additions and 0 deletions.
60 changes: 60 additions & 0 deletions sale_order_restrict_customer_field/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
==================================
Sale Order Restrict Customer Field
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:45a662696da311a024814f84ad2ca30af88a7aaf91561d1e23b5fd679d5ae104
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-solvosci%2Fslv--sale-lightgray.png?logo=github
:target: https://github.com/solvosci/slv-sale/tree/17.0/sale_order_restrict_customer_field
:alt: solvosci/slv-sale

|badge1| |badge2| |badge3|

Only customers and delivery addresses can be selected on "customer" field

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/solvosci/slv-sale/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/solvosci/slv-sale/issues/new?body=module:%20sale_order_restrict_customer_field%0Aversion:%2017.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
~~~~~~~

* Solvos

Contributors
~~~~~~~~~~~~

* Iria Alonso <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `solvosci/slv-sale <https://github.com/solvosci/slv-sale/tree/17.0/sale_order_restrict_customer_field>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions sale_order_restrict_customer_field/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions sale_order_restrict_customer_field/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
{
"name": "Sale Order Restrict Customer Field",
"summary": """
Only customers and delivery addresses can be selected on "customer" field
""",
"author": "Solvos",
"license": "LGPL-3",
"version": "17.0.1.0.0",
"category": "Inventory/Purchase",
"website": "https://github.com/solvosci/slv-sale",
"depends": [
"sale",
],
"data": [
"views/sale_order_views.xml",
],
'installable': True,
}
1 change: 1 addition & 0 deletions sale_order_restrict_customer_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
16 changes: 16 additions & 0 deletions sale_order_restrict_customer_field/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
from odoo import models, fields


class ResPartner(models.Model):
_inherit = 'res.partner'

is_customer = fields.Boolean(compute="_compute_is_customer", searcheable=True, store=True)

def _compute_is_customer(self):
for record in self:
if record.type == "contact" or record.type == "delivery":
record.is_customer = True
else:
record.is_customer = False
1 change: 1 addition & 0 deletions sale_order_restrict_customer_field/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Iria Alonso <[email protected]>
1 change: 1 addition & 0 deletions sale_order_restrict_customer_field/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only customers and delivery addresses can be selected on "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

0 comments on commit f3a0224

Please sign in to comment.