Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
5786 Näkymät

Hey,

I started developing with OpenERP and have some "beginner" questions.

1) First thing is testing a module. For updating Python files I restart openerp-server, and for updating XML files I update the module. But that module updating is really annoying, because every time I have to click "all installed modules" search for my module, update it, the page reloads and I'm back in OpenERP CRM custom module. So because of reloading the page and not bringing me back to my module I have to do this procedure every time, isn't there a faster way to update the module? Via Console, or a fast button to update all modules?

2) Next thing is, how do I create my own many2one fields with my own preset values?

So I found this:

fields.many2one(
        'other.object.name',
        'Field Name',
        optional parameters)

But with this I can only implement existing many2one fields, don't I? For example I need a many2one field with option one: "Mister" and option two: "Miss", how do I do that?

3) Can I convert a many2one fileld to a many2many one? For example the title field would look as many2one field like this:

 fields.many2one(
            'res.partner.title',
            'title')

But many2many fields needs for example a "relation object" which the title field don't have. How would the title field as many2many look like?

Thanks!

Avatar
Hylkää
Paras vastaus

Hi,

You can update module from terminal using this command.

openerp-server -d your_db_name -u your_module_name

fields.many2one( 'other.object.name', 'Field_name')

fields.many2many('other.object,name', 'realtion_table_name', 'table_column1', 'table_column2', 'Fields name', 'Other optional parameter'),

Avatar
Hylkää
Paras vastaus

Hi,

except_orm: ('Programming Error', 'There is no reference available for res.partner.test')

For this error try to include your res.partner.test object in __openerp__.py dependencies.

"depends" : ['base','res.partner.test']
Avatar
Hylkää
Tekijä

Okay, I made it with: fields.selection((('Dr.','Dr.'),('Prof.','Prof.'),('Dr. h.c.','Dr. h.c.')),'Titel') Thanks anyway, now I understand the many2one fields ;)

Tekijä Paras vastaus

Hey, thanks for your answer, updating the module via command line works great!

I'm sorry, but I don't understand the line

fields.many2one( 'other.object.name', 'Field_name')

It is exactly the same I wrote. When I try to create a custom field like:

'test' : fields.many2one('res.partner.test', 'test'),

I get this error:

except_orm: ('Programming Error', 'There is no reference available for res.partner.test')

What I need is a many2one field with option one: "Mister" and option two: "Miss", how do I do that?

Edit:

I made it with:

fields.selection((('Dr.','Dr.'),('Prof.','Prof.'),('Dr. h.c.','Dr. h.c.')),'Titel')
Avatar
Hylkää

have you define res.partner.test object ?

Add module name of res.partner.test object in __openerp__.py in dependse