Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
5992 Переглядів

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,
}
Аватар
Відмінити
Найкраща відповідь

There is your xml file in the __openerp__ file?

Аватар
Відмінити
Автор

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

Найкраща відповідь

Same name template in your .js and .xml ?
 

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
січ. 20
8849
3
лип. 17
10482
1
жовт. 18
8386
1
серп. 24
1942
0
груд. 22
2611