-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#66911 [16.0][MIG] partner_firstname_before_lastname (#144)
* [16.0][MIG] partner_firstname_before_lastname --------- Co-authored-by: majouda <[email protected]>
- Loading branch information
1 parent
ddb329a
commit b61ce4e
Showing
9 changed files
with
114 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
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
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
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,14 @@ | ||
Partner Firstname Before Lastname | ||
================================= | ||
This module extends the partner_firstname module available on https://github.com/OCA/partner-contact. | ||
|
||
It makes the field firstname appear before lastname and automatically sets the configuration parameter | ||
so that the displayed name of the partner is rendered like `Firstname Lastname` instead of `Lastname, Firstname`. | ||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
|
||
More information | ||
---------------- | ||
* Meet us at https://bit.ly/numigi-com |
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,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
def set_partner_names_order_in_res_config_settings(cr, registry): | ||
"""Set the value partner_names_order in res_config_settings. | ||
This prevents the following SQL error on every module update. | ||
psycopg2.IntegrityError: column "partner_names_order" contains null values | ||
""" | ||
cr.execute("UPDATE res_config_settings SET partner_names_order = 'first_last';") |
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,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
'name': 'Partner Firstname Before Lastname', | ||
'version': '1.1.0', | ||
'author': 'Numigi', | ||
'maintainer': 'Numigi', | ||
'website': 'https://bit.ly/numigi-com', | ||
'license': 'LGPL-3', | ||
'category': 'Partner Management', | ||
'summary': 'Display the firstname before the lastname on partner forms.', | ||
'depends': ['partner_firstname'], | ||
'data': [ | ||
'data/ir_config_parameter.xml', | ||
'views/res_partner.xml', | ||
], | ||
'installable': True, | ||
'post_init_hook': 'set_partner_names_order_in_res_config_settings', | ||
} |
13 changes: 13 additions & 0 deletions
13
partner_firstname_before_lastname/data/ir_config_parameter.xml
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,13 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
<data noupdate="1"> | ||
|
||
<!-- avoid error as the parameter is already introduced by partner_firstname --> | ||
<function | ||
model="ir.config_parameter" | ||
name="set_param" | ||
eval="('partner_names_order', 'first_last')" | ||
/> | ||
|
||
</data> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_partner_simple_form_firstname_before_lastname" model="ir.ui.view"> | ||
<field name="name">Partner Simple Form With Firstname Before Lastname</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="partner_firstname.view_partner_simple_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="firstname" position="replace"/> | ||
<field name="lastname" position="before"> | ||
<field name="firstname" attrs="{ | ||
'required': [ | ||
('lastname', '=', False), | ||
('is_company', '=', False), | ||
('type', '=', 'contact'), | ||
]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_partner_form_firstname_before_lastname" model="ir.ui.view"> | ||
<field name="name">Partner Form With Firstname Before Lastname</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="partner_firstname.view_partner_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="firstname" position="replace"/> | ||
<field name="lastname" position="before"> | ||
<field name="firstname" attrs="{ | ||
'required': [ | ||
('lastname', '=', False), | ||
('is_company', '=', False), | ||
('type', '=', 'contact'), | ||
]}"/> | ||
</field> | ||
|
||
<xpath expr="//field[@name='child_ids']/form//field[@name='firstname']" position="replace"/> | ||
<xpath expr="//field[@name='child_ids']/form//field[@name='lastname']" position="before"> | ||
<field name="firstname" attrs="{ | ||
'required': [ | ||
('lastname', '=', False), | ||
('is_company', '=', False), | ||
('type', '=', 'contact'), | ||
]}"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |