Reputation: 431
I have a version 9 modue that works in V9. I am trying to get it to install in V10 and getting an error. The error happens when creating a security group. I also tried following from the maintainer tools Migration to V10.
> Replace openerp imports to odoo.
>
> Rename __openerp__.py to __manifest__.py
>
> Replace select = True by index = TrueReplace string selectors in XML by name (if possible) or other attribute selector or even another
> equivalent path/reference. For example, change <group string="x"
> position="after"> by <group name="x" position="after">Remove <data>
> and </data> in xml files if noupdate="0"
>
> Replace the <openerp>/</openerp> tags in xml files by <odoo>/</odoo>.
>
> Don't use @api.one with @api.onchange or it will crash.
>
> ...
Below is the error
File "/home/jason/git/odoo10/odoo/addons/base/ir/ir_model.py", line 1028, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ParseError: "<type 'exceptions.ValueError'>: "External ID not found in the system: base.group_sale_salesman_all_leads" while evaluating
"[(4,ref('base.group_user')), (4,ref('account.group_account_invoice')), (4,ref('stock.group_stock_user')), (4,ref('base.group_sale_salesman_all_leads'))]"" while parsing /home/jason/git/customaddons/layby_order/security/layby_security.xml:5, near
<record id="group_layby_user" model="res.groups">
<field name="name">Layby User</field>
<field name="category_id" ref="base.module_category_sales_management"/>
<field name="comment">This is applicable for Layby User.</field>
<field name="implied_ids" eval="[(4,ref('base.group_user')), (4,ref('account.group_account_invoice')), (4,ref('stock.group_stock_user')), (4,ref('base.group_sale_salesman_all_leads'))]"/>
</record>
layby_security.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="group_layby_user" model="res.groups">
<field name="name">Layby User</field>
<field name="category_id" ref="base.module_category_sales_management"/>
<field name="comment">This is applicable for Layby User.</field>
<field name="implied_ids" eval="[(4,ref('base.group_user')),
(4,ref('account.group_account_invoice')),
(4,ref('stock.group_stock_user')),
(4,ref('base.group_sale_salesman_all_leads'))]"/>
</record>
</data>
</openerp>
ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_layby_order,layby.order,model_layby_order,group_layby_user,1,1,1,0
access_layby_order_line,layby.order.line,model_layby_order_line,group_layby_user,1,1,1,1
If i stop the server and start it again then try the install the first error I get is
File "/home/jason/git/customaddons/layby_order/layby.py", line 147
date_order = fields.Date.context_today(self)
SyntaxError: invalid syntax
after that if I install I get the Parse error External ID not found. I am thinking the reason I am getting that is because the install is stopping on line 147 date_order = fields.Date.context_today(self)
but I have no idea why.
Updated
Still stopping on line 147
date_order = fields.Date.context_today(self))
after changing to sales_team.group_sale_salesman_all_leads
original error is gone but now get
raise Exception(_('Module loading %s failed: file %s could not be processed:\n %s') % (module, fname, warning_msg))
Exception: Module loading layby_order failed: file layby_order/security/ir.model.access.csv could not be processed:
No matching record found for external id 'model_layby_order' in field 'Object'
Missing required value for the field 'Object' (model_id)
No matching record found for external id 'model_layby_order_line' in field 'Object'
Missing required value for the field 'Object' (model_id)
Upvotes: 1
Views: 911
Reputation: 154
OCA's guide to migrate modules from v9 to v10 is mostly sufficient, except that it does not mention that several security groups that used to be prefixed by base
have been moved / modularised to their respective modules, such as base.group_hr_user
and as you have seen in your case, base.group_sale_salesman_all_leads
.
To solve your first issue, change your ref base.group_sale_salesman_all_leads
to sales_team.group_sale_salesman_all_leads
in layby_security.xml
:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="group_layby_user" model="res.groups">
<field name="name">Layby User</field>
<field name="category_id" ref="base.module_category_sales_management"/>
<field name="comment">This is applicable for Layby User</field>
<field name="implied_ids" eval="[(4,ref('base.group_user')),
(4,ref('account.group_account_invoice')),
(4,ref('stock.group_stock_user')),
(4,ref('sales_team.group_sale_salesman_all_leads'))]"/>
</record>
</data>
</openerp>
For your second issue, if date_order
is a field you are adding to your class, do this instead:
date_order = fields.Date(default=fields.Date.context_today)
Otherwise, if you are actually declaring a variable instead of a new field, your syntax looks OK and Odoo 10 is still using fields.Date.context_today()
.
You can look it up on github.
EDIT: (after question was updated)
The error might be because you are missing the model declaration in your res.groups
record.
Could you try adding <field name="model_id" ref="model_layby_order"/>
in layby_security.xml?
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="group_layby_user" model="res.groups">
<field name="name">Layby User</field>
<field name="model_id" ref="model_layby_order"/>
<field name="category_id" ref="base.module_category_sales_management"/>
<field name="comment">This is applicable for Layby User</field>
<field name="implied_ids" eval="[(4,ref('base.group_user')),
(4,ref('account.group_account_invoice')),
(4,ref('stock.group_stock_user')),
(4,ref('sales_team.group_sale_salesman_all_leads'))]"/>
</record>
</data>
</openerp>
Upvotes: 2