Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
2459 Ansichten

Hello everyone. I am using the rpc.query to get the records in my database. I am using the records to create a simple checkbox for my snippet but if a user has no access rights related to the model, the user cannot see the checkbox. Is there any way the ignore these rights or another way to get the records?



rpc.query({
                    model: 'ais.task',
                    method: 'search_read',
                    args: [domain, ['name', 'contractor_name', 'id','geo_multipolygon']],
                }).then(function (data) {
                    var mydata = {
                        "type": "FeatureCollection",
                        "features": [
                            {
                                "type": "Feature",
                                "properties": {},
                                "geometry": {
                                    "type": "MultiPolygon",
                                    "coordinates": []
                                }
                            }
                        ]
                    }
                    for(let i=0; i < data.length;i++)
                    {
                        data[i].geo_multipolygon = JSON.parse(data[i].geo_multipolygon);
                       
                        for(let j = 0; j < data[i].geo_multipolygon.coordinates[0][0].length; j++)
                        {
                            var p = {x: data[i].geo_multipolygon.coordinates[0][0][j][0], y: data[i].geo_multipolygon.coordinates[0][0][j][1]};
                            var result = proj4(source, dest, p);//Kordinat dönüşümü
                            data[i].geo_multipolygon.coordinates[0][0][j][0] = result.x
                            data[i].geo_multipolygon.coordinates[0][0][j][1] = result.y
                        }
                        mapinfo.push({"id": data[i].id, "project_name": data[i].name[1], "contractor_id": data[i].contractor_name[0], "contractor_name": data[i].contractor_name[1],"coordinates": data[i].geo_multipolygon.coordinates})
                    }
                    $( ".mycontainer" ).remove();
                    const html = `
                        <div id="asd" class ="mycontainer">
                            <div class="head-container">
                                <p class="head-title">Yüklenciler</p>
                                <hr></hr>
                            </div>
                            <div class="body-container">
                                <ul class="main-list">
                                </ul>
                            </div>
                        </div>
                    `
                    var contractors_list = []
                   
                    function checkbox_items()
                    {
                        $('#map').after(html);
                       
                        for(let i=0; i < mapinfo.length; i++)
                        {
                            let index = contractors_list.findIndex( elm => elm.id == mapinfo[i].contractor_id)
                            if(index === -1)
                            {
                               
                                var contractor_html = `
                                <li>
                                    <label class="checkbox-label">
                                        <input class="not-last-item" id="`+ mapinfo[i].contractor_id.toString() +`"type="image" src="ybs/static/src/img/add-line.svg" />
                                        <input type="checkbox" id="contractor`+ mapinfo[i].contractor_id.toString() + `" />
                                        ` + mapinfo[i].contractor_name + `
                                    </label>
                                    <ul id="parent-contractor`+ mapinfo[i].contractor_id.toString() + `" class="sub-list">
                                        <li>
                                            <label class="checkbox-label">
                                                <input type="checkbox" id="task` + mapinfo[i].id.toString() +`"/>
                                                ` + mapinfo[i].project_name + `
                                            </label>
                                        </li>
                                    </ul>
                                </li>
                                `
                                $('.main-list').append(contractor_html);
                                contractors_list.push({ 'name': mapinfo[i].contractor_name, 'id': mapinfo[i].contractor_id})
                            }
                            else
                            {
                                contractor_html = `
                                <li>
                                   
                                    <label class="checkbox-label">
                                        <input type="checkbox" id="task` + mapinfo[i].id.toString() +`"/>
                                            ` + mapinfo[i].project_name + `
                                        </label>
                                </li>
                                `
                                var selector = '#parent-contractor' + mapinfo[i].contractor_id.toString();
                                $(selector).append(contractor_html);
                               
                            }
                        }
                       
                       
                    }
                    checkbox_items();
Avatar
Verwerfen
Beste Antwort

Hello anil can,


While running rpc.query we directly deal with database. so, access rights can't create any issue..
can you share more detail about for better understanding?

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Verwerfen
Autor

Thank you for replying. I add my js code into te my question.I am using above the code.If I have no access right "ais.task" and I check the cmd console I see the "This operation is allowed for the following groups: - Yönetim Bilgi Sistemi/Tam Yetklili Yönetici".then I am giving this group to myself then I can see the checkbox.

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Okt. 23
1994
2
Aug. 23
278
2
Juni 16
3916
1
Juli 23
4227
0
März 23
207