Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2378 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

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.

Post Terkait Replies Tampilan Aktivitas
1
Okt 23
1919
2
Agu 23
278
2
Jun 16
3882
1
Jul 23
4169
0
Mar 23
207