Odoo Help


OpenERP7: Sequence value in Child view

on 1/29/14, 1:13 AM 1,170 views

I have added one column named as "line_no" in POLine. Im trying to get the below structure. Please anyone help me

 PO0001      PO0002    PO0003  
   Line      Line      Line
    1          1        1
    2          2        2
    3                   3

My code:

def default_get(self, cr, uid, ids, context=None):
    res = {}
    next_no = 0;
    next_line_no  =1
    obj = value[0]
    next_no = next_no + value.next_line_no
    total =+ next_no                
       'line': total
    return res

   'next_line_no':fields.integer(' Next Line No'),
   'line_no':fields.function(_get_line_no,string='Line No',type='integer'),

Im getting error:

    TypeError: %d format: a number is required, not unicode

Another Question

I will get order and order Id in another class by using below format

    record_id = context.get('active_id')
    orderid= self.pool.get('purchase.order.line').browse(cr, uid, record_id)
    order = self.pool.get('purchase.order').browse(cr, uid, move_obj.order_id.id)

In Order Line Class How do get Order and Order Line ID.

shashank verma
On 1/29/14, 2:55 AM


1."TypeError: %d format: a number is required, not unicode"

ur column datatype is integer , and u passing character value in it. u have to type cast before u pass the value in integer field by int(val)

1.1 "In Order Line Class How do get Order and Order Line ID"

 class orderline():

def get_orderline(self,cr,uid,ids,context):

   // here ids will be ur current orderline id

    po_order=self.browse(cr,uid,ids)[0] .order_id


  // po_name will give order name  i.e PO00001
On 1/29/14, 6:55 AM

I got this by using below code:

def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):                     
    nextno =0
    no = record.next_line_no        
    next_no = nextno + no
    total += next_no
              'line_no': total
return res

_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno"),
'next_line_no':fields. function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
_defaults = {

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 1/29/14, 1:13 AM
Seen: 1170 times
Last updated: 3/16/15, 8:10 AM