-
-
Notifications
You must be signed in to change notification settings - Fork 856
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][ADD] partner_type_base extracted from partner_firstname #1905
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import logging | ||
|
||
from odoo.upgrade import util | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate(cr, version): | ||
_logger.info("Installing dependent module 'partner_type_base' by migration script.") | ||
util.force_install_module(cr, "partner_type_base") | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
===================== | ||
Partner Address Types | ||
===================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:43d730c51ef59b1c6de4109020507234da1ada647d1a04e2b0bc1dc74dad4451 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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%2Fpartner--contact-lightgray.png?logo=github | ||
:target: https://github.com/OCA/partner-contact/tree/18.0/partner_type_base | ||
:alt: OCA/partner-contact | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/partner-contact-18-0/partner-contact-18-0-partner_type_base | ||
: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/partner-contact&target_branch=18.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module was written to extend the functionality of contact types for | ||
a flexible extension. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/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/partner-contact/issues/new?body=module:%20partner_type_base%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 | ||
------- | ||
|
||
* glueckkanja AG | ||
|
||
Contributors | ||
------------ | ||
|
||
- Christopher Rogos | ||
|
||
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. | ||
|
||
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/18.0/partner_type_base>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2013 Nicolas Bessi (Camptocamp SA) | ||
# Copyright 2014 Agile Business Group (<http://www.agilebg.com>) | ||
# Copyright 2015 Grupo ESOC (<http://www.grupoesoc.es>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Partner Address Types", | ||
"summary": "Base implementation to improve the address type customization.", | ||
"version": "18.0.1.0.0", | ||
"author": "glueckkanja AG, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"category": "Extra Tools", | ||
"website": "https://github.com/OCA/partner-contact", | ||
"depends": ["base_setup"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question... I've copied it from "partner_firstname" module. There is a module in odoo/addons/base_setup which depends on "base" and "web". It also has some minor changes on the patner kanban view. So maybe a view order issue? A general question: partner_firstname.depends = ["partner_type_base"] or ["base", "partner_type_base"] ??? |
||
"data": [ | ||
"views/res_partner.xml", | ||
], | ||
"auto_install": False, | ||
"installable": True, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import res_partner |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2024 Christopher Rogos (<https://www.glueckkanja.com>) | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
"""Adds last name and first name; name becomes a stored function field.""" | ||
|
||
_inherit = "res.partner" | ||
|
||
is_address_readonly = fields.Boolean( | ||
compute="_compute_contact_type", | ||
help="If true, the address fields are readonly.", | ||
) | ||
is_individual = fields.Boolean( | ||
compute="_compute_contact_type", help="If true, the partner name is splitted." | ||
) | ||
can_be_parent = fields.Boolean( | ||
compute="_compute_contact_type", | ||
search="_search_can_be_parent", | ||
help="If true, the partner is available as parent.", | ||
) | ||
can_be_child = fields.Boolean( | ||
compute="_compute_contact_type", | ||
help="If true, the partner_id field is available.", | ||
) | ||
|
||
@api.depends("is_company", "type", "parent_id") | ||
def _compute_contact_type(self): | ||
for partner in self: | ||
partner.is_address_readonly = not ( | ||
partner.is_company | ||
or not partner.parent_id | ||
or partner.type not in ["contact"] | ||
) | ||
partner.is_individual = not partner.is_company and partner.type in [ | ||
"contact", | ||
"other", | ||
] | ||
|
||
partner.can_be_parent = partner.is_company | ||
partner.can_be_child = not partner.is_company | ||
|
||
@api.model | ||
def _search_can_be_parent(self, operator, value): | ||
return [("is_company", operator, value)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it real ? An individual can have a child partner as delivery address for instance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is totally inconsistent in Odoo. When you go to a contact, you can add a subcontact/address: When you open this other address, the contact is set as parent: But when you search for the contact to select it in this view, this is not possible: In my Opinion a big weakness of Odoo, because it is very unclear to the user how to use it. What we are doing is, that we use a 3 level hirache Company -> "Other Address" -> Contact to bundle all people of a certain Office address. Because commerical_partner_id looks upwards until the first company, this should work. But I am not sure if it is a Odoo recommended structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had also opened an Odoo ticket on this topic 9 Months ago, and this was the answer:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Christopher Rogos |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module was written to extend the functionality of contact types | ||
for a flexible extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this? Odoo's ORM is in charge of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that too, but @houssine78 informed me that there is a bug and from my testing I can confirm that the added dependency is not installed automatically. odoo/odoo#72703
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hasn't odoo/odoo#72661 fixed that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not totally as sbidoul wrote at the end of the ticket I've linked:
Half fixed to be precise.