I want to make different ir.rule models for different group of users
I have make the rule and work okay but dont know how to assign the group.
<record model="ir.rule" id="pupils_rule">
<field name="name">Tutor only view his pupils</field>
<field name="model_id" ref="model_res_users"/>
<field name="domain_force">[('tutor','=',user.id)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
My 2 security group group_tutor and group_pupil. Mymodel.acess.csv if u need something of the group.
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
tutor_activity,Model pupil
access,model_proyectosge_activity,group_tutor,1,0,0,0
pupil_activity,Model pupil
access,model_proyectosge_activity,group_pupil,1,1,1,1
you to have to add a line like
<field name="groups" eval="[(4, ref('XML ID OF TUTORS'))]"/>
as in the fourth line in the following
<record model="ir.rule" id="pupils_rule">
<field name="name">Tutor only view his pupils</field>
<field name="model_id" ref="model_res_users"/>
<field name="groups" eval="[(4, ref('XML ID OF TUTORS'))]"/>
<field name="domain_force">[('tutor','=',user.id)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
Related
I have below xml
input:
<Records count="1">
<Record contentId="2410630" levelId="442" levelGuid="29c1b6a4-b7db-49dc-a703-e78aa1b1246a" moduleId="875" parentId="0">
<Record contentId="2410631" levelId="458" levelGuid="67dbf848-5352-4953-a25b-1b1bbcde89be" moduleId="891" parentId="0">
<Record contentId="2208294" levelId="330" levelGuid="d25cfb04-eb2a-423c-bdab-2db21a58fd4d" moduleId="675" parentId="0">
<Field id="31799" guid="2ebbfd8e-3e89-4be5-9c1f-1b5e85950753" type="1">Unauthorized modification of Information/System - External</Field>
<Field id="31796" guid="24640c19-d1de-415b-b349-25b0af521373" type="6">2208294</Field>
</Record>
</Record>
<Record contentId="2410632" levelId="458" levelGuid="67dbf848-5352-4953-a25b-1b1bbcde89be" moduleId="891" parentId="0">
<Record contentId="2208289" levelId="330" levelGuid="d25cfb04-eb2a-423c-bdab-2db21a58fd4d" moduleId="675" parentId="0">
<Field id="31799" guid="2ebbfd8e-3e89-4be5-9c1f-1b5e85950753" type="1">Inadequate Information Security Practices</Field>
<Field id="31796" guid="24640c19-d1de-415b-b349-25b0af521373" type="6">2208289</Field>
</Record>
</Record>
<Record contentId="2410633" levelId="458" levelGuid="67dbf848-5352-4953-a25b-1b1bbcde89be" moduleId="891" parentId="0">
<Record contentId="2208270" levelId="330" levelGuid="d25cfb04-eb2a-423c-bdab-2db21a58fd4d" moduleId="675" parentId="0">
<Field id="31799" guid="2ebbfd8e-3e89-4be5-9c1f-1b5e85950753" type="1">Loss of Systems Including Data Center</Field>
<Field id="31796" guid="24640c19-d1de-415b-b349-25b0af521373" type="6">2208270</Field>
</Record>
</Record>
<Record contentId="2410636" levelId="458" levelGuid="67dbf848-5352-4953-a25b-1b1bbcde89be" moduleId="891" parentId="0">
<Record contentId="2208289" levelId="330" levelGuid="d25cfb04-eb2a-423c-bdab-2db21a58fd4d" moduleId="675" parentId="0">
<Field id="31799" guid="2ebbfd8e-3e89-4be5-9c1f-1b5e85950753" type="1">Inadequate Information Security Practices</Field>
<Field id="31796" guid="24640c19-d1de-415b-b349-25b0af521373" type="6">2208289</Field>
</Record>
</Record>
<Record contentId="2410661" levelId="463" levelGuid="cc59604e-cc41-4253-879a-5fbde3ffd760" moduleId="896" parentId="0">
<Field id="41541" guid="bae76db7-4e46-4113-a453-68243a76d4f6" type="9">
<Reference id="2208289">Inadequate Information Security Practices</Reference>
</Field>
</Record>
<Record contentId="2410666" levelId="463" levelGuid="cc59604e-cc41-4253-879a-5fbde3ffd760" moduleId="896" parentId="0">
<Field id="41541" guid="bae76db7-4e46-4113-a453-68243a76d4f6" type="9">
<Reference id="2208273"> Loss of 50% Staff </Reference>
</Field>
</Record>
<Record contentId="2410649" levelId="462" levelGuid="83a26d99-e79d-41af-8a20-fa069f791cef" moduleId="895" parentId="0">
<Field id="41453" guid="9a764db7-a75e-4a49-9b26-de03e2bc4bb5" type="9">
<Reference id="2208328">Technology Configuration</Reference>
</Field>
</Record>
</Record>
</Records>
Expected Output:
<uniqueValues>Inadequate Information Security Practices</uniqueValues>
<uniqueValues>Loss of Systems Including Data Center</uniqueValues>
<uniqueValues>Loss of 50% Staff</uniqueValues>
<uniqueValues>Technology Configuration</uniqueValues>
Here is my code
<xsl:stylesheet version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:output method="xml"/>
<xsl:variable name ="fields" select="//Metadata/FieldDefinitions" />
<!--match the root node-->
<xsl:template match="Records">
<ArcherRecords>
<xsl:for-each select="Record[#levelGuid='29c1b6a4-b7db-49dc-a703-e78aa1b1246a']">
<xsl:variable name="valuesTobeCompared" select="Record/Field[#guid='bae76db7-4e46-4113-a453-68243a76d4f6']/Reference/#id"/>
<xsl:for-each-group select="Record/Record" group-by="./Field[#guid='24640c19-d1de-415b-b349-25b0af521373']">
<xsl:choose>
<xsl:when test="$valuesTobeCompared = ./Field[#guid='24640c19-d1de-415b-b349-25b0af521373']">
</xsl:when>
<xsl:otherwise>
<uniqueValues><xsl:value-of select="./Field[#guid='24640c19-d1de-415b-b349-25b0af521373']"/></uniqueValues>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:for-each>
</ArcherRecords>
</xsl:template>
</xsl:stylesheet>
but it is only giving first set of unique values but I want all unique values from entire record set along with it should also have one value of duplicated value, I was not sure how to get all node values into one variable I am able to store only one node values into variable,
Could anybody help me how to write a xslt code to get the unique values
group-by itself will retrieve unique values from provided selectpath, but how can I give multiple node-set values to for-each-group
I receive the following message from counterparty:
8=FIX.4.4|9=219|35=W|34=4|49=id|52=20200618-14:34:20.738|56=id1|42=20200618-14:34:20.688|55=EUR/USD|262=1|268=2|269=0|270=1.12083|271=500000|269=1|270=1.12084|271=500000|10094=2020.06.18 14:34:20.688|10=141|
The message contains the field 268 = 2, and both groups begin with the field 269, and I am trying to extract fields 270. My code looks like this:
message= quickfix.Message('8=FIX.4.4\x019=219\x0135=W\x0134=4\x0149=id\x0152=20200618-14:34:20.738\x0156=id1\x0142=20200618-14:34:20.688\x0155=EURUSD\x01262=1\x01268=2\x01269=0\x01269=1\x01270=1.12083\x01270=1.12084\x01271=500000\x01271=500000\x0110094=2020.06.18 14:34:20.688\x0110=141\x01')
group = quickfix44.MarketDataSnapshotFullRefresh.NoMDEntries()
fix_no_entries = quickfix.NoMDEntries()
message.getField(fix_no_entries)
no_entries = fix_no_entries.getValue() # print = 2 as expected
message.getGroup(1, group)
However, when running the getGroup line, I get the error:
FieldNotFound: Field not found
Any idea on what is going wrong?
Thank you again guys!
Quickfix doesn't know about your message structure, so you need to provide some info about how to parse the message, otherwise it's just a bunch of fields without groups.
<message>
<header>
<field number="8"><![CDATA[FIX.4.4]]></field>
<field number="9"><![CDATA[183]]></field>
<field number="35"><![CDATA[W]]></field>
<field number="34"><![CDATA[4]]></field>
<field number="49"><![CDATA[id]]></field>
<field number="52"><![CDATA[20200618-14:34:20.738]]></field>
<field number="56"><![CDATA[id1]]></field>
</header>
<body>
<field number="42"><![CDATA[20200618-14:34:20.688]]></field>
<field number="55"><![CDATA[EURUSD]]></field>
<field number="262"><![CDATA[1]]></field>
<field number="268"><![CDATA[2]]></field>
<field number="269"><![CDATA[0]]></field>
<field number="269"><![CDATA[1]]></field>
<field number="270"><![CDATA[1.12083]]></field>
<field number="270"><![CDATA[1.12084]]></field>
<field number="271"><![CDATA[500000]]></field>
<field number="271"><![CDATA[500000]]></field>
<field number="10094"><![CDATA[2020.06.18 14:34:20.688]]></field>
</body>
<trailer>
<field number="10"><![CDATA[182]]></field>
</trailer>
</message>
Quickfix data dictionaries are the way to configure the message parser. Quickfix already comes along with some pre-configured dictionaries, you can customize it according with your needs.
data_dictionary = quickfix.DataDictionary("quickfix/FIX44.xml")
message= quickfix.Message('...', data_dictionary, True)
print(message.toXML())
Now the message is structured and it's possible to retrieve groups data:
<message>
<header>
<field number="8"><![CDATA[FIX.4.4]]></field>
<field number="9"><![CDATA[183]]></field>
<field number="35"><![CDATA[W]]></field>
<field number="34"><![CDATA[4]]></field>
<field number="49"><![CDATA[id]]></field>
<field number="52"><![CDATA[20200618-14:34:20.738]]></field>
<field number="56"><![CDATA[id1]]></field>
</header>
<body>
<field number="42"><![CDATA[20200618-14:34:20.688]]></field>
<field number="55"><![CDATA[EURUSD]]></field>
<field number="262"><![CDATA[1]]></field>
<field number="268"><![CDATA[2]]></field>
<field number="10094"><![CDATA[2020.06.18 14:34:20.688]]></field>
<group>
<field number="269"><![CDATA[0]]></field>
</group>
<group>
<field number="269"><![CDATA[1]]></field>
<field number="270"><![CDATA[1.12083]]></field>
</group>
<group>
<field number="270"><![CDATA[1.12084]]></field>
<field number="271"><![CDATA[500000]]></field>
</group>
<group>
<field number="271"><![CDATA[500000]]></field>
</group>
</body>
<trailer>
<field number="10"><![CDATA[182]]></field>
</trailer>
</message>
I would like to create submenu under About Us main menu. I am trying with following code but it is adding main menu.
<!-- Main Menu ABOUT US -->
<record id="menu_about_us" model="website.menu">
<field name="name">ABOUT US</field>
<field name="page_id" ref="about-us" />
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">10</field>
</record>
<!-- Sub Menu Under ABOUT US -->
<record id="menu_board_and_founders" model="website.menu">
<field name="name">BOARD AND FOUNDERS</field>
<field name="page_id" ref="board-and-founders" />
<field name="parent_id" ref="menu_about_us" />
<field name="sequence" type="int">10</field>
</record>
I have a search view created:
<record model="ir.ui.view" id="helpdesk_ticket_search_view">
<field name="name">helpdesk.ticket.search.view</field>
<field name="model">helpdesk.ticket</field>
<field name="arch" type="xml">
<search string="Owner Search">
<filter string="Owner" name="res_users" domain="[('res_users_id', '=', 'uid')]"/>
<field name="res_users_id"/>
<field name="name"/>
<field name="ticketnumber" />
<group string="Group by">
<filter string="Owner" name="res_users" domain="[]"
context="{'group_by':'res_users_id'}"/>
</group>
</search>
</field>
</record>
When I search by user, I don't need to type the full name out eg. instead of typing "user", I can just type "us" and get a list
However, with numbers if I am looking for "12345678" I have to type it all out and not just "123".
Is it possible to search for numbers just using part of the number? This is helpful to me with a helpdesk when i am looking for all ticket starting with 123.
Any advise?
I am using apache solr for bulding search for a website.
I am using nested entities to import data from different tables. Dataimport is successfull and all the documents are being added to the index. My dataConfig goes like this :
<dataConfig>
<dataSource type="JdbcDataSource" driver ="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/purplle_purplle2" user="purplle_purplle" password="purplle123" />
<document name="doc">
<entity name="offer" query="SELECT * FROM service_offering WHERE module LIKE 'location' ">
<field column="name" name="name"/>
<field column="id" name="id" />
<field column="type_id" name="type_id" />
<entity name="offer_type" query=" select name from service_offeringtype where id='${offer.type_id}'" >
<field column="name" name="offer_type" />
</entity>
<entity name="offer_location" query=" select name from service_location where id='${offer.module_id}'" >
<field column="name" name="location_name" />
</entity>
<entity name="offer_address" query=" select * from service_address where module_id='${offer.module_id}' AND module LIKE 'location'" >
<entity name="loc_city" query=" select name from loc_city where id='${offer_address.city}'" >
<field column="name" name="loc_city" />
</entity>
<entity name="loc_area" query=" select name from loc_area where id='${offer_address.area}'" >
<field column="name" name="loc_area" />
</entity>
<entity name="loc_zone" query=" select name from loc_zone where id='${offer_address.zone}'" >
<field column="name" name="loc_zone" />
</entity>
</entity>
</entity>
</document>
</dataConfig>
Now if i directly do a search on this index. The results are fetched only for "name" field. It returns null for other fields namely "loc_area","location_name","loc_city" etc.
My schema looks like this
<field name="id" type="int" indexed="true" stored="true" />
<field name="name" type="string" indexed="true" stored="true" />
<field name="offer_type" type="string" indexed="true" stored="true" />
<field name="location_name" type="string" indexed="true" stored="true" />
<field name="type_id" type="string" indexed="true" stored="true" />
<field name="loc_city" type="string" indexed="true" stored="true" />
<field name="loc_area" type="string" indexed="true" stored="true" />
<field name="loc_zone" type="string" indexed="true" stored="true" />
However if i copy these fields into a "text" field which is present by default in the schema.xml. Then by searching on "text" field i easily get the relevant results.
<copyField source="name" dest="text"/>
<copyField source="offer_type" dest="text"/>
<copyField source="location_name" dest="text"/>
<copyField source="loc_city" dest="text"/>
<copyField source="loc_area" dest="text"/>
<copyField source="loc_zone" dest="text"/>
But i cannot do it like this because i have to assign boost levels to different fields for calcuation of score. The moment i append this in the query syntax "&defType=edismax&qf=name^1.0+location_name^10.0+loc_area^50.0" it returns null results.
What is wrong?
My guess is that your problem is the type of your fields. I don't know exactly what your fields contain, but there is a difference between type="string" and type = "text".
The String type indexes an untokenized String value of the entire field input. Text type tokenizes and analyzes the the field. For example, if I search for "john" against a string field containing "John Smith" I would not expect a hit, where if the field were a text field, I would get a hit.
Since your query seems to work against a text field, and not a string field, changing the types and reindexing seems to be a likely solution.