Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Dev beginner questions - Fields, update module faster

By
birduser
on 4/18/14, 11:21 PM 2,196 views

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!

1

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/19/14, 2:13 AM

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'),

2

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 4/22/14, 2:47 AM

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']

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 ;)

birduser
on 4/23/14, 1:18 AM
0
birduser
On 4/22/14, 12:25 AM

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')

have you define res.partner.test object ?

Jagdish Panchal
on 4/22/14, 1:57 AM

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

Jagdish Panchal
on 4/22/14, 1:58 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/18/14, 11:21 PM
Seen: 2196 times
Last updated: 3/16/15, 8:10 AM