Change application access user right in odoo 12 - python-3.x

i want to change application access user right.
in Mark Demo, Administration is selection field and it has rights for Access Rights.
i want to change it to Settings.
in python file self.env.user.has_group('base.group_system') returns False.
it means in selection field it fielded with Blank or Access right.
how can i change it to Settings.
i found this group in base.
<record model="res.groups" id="group_system">
<field name="name">Settings</field>
<field name="implied_ids" eval="[(4, ref('group_erp_manager'))]"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>

When we change the value of Administration field and click on save button Odoo as usual calls write method, the first thing Odoo does, in this case, is calling _remove_reified_groups method to remove reified group fields (sel_groups_2_3 in your example) from values and compute the value of groups_id then add it to values to be written in the next step (when calling super).
_remove_reified_groups compute groups to add or remove from groups_id. if a reified group field is present in values and has a value it will be added to groups_id, each time a reified group field is present in values the method calls get_selection_groups(key) to compute the groups to remove, the method returns the groups ids present in the field name. for the administration field sel_groups_2_3 the method will return [2, 3].
To reproduce the same result when updating Administration group we need to remove the groups used in field name then add the selected group to groups_id (values['groups_id'] = [(3, 2), (3, 3), (4, 3)])
The XML code used to set Mark demo administration group to Settings group should be:
<record id="base.user_demo" model="res.users">
<field name="groups_id" eval="[(3,ref('base.group_erp_manager')),(3,ref('base.group_system')),(4,ref('base.group_system'))]"/>
</record>

Related

Pre-filtering Microsoft Dynamic 365 SSRS not filtering base on opened record

I been dealing with a very unfriendly situation and cannot wrap my head around it. I applied same approach to another entity and it is working as expected but not sure why I cannot get it to work with this particular entity.
I am creating a report in SSRS and wanna make sure once an end user opens a record Pre-filtering applies to the opened record. (Record is Release of information (Roi for short))
in my SSRS I created added a SQL data source named "MSCRM_DataSource"
then I added my DataSet which is this:
-DataSets:
+Release_Of_Information
In my data set I have a simple code:
SELECT Column1, Column2, Column3
FROM FilteredReleaseOfInformation AS T1
WHERE ROIid = #SelectedForm
Then I added another DataSet and Named it as below:
+CRMAF_RoiID
above Data set has this code:
SELECT ROIid AS FormID
FROM FilteredReleaseOfInformation AS CRMAF_RoiID
Then I went for my parameters and first added one Parameter as follow.
General Tab:
Name: "CRMAF_RoiID"
Data Type: "Text"
Select Parameter Visibility: "internal"
Default Values tab:
Specify values:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="ReleaseOfInformation">
<attribute name="RoiID" />
</entity>
</fetch>
Lastly I added SelectedForm parameter as follows:
General Tab
Name: SelectedForm
Data type: Text
Parameter visibility: Hidden
Available Values Tab
Get values from a query
Dataset: CRMAF_RoiID
Value Field: FormID
Label Field: FormID
Default Values Tab*
Get values from a query
DataSet: CRMAF_RoiID
Value field: FormID
When I go to my test environment, report runs, but picks the first GUID in the query and not the associated record that is opened therefore no matter what record is opened it shows the info of first person RoiID.
**PS: Report is in my solution
**PS: I checked and ROIid is searchable on the entity
Is there anything that comes to your mind that I am missing? I spent so long researching and yet couldn't get this form work.
I have another entity that is working fine I do not know why this one has issue.
On your Dynamic-CRM check something and make sure the report is running on Current Record
if it is set on run for all related records Simply delete the report in your solution and add it again (preferably with a new name just add an _V2 or _V3 at the end of the name and set it up again.) this should do the trick as it did for me. I believe there is a bug in Dynamic CRM.

Pass parameter value to another parameter - SharePoint Designer

I have created ASPX page and have used Data view webpart on it. I am trying to filter list items based on user Logon information without domain.
I have created a parameter(LOGON) and assigned server variable LOGON_USER (this gives me username as "Domain\username")
I basically want to filter list item( On column/field called user_names in list) based on "username" only and not checking domain with it.
As while filtering, I can only set list item field to be equal to parameter. I am thinking of creating another parameter and assign the value of that parameter to be substring-after($Logon,'\') but I am not able to do that in SharePoint Designer. I was also trying it through xslt filtering but that doesn't work too as that happen after data source gets created.
Use javascript to get the user name or to trim the user name before you send it to the URL as a parameter. Then the DVWP data source can be filtered correctly.
Or, use XSLT filtering, which indeed DOES work. You just need to know where to put it. Keep in mind that with XSLT filtering the data for all users will be returned by the query and the filter will only affect the rendering.
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[#UserName = $Logon]" />
Adjust to reflect your field names.

How to add distinct values in a multivalue field in solr

I have a multivalue field called category(which is also a store field) in which i need to add only distinct values
<field name="category">value1</field>
<field name="category">value2</field>
If I do a update as follows
<add>
<doc>
<field name="id">E02</field>
<field name="category" update="add">value2</field>
</doc>
</add>
I get the value2 stored twice
<field name="category">value1</field>
<field name="category">value2</field>
<field name="category">value2</field>
I need to store/update only disctinct values in category fields which is a multivalue fields. How to do this solr?
Thanks in advance,
Jagadesh.
This functionality has been added for Solr 7.3.
You can use the add-distinct atomic update action, instead of add
See the Jira issue (SOLR-11267) and the documentation in the Reference Guide:
add-distinct
Adds the specified values to a multiValued field, only if
not already present. May be specified as a single value, or as a list.
One can "set" instead of "add", to recreate a stored field in partial document updates. So if it is the case where you have all the field values,just stick them in a Set and then repopulate the field. You have all the data to recreate it because of stored field requirement.

How can I get the Advanced Database Crawler to index the item name

I'm trying to switch my Sitecore application's search from the "old" indexes (Sitecore.Data.Indexing) to the "new" indexes (Sitecore.Search).
I used to have an index that explicitly listed the fields that I wanted indexed. The Item's name was one of these:
<field target="name">#name</field>
The new indexes, along with the Advanced Database Crawler allow you to have include fields and exclude fields. I've set the index IncludeAllFields value to false, as there are more fields I want to leave out than I want to index. And I add the fields I want via includes:
<include hint="list:IncludeField">
<!-- Field 1 -->
<fieldId1>{396CA18D-0E46-437E-9237-C10FDB217666}</fieldId1>
<!-- Field 2 -->
<fieldId2>{396CA18D-0E46-437E-9237-C10FDB217666}</fieldId2>
<!-- Field 3 -->
<fieldId3>{CC45947E-A22C-44E3-9652-32E519DABC7F}</fieldId3>
</include>
The problem is I can't figure out how to add the item's name with these new indexes. As far as I know the item's name isn't in a field. I tried looking at a sample item's fields after calling item.Fields.ReadAll() and looking through them all, but I couldn't see the item's name.
Is the item's name in a field that I can add to the include list, or is there another approach?
Thanks

Update SharePoint file field that is of type choice muliple selection

I am using UpdateListItems method (Lists.asmx web service) to update fields of an uploaded document in one SharePoint document library. In my case, I have a document library called Schedules. In it, there's a field called 'Day of the Week' which is a Choice multiple selection, with the allowed values Monday to Sunday. Here's the query that I have found which should select Monday and Friday choices (and it doesn't work, obviously):
<Method ID='1' Cmd='Update'>
<Field Name='ID'>1</Field>
<Field Name='Day of the Week'>Monday#;Friday</Field>
</Method>
I have read somewhere that inserting the string "#;" between the choices should resolve this. The end result is that the field Day of the Week is updated with the string "Monday#;Friday" and when I want to edit the item, no selection is being made. On the other hand if I just use "Monday", it works. Now, how can I make it update the multiple selection? Thanks.
I believe that should be ;#
A quick check shows the way SharePoint stores multi-choice fields, try:
;#Monday;#Friday;#
With the delimiter on the beginning and the end.
And a note: You should also keep in mind that SharePoint stores choices as plain text (not references), so you can place any value there, as you've just witnessed.

Resources