[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",
|
||||
"version": "12.0.2.1.0",
|
||||
"version": "12.0.2.2.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"maintainer": "Stéphan Sainléger",
|
||||
|
@@ -31,6 +31,12 @@ class res_partner(models.Model):
|
||||
compute="_compute_can_read_edit",
|
||||
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(
|
||||
"other_contact_ids",
|
||||
@@ -43,4 +49,11 @@ class res_partner(models.Model):
|
||||
partner.can_edit_structure_profiles_ids = partner.child_ids.filtered(
|
||||
"edit_structure_profiles"
|
||||
).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="arch" type="xml">
|
||||
<!-- 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">
|
||||
<group name="structure_access_rights"
|
||||
attrs="{'invisible': ['|', ('is_position_profile','=',False), ('parent_id','=',False)]}">
|
||||
|
Reference in New Issue
Block a user