Skip to content

Commit

Permalink
[ADD] Add partner_title_for_company: extend title to companies
Browse files Browse the repository at this point in the history
  • Loading branch information
cvinh committed Dec 12, 2024
1 parent 227da0a commit ee7bba5
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions partner_title_for_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions partner_title_for_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 INVITU (<https://www.invitu.com>)

{
"name": "Partner title for companies",
"summary": "Add titles for companies",
"version": "17.0.1.1.0",
"author": "INVITU, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"maintainer": "INVITU",
"category": "Extra Tools",
"website": "https://github.com/OCA/partner-contact",
"depends": ["base"],
"post_init_hook": "",
"data": [
"views/res_partner_views.xml",
],
"auto_install": False,
"installable": True,
}
1 change: 1 addition & 0 deletions partner_title_for_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
9 changes: 9 additions & 0 deletions partner_title_for_company/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


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

for_company = fields.Boolean(
string="For companies", help="Check if the title is meant for companies"
)
3 changes: 3 additions & 0 deletions partner_title_for_company/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions partner_title_for_company/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Cyril VINH-TUNG \<[email protected]>\>
2 changes: 2 additions & 0 deletions partner_title_for_company/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module was written to extend the functionality of titles to
companies.
1 change: 1 addition & 0 deletions partner_title_for_company/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The field *for_company* in Partner Titles allows to add titles for companies
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions partner_title_for_company/views/res_partner_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<odoo>
<record id="view_partner_title_for_company_tree" model="ir.ui.view">
<field name="name">view.partner.title.for.company.tree</field>
<field name="model">res.partner.title</field>
<field name="inherit_id" ref="base.view_partner_title_tree" />
<field name="priority" eval="8" />
<field name="arch" type="xml">
<field name="shortcut" position="after">
<field name="for_company" widget="boolean_toggle" />
</field>
</field>
</record>
<record id="view_partner_title_for_company_form" model="ir.ui.view">
<field name="name">view.partner.title.for.company.form</field>
<field name="model">res.partner.title</field>
<field name="inherit_id" ref="base.view_partner_title_form" />
<field name="priority" eval="8" />
<field name="arch" type="xml">
<field name="shortcut" position="after">
<field name="for_company" />
</field>
</field>
</record>
<record id="view_partner_for_company_form" model="ir.ui.view">
<field name="name">view.partner.for.company.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="8" />
<field name="arch" type="xml">
<field name="title" position="attributes">
<attribute name="invisible" />
<attribute name="domain">
[('for_company', '=', is_company)]
</attribute>
</field>
</field>
</record>
</odoo>

0 comments on commit ee7bba5

Please sign in to comment.