-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] sale_order_restrict_customer_field
- Loading branch information
1 parent
2ce57d7
commit c10f264
Showing
10 changed files
with
535 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "partner_id" 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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# © 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, api | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = 'res.partner' | ||
|
||
is_customer = fields.Boolean(compute="_compute_is_customer", store=True) | ||
|
||
@api.depends("type", "child_ids") | ||
def _compute_is_customer(self): | ||
for record in self: | ||
if record.type == "delivery": | ||
record.is_customer = True | ||
elif record.type == "contact": | ||
if len(record.child_ids) == 0: | ||
record.is_customer = True | ||
else: | ||
record.is_customer = False | ||
else: | ||
record.type = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Iria Alonso <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Only customers and delivery addresses can be selected on "partner_id" field |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.