This question has been flagged
2 Replies
5026 Views

Hi,

I try to create a custom view in OpenERP V6.1. I've found few documentation online and i learn looking form existing view like ganttView, etc... but i've got a problem, openERP don't see my view.

validation error: value custom in not for the field "ir_ui_view.type" is not in selection.

Sources:

static/src/xml/customView.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="custom">
    <HTML> 
    <BODY>
    <h1>custom View</h1>
    </BODY> 
    </HTML> 
    </t>
</templates>

static/src/js/script.js

openerp.myaddons = function (openerp){   
    openerp.web.views.add('custom', 'openerp.myaddons.CustomView');

openerp.myaddons.CustomView = openerp.web.View.extend({
    display_name: 'custom',
    template: "custom",

    init: function() {
    this._super.apply(this, arguments)
    alert('load')
    },

    start: function() {
    alert("start custom")
    },
})

myaddonsView.xml

           <!-- VUES -->
    <record model="ir.ui.view" id="myaddons_module_custom">
        <field name="name">myaddons.module.custom</field>
        <field name="model">myaddons.module</field>
        <field name="type">custom</field>
    </record>    

    <!-- ACTIONS -->
    <record model="ir.actions.act_window" id="action_myaddons_module">
        <field name="name">Aff</field>
        <field name="res_model">myaddons.module</field>
        <field name="view_type">form</field>
        <field name="view_mode">form, custom</field>
    </record>

Thanks for your help, and if you have some tutorials or simple example don't hesitate ;)

EDIT:

__openerp__.py

{
    'name': "my module",
    'author': "truc",
    'category' : '',
    'description':'a module',
    'version': "1.0",
    'depends': ['web','base_setup'],
    'js': [ 'static/src/js/*' ],
    'qweb' : [  'static/src/xml/*'],
    'update_xml': ['myaddonsView.xml'],
    'installable': True,
    'auto_install': True,
}
Avatar
Discard
Best Answer

There is your xml file in the __openerp__ file?

Avatar
Discard
Author

yes, the xml and js file 'qweb' : [ 'static/src/xml/'], 'js': [ 'static/src/js/' ]

Best Answer

Same name template in your .js and .xml ?
 

Avatar
Discard