Skip to Content
Menu
This question has been flagged
2 Replies
3740 Views

I am beginner, trying to follow Daniel Reis's book Odoo 10 Development. 

I found error upgrading the module. This is

This is   todo_model.py: 

from odoo import models, fields, api
# from odoo.exceptions import UserError, ValidationError

class ToDoTask(models.Model):
_name = 'todo.task'
_description = 'To-Do Task'

name = fields.Char('Description', required=True)
is_done = fields.Boolean('Done?')
active = fields.Boolean('Active?', default=True)
@api.multi
def do_toggle_done(self):
for task in self:
task.is_done = not task.is_done
return True

@api.multi
def do_clear_done(self):
dones = self.search([('is_done', '=', True)])
dones.write({'active': False})
return True


The security  ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_todo_task_group_user,todo.task.user,model_todo_task,base.group_user,1,1,1,1

And todo_access_rules.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="todo_task_user_rule" model="ir.rule">
<field name="name">ToDo Tasks only for owner</field>
<field name="model_id" ref="model_todo_task"/>
<field name="domain_force">[('create_uid','=',user.id)]</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>
</data>
</odoo>


Init .py and manifest .py seem like ok.

Views for tree, form, search seem like ok.

But when the apps upgraded, it throws error: 

What is going on? I check models.py but I wonder what is what is KeyError, what is the relation with one2many? Please help.

Widi


Avatar
Discard

did you update odoo code files and forget to run upgrade commands ?? seems like something is missing there..

Author Best Answer

Dear Fatih thanks for your answer. But I have found the solution. It is because I unintentionally put one whitespace after perm_unlink in first row security csv. This one unseen whitespace made the module cannot be upgraded. Bad mistakes for beginner like me. This question can be closed now.

Avatar
Discard
Related Posts Replies Views Activity
0
Aug 22
895
1
Jul 22
17729
0
Apr 22
1611
3
Sep 21
1913
2
Sep 21
3206