This question has been flagged
2 Replies
4494 Views

Hi everyone,i'm working with Openerp 7 and i wanna add a new menuitem in the inherit module fleet management and i have this error in the class transport_point _inherit='fleet.vehicle' ^ IndentationError: unexpected indent

myfile.py

class fleet_vehicle(osv.osv):

  _name = 'fleet.vehicle'
  _inherit='fleet.vehicle'
  _columns = {
        'type':fields.selection([('ci','C.I'), ('fourgon','Fourgon'),
             ('fourgonnette','Fourgonnette'),('minibus','Mini-bus'),
              ('pickup','Pick-up'),('poidslourds','Poids Lourds'),
            ('vfonction','V.fonction')],'Type'),
        'chauffeur': fields.many2one('hr.employee', 'Chauffeur',required=True),
        'name': fields.char('Nom du point', size=50, required=True),
        'amount': fields.float('Montant'),
    }   
fleet_vehicle()



class transport_point(osv.osv):
        _name = 'transport.point'
    _inherit='fleet.vehicle'
        _columns = {
              'name': fields.char('Nom du point', size=50, required=True),
              'amount': fields.float('Montant'),
             }
    _defaults={
        'amount': 0,
         }
Avatar
Discard

add transport_point() at the end of class transport_point.

Author

HI I add transport_point() at the end of class transport_point and i still have the same error;any other idea please?

Best Answer

Hi,

IndentationError: unexpected indent

it is error in syntaxe :we must respect the syntax of python

image description

use 4 space for each block :

image description

Thanks.

Avatar
Discard
Author Best Answer

hi it work's now,it did not work before because i copy and paste from another code...but now i have an error from an xml folder.I have this error:

ValueError: No such external ID currently defined in the system: testflt.menu_root

myfolder.xml

<menuitem name="Parametrage" id="param" parent="menu_root" />

<record model="ir.ui.view" id="view_transport_point_tree_1"> <field name="name">transport.point.tree</field> <field name="model">transport.point</field> <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Transport Point Information"> <field name="name"/> <field name="amount"/> </tree> </field> </record>

   <!-- Transport Point Form View -->
   <record model="ir.ui.view" id="transport_point_form1">
        <field name="name">transport.point.form</field>
        <field name="model">transport.point</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Transport Point">
                <field name="name" />
                <field name="amount" />
            </form>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_transport_point">
        <field name="name">Point Information</field>
        <field name="res_model">transport.point</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form,search</field>
    </record>

     <menuitem action="action_transport_point" id="menu_param_parent" parent="param" />
Avatar
Discard

parent="fleet.menu_root"

Author

thank you it work's