[IMP] crm, sales_team, base: add default in their origin module
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
This commit is contained in:
@@ -44,12 +44,6 @@
|
||||
<field string="Opportunities" name="opportunity_count" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
<field name="parent_id" position="before">
|
||||
<field name="team_id" invisible="1"/>
|
||||
</field>
|
||||
<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>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
<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>
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
<field name="parent_id"
|
||||
widget="res_partner_many2one"
|
||||
placeholder="Company Name..."
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'show_vat': True}"
|
||||
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'show_vat': True, 'default_user_id': user_id}"
|
||||
attrs="{'invisible': ['|', '&', ('is_company','=', True),('parent_id', '=', False),('company_name', '!=', False),('company_name', '!=', '')]}"/>
|
||||
<field name="company_name" attrs="{'invisible': ['|', '|', ('company_name', '=', False), ('company_name', '=', ''), ('is_company', '=', True)]}"/>
|
||||
<button name="create_company" icon="fa-plus-square" string="Create company"
|
||||
|
||||
Reference in New Issue
Block a user