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 Browse method need help [Closed]

By
Odoo
on 3/31/14, 7:31 AM 846 views

The Question has been closed for reason: too subjective and argumentative

by
Odoo
on 07/03/2014 01:00:06

class Tour(osv.osv):

_name = 'tour.create'
_description = 'tour.create'

_columns = {




                'adltprice':fields.float('Adult CostPrice ', required=True),
                 'chldprice':fields.float('Child CostPrice', required=True),

                    }

class tour_booking(osv.osv):

_name='tour.booking'
_inherits = {'res.partner':'partner_id'}



          'adult_id':fields.integer('Adults',required=True),
          'child_id':fields.integer('Childs',required=True),

def calc_total_amount(self,cr,uid,ids,context=None):

    for fee in self.pool.get('tour.create').browse(cr,uid,ids,context=context):
        chldprice_value=fee.chldprice
        adltprice_value=fee.adltprice            
    num=self.read(cr,uid,ids,['adult_id','child_id'],context=context)
    child_cost=num[0]['child_id']*chldprice_value
    adult_cost=num[0]['adult_id']*adltprice_value

    total=child_cost+adult_cost
    vals={
           'tour_total':total

           }
    self.write(cr,uid,ids,vals)
    return True   

 this function returned correct result  in first time ,bt in second time onwards it raised error need help......

---------------ERROR ----------------

tour_test openerp.osv.orm: No field_values found for ids [3] in browse_record(tour.create, 3) 2014-03-31 06:22:11,039 1080 ERROR tour_test openerp.osv.osv: Uncaught exception

Field chldprice not found in browse_record(tour.create, 3)' 2014-03-31 06:22:11,039 1080 ERROR tour_test openerp.netsvc: Field chldprice not found in browse_record(tour.create, 3)

1_ what do you mean by "this function returned correct result in first time ,bt in second time onwards it raised error need help......". 2_ What's the content of your __init__ and __openerp__ .py files ? 3_ Why using fields.integer for adult_id and child_id ?

Med Said BARA
on 3/31/14, 9:03 AM
0

Nehal

--Nehal--
2090
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
On 3/31/14, 7:35 AM

HI,

Try to put: for fee in self.pool.get('tour.create').browse(cr,uid,ids[0],context=context) and check.

no i got another error NotImplementedError: Iteration is not allowed on browse_record(tour.create, 1)

Odoo
on 3/31/14, 7:53 AM

Now i got another Error is--------- NotImplementedError: Iteration is not allowed on browse_record(tour.create, 1)

Odoo
on 3/31/14, 7:54 AM
0
Yug Faa
On 3/31/14, 7:55 AM

before this line :

for fee in self.pool.get('tour.create').browse(cr,uid,ids,context=context):

Add :

  tour_ids = self.pool.get('tour.create').search(cr, uid, [])

And change the line to :

for fee in self.pool.get('tour.create').browse(cr,uid,tour_ids,context=context):

Make it resolved

Hi , thanks Yug Faa...error is resolved

novasoft
on 3/31/14, 10:16 AM

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 3/31/14, 7:31 AM
Seen: 846 times
Last updated: 3/16/15, 8:10 AM