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

Error In Python file

By
bakhtawar
on 11/29/13, 1:54 PM 1,640 views

in create python code in my modulue here is code

    from osv import osv , fields
     class asset_allocation(osv.osv):
   _name = 'asset.allocation'
   _description = 'Asset Allocation'
   _columns = {
    'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
    'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
    'asset_status': fields.date.time( 'Status', required=True,),
    'note': fields.text('Note'),
     }

     asset_allocation()

Error

Unresolved import: fields

Undefined variable from import: osv

in Openerp 7 you can't directly import osv for that you need to follow this from openerp.osv import osv, fields

Anil R. Kesariya
on 12/1/13, 4:19 AM
2
Mariusz Mizgier
On 11/29/13, 3:36 PM

You've used bad syntax. Correct way is:

from openerp.osv import fields, osv

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: 11/29/13, 1:54 PM
Seen: 1640 times
Last updated: 3/16/15, 8:10 AM