From e510f0835f3de9c09d35dc3e4cd5d2c54e4a3170 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 29 Jul 2022 09:57:35 +0000 Subject: [PATCH] [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 f0b7600314fee4e99de7ff48c91132f2754a9a40 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 --- addons/crm/views/res_partner_views.xml | 6 ------ addons/sales_team/views/res_partner_views.xml | 4 ++++ odoo/addons/base/views/res_partner_views.xml | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/addons/crm/views/res_partner_views.xml b/addons/crm/views/res_partner_views.xml index b6533072df6..7d8721e8aa8 100644 --- a/addons/crm/views/res_partner_views.xml +++ b/addons/crm/views/res_partner_views.xml @@ -44,12 +44,6 @@ - - - - - {'default_is_company': True, 'show_vat': True, 'default_user_id': user_id, 'default_team_id': team_id} - diff --git a/addons/sales_team/views/res_partner_views.xml b/addons/sales_team/views/res_partner_views.xml index ddb55e434e3..ffd0a10e4b9 100644 --- a/addons/sales_team/views/res_partner_views.xml +++ b/addons/sales_team/views/res_partner_views.xml @@ -6,8 +6,12 @@ + + + {'default_is_company': True, 'show_vat': True, 'default_user_id': user_id, 'default_team_id': team_id} + diff --git a/odoo/addons/base/views/res_partner_views.xml b/odoo/addons/base/views/res_partner_views.xml index 8463281c80a..50f34bc390b 100644 --- a/odoo/addons/base/views/res_partner_views.xml +++ b/odoo/addons/base/views/res_partner_views.xml @@ -180,7 +180,7 @@