[IMP] partner_profiles_portal: add odoo user in partner form view
This commit is contained in:
committed by
Stéphan Sainléger
parent
bf5eeb0d32
commit
bba6775f07
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "partner_profiles_portal",
|
"name": "partner_profiles_portal",
|
||||||
"version": "12.0.2.1.0",
|
"version": "12.0.2.2.0",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"website": "https://elabore.coop",
|
"website": "https://elabore.coop",
|
||||||
"maintainer": "Stéphan Sainléger",
|
"maintainer": "Stéphan Sainléger",
|
||||||
|
@@ -31,6 +31,12 @@ class res_partner(models.Model):
|
|||||||
compute="_compute_can_read_edit",
|
compute="_compute_can_read_edit",
|
||||||
string="Can read structure profiles",
|
string="Can read structure profiles",
|
||||||
)
|
)
|
||||||
|
odoo_user_id = fields.Many2one(
|
||||||
|
"res.users",
|
||||||
|
compute="_compute_odoo_user_id",
|
||||||
|
string="Associated Odoo user",
|
||||||
|
store=True,
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends(
|
@api.depends(
|
||||||
"other_contact_ids",
|
"other_contact_ids",
|
||||||
@@ -44,3 +50,10 @@ class res_partner(models.Model):
|
|||||||
"edit_structure_profiles"
|
"edit_structure_profiles"
|
||||||
).mapped("contact_id")
|
).mapped("contact_id")
|
||||||
partner.child_main_contact_ids = partner.child_ids.mapped("contact_id")
|
partner.child_main_contact_ids = partner.child_ids.mapped("contact_id")
|
||||||
|
|
||||||
|
@api.depends("user_ids")
|
||||||
|
def _compute_odoo_user_id(self):
|
||||||
|
for partner in self:
|
||||||
|
partner.odoo_user_id = self.env["res.users"].search(
|
||||||
|
[("partner_id", "=", partner.id)], limit=1
|
||||||
|
)
|
@@ -8,6 +8,11 @@
|
|||||||
<field name="sequence">99</field>
|
<field name="sequence">99</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<!-- Main display -->
|
<!-- Main display -->
|
||||||
|
<xpath expr="//group[@name='profile_status']/field[@name='contact_id']"
|
||||||
|
position="before">
|
||||||
|
<field name="odoo_user_id" string="Associated User" readonly="1"
|
||||||
|
attrs="{'invisible': [('is_main_profile','=',False)]}" />
|
||||||
|
</xpath>
|
||||||
<xpath expr="//group[@name='profile_status']" position="after">
|
<xpath expr="//group[@name='profile_status']" position="after">
|
||||||
<group name="structure_access_rights"
|
<group name="structure_access_rights"
|
||||||
attrs="{'invisible': ['|', ('is_position_profile','=',False), ('parent_id','=',False)]}">
|
attrs="{'invisible': ['|', ('is_position_profile','=',False), ('parent_id','=',False)]}">
|
||||||
|
Reference in New Issue
Block a user