In the `res.partner` form:
- the field `user_id` is set in base,
and is directly within the base res.partner.form form view,
within the `Sales & Purchase` notebook page
(which is in the base module despite what the tab name could make think)
https://github.com/odoo/odoo/blob/f294079a8946e88f0564dc96bf8a9531958697fe/odoo/addons/base/views/res_partner_views.xml#L343
- the field `team_id` is set in the module `sales_team`, and added
in the res.partner.form form view from this `sales_team` module
https://github.com/odoo/odoo/blob/f294079a8946e88f0564dc96bf8a9531958697fe/addons/sales_team/views/res_partner_views.xml#L9
Therefore, there isn't any obvious reason why the context `default_`
keys for `user_id` and `team_id` are set
only once the `crm` module installed,
neither why it only applies if you are a salesperson
(to the group `sales_team.group_sale_salesman`, sets in the view
`groups_id`).
If we have a look to the commit
f0b7600314
The goal described in the commit description is still achieved
by moving these default context keys in their respective module.
Besides, having a closer look in this commit,
`default_user_id` is directly added in the simplified partner form
within the base module, but is added through the crm module
for the regular form. Which doesn't make really sense.
Part-of: odoo/odoo#98551
18 lines
816 B
XML
18 lines
816 B
XML
<?xml version="1.0"?>
|
|
<odoo>
|
|
<record id="res_partner_view_team" model="ir.ui.view">
|
|
<field name="name">res.partner.view.team</field>
|
|
<field name="model">res.partner</field>
|
|
<field name="inherit_id" ref="base.view_partner_form" />
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
|
|
<field name="team_id" invisible="1"/>
|
|
<field name="team_id" groups="base.group_no_one" />
|
|
</xpath>
|
|
<field name="parent_id" position="attributes">
|
|
<attribute name="context">{'default_is_company': True, 'show_vat': True, 'default_user_id': user_id, 'default_team_id': team_id}</attribute>
|
|
</field>
|
|
</field>
|
|
</record>
|
|
</odoo>
|