Hi catinga: Here... the problem is not knowing python but knowing OpenERP objects and how to manage them...
I will try to give you some clouds about how to understand the code is shown on the example http://doc.openerp.com/developer/2_First_Module/2_module.html#model-view-controler-architecture First... when you build a module you have to write the __terp__.py There you fix some general parameters about your new module. Importants: "depends" : ["base"], --> Modules that have to be installed so your new module can work. "init_xml" : [], "update_xml" : ["custom_view.xml"], --> Here, the new module is based on custom_view, it is adding new functionality to this module. So if it's custom_view.xml, you have to copy custom.py and begin building your new module based on this. custom.py has got this structure, so you have to copy exactly the structure and modify it: from osv import osv, fields class travel_hostel(osv.osv): _name = 'travel.hostel' _inherit = 'res.partner' _columns = { 'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'), 'quality': fields.char('Quality', size=16), } _defaults = { } travel_hostel() The new module hostel, will have 2 fields, rooms_id that is one2many to rooms. So, one hostel will have many rooms. And quality will be a simple char type field. In this case, you also need to define travel_room class that is not shown on the example. Once you have defined classes you have to define how to show them on the application. You have to define the customer interface... <openerp> <data> ------ HERE You define the hostel form. When you open hostels form on form view you will see the two fields defined on the class rooms_id and quality <record> <field>Hostel</field> <field>travel.hostel</field> <field>form,tree</field> </record> ------ This is a menu entry for travel agency, shown in main menu <menuitem> ------ This is a menu entry for Hostels, shown in right side when you click menu_travel (see the parameter parent = "menu_travel") <menuitem> ------ This is a menu entry for rooms, shown in right side like hostels. It's also a menu_travel child <record> <field>Room</field> <field>travel.room</field> <field>form,tree</field> </record> <menuitem> ------ This is a menu entry for Singel rooms, shown in right side but it is a rooms menu child, so it's shown below it. See parent="menu_travel_room_form" parameter. It shows rooms, but only those whose bed field is set to 1. See domain field <field>[('beds','=',1)]</field>. Domain fields define the query WHERE sentence. <record> <field>Single Rooms</field> <field>travel.room</field> <field>[('beds','=',1)]</field> <field>tree,form</field> </record> <menuitem> ------ This is a menu entry for double rooms, shown in right side but it is a rooms menu child, so it's shown below it. See parent="menu_travel_room_form" parameter. It shows rooms, but only those whose bed field is set to 2. See domain field <field>[('beds','=',2)]</field>. <record> <field>Double Rooms</field> <field>travel.room</field> <field>[('beds','=',2)]</field> <field>tree,form</field> </record> <menuitem> </data> </openerp> Wishing this can help you.... ------------------------ Manuales, Videotutoriales de OpenERP en http://www.openerpsite.com -------------------- m2f -------------------- -- http://www.openobject.com/forum/viewtopic.php?p=32042#32042 -------------------- m2f -------------------- _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman/listinfo/tinyerp-users
