19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:53 +01:00
parent dc68f80d3f
commit 7221b9ac46
610 changed files with 135477 additions and 161677 deletions

View file

@ -15,19 +15,19 @@ class TestCrmMailPlugin(TestMailPluginControllerCommon):
{"name": "Partner 2"},
])
result = self._make_rpc_call("/mail_plugin/partner/get", {"partner_id": partner.id})
result = self.make_jsonrpc_request("/mail_plugin/partner/get", {"partner_id": partner.id})
self.assertNotIn("leads", result,
msg="The user has no access to crm.lead, the leads section should not be visible")
self.user_test.groups_id |= self.env.ref("sales_team.group_sale_salesman_all_leads")
self.user_test.group_ids |= self.env.ref("sales_team.group_sale_salesman_all_leads")
lead_1, lead_2 = self.env["crm.lead"].create([
{"name": "Lead Partner 1", "partner_id": partner.id},
{"name": "Lead Partner 2", "partner_id": partner_2.id},
])
result = self._make_rpc_call("/mail_plugin/partner/get", {"partner_id": partner.id})
result = self.make_jsonrpc_request("/mail_plugin/partner/get", {"partner_id": partner.id})
self.assertIn(
"leads",
@ -60,7 +60,7 @@ class TestCrmMailPlugin(TestMailPluginControllerCommon):
# set default company to Company_A
self.env.user.company_id = company_a.id
self.user_test.groups_id |= self.env.ref('sales_team.group_sale_salesman_all_leads')
self.user_test.group_ids |= self.env.ref('sales_team.group_sale_salesman_all_leads')
# Add company_B to user_test to have access to records related to company_B
self.user_test.write({'company_ids': [(4, company_b.id)]})
@ -71,7 +71,7 @@ class TestCrmMailPlugin(TestMailPluginControllerCommon):
'email_subject': 'test subject',
}
result = self._make_rpc_call('/mail_plugin/lead/create', params)
result = self.make_jsonrpc_request('/mail_plugin/lead/create', params)
# Check that the created lead record has the correct company and return the lead_id
self.assertIn(
@ -87,27 +87,3 @@ class TestCrmMailPlugin(TestMailPluginControllerCommon):
company_b,
msg='The created record should belong to company_B',
)
def _make_rpc_call(self, url, params):
"""
Makes an RPC call to the specified URL with the given parameters, and returns the 'result' key from the response.
:param params (dict): A dictionary containing the parameters to send in the RPC call.
:param url (str): The URL to send the RPC call to.
:return (dict): The 'result' key from the response.
"""
data = {
'id': 0,
'jsonrpc': '2.0',
'method': 'call',
'params': params,
}
response = self.url_open(
url,
data=json.dumps(data).encode(),
headers={'Content-Type': 'application/json'}
).json()
return response['result']