1

below i have mentioned the grievance.redressal(model), view and access control list. i have tried to added acl for grievance.redressal(model) in ir.model.access.csv. but module is failed when server updation

class file:

class grievance_redressal(models.Model):
    _name = 'grievance.redressal'
    name = fields.Char('Name with Initial', size=64)

View:

<record id="view_grievance_redressal_form" model="ir.ui.view" >
            <field name="name">grievance.redressal.form</field>
            <field name="model">grievance.redressal</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Grievance Redressal" version="7.0"> 
                    <sheet> 
                <group>
                <field name="name"/>    
                </group>
                    </sheet>
                </form> 
            </field>
        </record>

        <record id="view_grievance_redressal_tree" model="ir.ui.view">
            <field name="name">grievance.redressal.tree</field>
            <field name="model">grievance.redressal</field>            
            <field name="arch" type="xml">
                <tree string="Grievance Redressal">
                    <field name="name"/>
                </tree>
            </field>
        </record>

       <record id="action_grievance_redressal" model="ir.actions.act_window">
            <field name="name">Grievance Redressal</field>
            <field name="res_model">grievance.redressal</field>
            <field name="view_mode">tree,form</field> 
            <field name="view_type">form</field>
        </record>

        <menuitem action="action_grievance_redressal" id="grievance_redressal_menu" parent="operations" sequence="30"/>

ACL:

access_grievance_redressal_group_officer, access.grievance.redressal.group.officer, model_grievance.redressal, group_officer 1,0,0,0

if i've tried to add ACL for newly created model(grievance.redressal) in odoo. but is throws following error

File "/home/user/Projects/test/test-server/openerp/service/server.py", line 885, in preload_registries
    registry = RegistryManager.new(dbname, update_module=update_module)
  File "/home/user/Projects/test/test-server/openerp/modules/registry.py", line 385, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 333, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 156, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 98, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/home/user/Projects/test/test-server/openerp/tools/convert.py", line 846, in convert_file
    convert_csv_import(cr, module, pathname, fp.read(), idref, mode, noupdate)
  File "/home/user/Projects/test/test-server/openerp/tools/convert.py", line 914, in convert_csv_import
    raise Exception(_('Module loading %s failed: file %s could not be processed:\n %s') % (module, fname, warning_msg))
Exception: Module loading test failed: file test/security/ir.model.access.csv could not be processed:
 Line 1 : model+AF8-id

csv file:

enter image description here

Eswaran
  • 21
  • 1
  • 7
  • Could you please post the whole content of test/security/ir.model.access.csv? I miss the first line and why are there spaces everywhere? – CZoellner Jun 05 '18 at 11:07
  • please find below mentioned CSV file – Eswaran Jun 05 '18 at 11:52
  • id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink access_grievance_redressal_vvcoe_group_student access.grievance.redressal.vvcoe.group.student model_grievance_redressal vvcoe_group_student 1 0 0 0 access_grievance_redressal_vvcoe_group_library_management access.grievance.redressal.vvcoe.group.library.management model_grievance_redressal vvcoe_group_library_management 1 0 0 0 – Eswaran Jun 05 '18 at 11:55
  • I am assuming the problem lies with the data in model_id:id. The data should be in format "module_name.model_model_name". For example, if your module name is "grievance" and the model is "grievance.redressal" then the data should go like "grivance.model_grievance_redressal". – Sudhanshu Gupta Jun 05 '18 at 13:31
  • thanks. i have tried that too. the problem lies in editing tool – Eswaran Jun 06 '18 at 05:49

2 Answers2

1

Seems to be an encoding problem with OpenOffice and csv files. You should save your file as UTF-8. For more information look here.

Kenly
  • 24,317
  • 7
  • 44
  • 60
CZoellner
  • 13,553
  • 3
  • 25
  • 38
0

I have solved the issue. the problem is editing CSV in libreoffice is some time failed. when i edited CSV file in text editor is works fine. thanks

ACL i have added in csv using text editor as a editing tool:

access_grievance_redressal_group_student,access.grievance.redressal.group.student,model_grievance_redressal,group_student,1,0,0,0
Eswaran
  • 21
  • 1
  • 7