Error when adding new fields in tree view odoo 10.0












0















I want to add new attributes in product tree view but an error happened when I started my server and updated my addons look like :




ParseError: "Erreur lors de la validation de la contrainte



Modxe8le non trouvxe9 : product.template

Contexte de l'erreur :
Vue `productTree`
[view_id: 752, xml_id: n/a, model: product.template, parent_id: 308]
None" while parsing /opt/odoo/odoo-10.0/addons/test_tuto/views/views.xml:3, near
<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>



Here is my view source code,



<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>


And here is the python code I added 3 fields in my class inherit from product template class.



from odoo import models, fields, api

class test_tuto(models.Model):
_inhirit = 'product.template'

calories = fields.Integer("Calories")
servingsize = fields.Float("Serving size")
lastupdated = fields.Datetime('Last Updated')


as you request here you are my manifest.py file
I write my xml code in views.xml file



# -*- coding: utf-8 -*-
{
'name': "Test_tuto",

'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",

'description': """
Long description of module's purpose
""",

'author': "My Company",
'website': "http://www.yourcompany.com",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}









share|improve this question

























  • Can you show the manifest?

    – WaKo
    Nov 25 '18 at 14:10











  • OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

    – Sylver
    Nov 26 '18 at 7:34











  • You need to add product in depends.

    – WaKo
    Nov 26 '18 at 8:22











  • Correct _inhirit.

    – WaKo
    Nov 26 '18 at 11:13
















0















I want to add new attributes in product tree view but an error happened when I started my server and updated my addons look like :




ParseError: "Erreur lors de la validation de la contrainte



Modxe8le non trouvxe9 : product.template

Contexte de l'erreur :
Vue `productTree`
[view_id: 752, xml_id: n/a, model: product.template, parent_id: 308]
None" while parsing /opt/odoo/odoo-10.0/addons/test_tuto/views/views.xml:3, near
<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>



Here is my view source code,



<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>


And here is the python code I added 3 fields in my class inherit from product template class.



from odoo import models, fields, api

class test_tuto(models.Model):
_inhirit = 'product.template'

calories = fields.Integer("Calories")
servingsize = fields.Float("Serving size")
lastupdated = fields.Datetime('Last Updated')


as you request here you are my manifest.py file
I write my xml code in views.xml file



# -*- coding: utf-8 -*-
{
'name': "Test_tuto",

'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",

'description': """
Long description of module's purpose
""",

'author': "My Company",
'website': "http://www.yourcompany.com",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}









share|improve this question

























  • Can you show the manifest?

    – WaKo
    Nov 25 '18 at 14:10











  • OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

    – Sylver
    Nov 26 '18 at 7:34











  • You need to add product in depends.

    – WaKo
    Nov 26 '18 at 8:22











  • Correct _inhirit.

    – WaKo
    Nov 26 '18 at 11:13














0












0








0








I want to add new attributes in product tree view but an error happened when I started my server and updated my addons look like :




ParseError: "Erreur lors de la validation de la contrainte



Modxe8le non trouvxe9 : product.template

Contexte de l'erreur :
Vue `productTree`
[view_id: 752, xml_id: n/a, model: product.template, parent_id: 308]
None" while parsing /opt/odoo/odoo-10.0/addons/test_tuto/views/views.xml:3, near
<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>



Here is my view source code,



<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>


And here is the python code I added 3 fields in my class inherit from product template class.



from odoo import models, fields, api

class test_tuto(models.Model):
_inhirit = 'product.template'

calories = fields.Integer("Calories")
servingsize = fields.Float("Serving size")
lastupdated = fields.Datetime('Last Updated')


as you request here you are my manifest.py file
I write my xml code in views.xml file



# -*- coding: utf-8 -*-
{
'name': "Test_tuto",

'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",

'description': """
Long description of module's purpose
""",

'author': "My Company",
'website': "http://www.yourcompany.com",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}









share|improve this question
















I want to add new attributes in product tree view but an error happened when I started my server and updated my addons look like :




ParseError: "Erreur lors de la validation de la contrainte



Modxe8le non trouvxe9 : product.template

Contexte de l'erreur :
Vue `productTree`
[view_id: 752, xml_id: n/a, model: product.template, parent_id: 308]
None" while parsing /opt/odoo/odoo-10.0/addons/test_tuto/views/views.xml:3, near
<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>



Here is my view source code,



<record id="view_product_tree_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="name">productTree</field>
<field name="model">product.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>
</field>
</record>


And here is the python code I added 3 fields in my class inherit from product template class.



from odoo import models, fields, api

class test_tuto(models.Model):
_inhirit = 'product.template'

calories = fields.Integer("Calories")
servingsize = fields.Float("Serving size")
lastupdated = fields.Datetime('Last Updated')


as you request here you are my manifest.py file
I write my xml code in views.xml file



# -*- coding: utf-8 -*-
{
'name': "Test_tuto",

'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",

'description': """
Long description of module's purpose
""",

'author': "My Company",
'website': "http://www.yourcompany.com",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}






treeview odoo-10






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 7:31







Sylver

















asked Nov 25 '18 at 9:33









SylverSylver

184




184













  • Can you show the manifest?

    – WaKo
    Nov 25 '18 at 14:10











  • OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

    – Sylver
    Nov 26 '18 at 7:34











  • You need to add product in depends.

    – WaKo
    Nov 26 '18 at 8:22











  • Correct _inhirit.

    – WaKo
    Nov 26 '18 at 11:13



















  • Can you show the manifest?

    – WaKo
    Nov 25 '18 at 14:10











  • OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

    – Sylver
    Nov 26 '18 at 7:34











  • You need to add product in depends.

    – WaKo
    Nov 26 '18 at 8:22











  • Correct _inhirit.

    – WaKo
    Nov 26 '18 at 11:13

















Can you show the manifest?

– WaKo
Nov 25 '18 at 14:10





Can you show the manifest?

– WaKo
Nov 25 '18 at 14:10













OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

– Sylver
Nov 26 '18 at 7:34





OK ! i edited the post, you can see my manifest file ! i writed my xml code in views.xml file

– Sylver
Nov 26 '18 at 7:34













You need to add product in depends.

– WaKo
Nov 26 '18 at 8:22





You need to add product in depends.

– WaKo
Nov 26 '18 at 8:22













Correct _inhirit.

– WaKo
Nov 26 '18 at 11:13





Correct _inhirit.

– WaKo
Nov 26 '18 at 11:13












1 Answer
1






active

oldest

votes


















1














Please try changing your "xpath" like this



add 'product' in depends



'depends': ['base','product'],


<xpath expr="//tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>





share|improve this answer


























  • it doesn't work ! :(

    – Sylver
    Nov 26 '18 at 7:26











  • Please see my edited answer

    – sfx
    Nov 26 '18 at 7:53











  • thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

    – Sylver
    Nov 26 '18 at 9:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466218%2ferror-when-adding-new-fields-in-tree-view-odoo-10-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Please try changing your "xpath" like this



add 'product' in depends



'depends': ['base','product'],


<xpath expr="//tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>





share|improve this answer


























  • it doesn't work ! :(

    – Sylver
    Nov 26 '18 at 7:26











  • Please see my edited answer

    – sfx
    Nov 26 '18 at 7:53











  • thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

    – Sylver
    Nov 26 '18 at 9:13
















1














Please try changing your "xpath" like this



add 'product' in depends



'depends': ['base','product'],


<xpath expr="//tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>





share|improve this answer


























  • it doesn't work ! :(

    – Sylver
    Nov 26 '18 at 7:26











  • Please see my edited answer

    – sfx
    Nov 26 '18 at 7:53











  • thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

    – Sylver
    Nov 26 '18 at 9:13














1












1








1







Please try changing your "xpath" like this



add 'product' in depends



'depends': ['base','product'],


<xpath expr="//tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>





share|improve this answer















Please try changing your "xpath" like this



add 'product' in depends



'depends': ['base','product'],


<xpath expr="//tree/field[@name='categ_id']" position="after">
<field name="calories"/>
<field name="servingsize"/>
<field name="lastupdated"/>
</xpath>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 '18 at 7:53

























answered Nov 26 '18 at 4:39









sfxsfx

1,324916




1,324916













  • it doesn't work ! :(

    – Sylver
    Nov 26 '18 at 7:26











  • Please see my edited answer

    – sfx
    Nov 26 '18 at 7:53











  • thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

    – Sylver
    Nov 26 '18 at 9:13



















  • it doesn't work ! :(

    – Sylver
    Nov 26 '18 at 7:26











  • Please see my edited answer

    – sfx
    Nov 26 '18 at 7:53











  • thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

    – Sylver
    Nov 26 '18 at 9:13

















it doesn't work ! :(

– Sylver
Nov 26 '18 at 7:26





it doesn't work ! :(

– Sylver
Nov 26 '18 at 7:26













Please see my edited answer

– sfx
Nov 26 '18 at 7:53





Please see my edited answer

– sfx
Nov 26 '18 at 7:53













thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

– Sylver
Nov 26 '18 at 9:13





thanks this error gone but what about "'calories' field doesn't exit", but it exist in table in database and in database structer in odoo configuration

– Sylver
Nov 26 '18 at 9:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466218%2ferror-when-adding-new-fields-in-tree-view-odoo-10-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)