Odoo Help

0

Openerpv7: fields.function

By
Silviaa
on 2/1/14, 4:15 AM 714 views

I'm using OpenERP v7 and requesting this below output in Purchase order line window

PO0001      PO0002    PO0003  
  Line      Line      Line
  10          10        10
  20          20        20
  30                    30

My code:

_columns={
'line_no':fields.function(_get_line_no,string='Line No',type='integer', multi="lineno",store=True),
'next_line_no':fields.function(_get_line_no,string='Next Line No',type='integer', multi="lineno", store=True),
}
_defaults = {
    'next_line_no':10,
    'line_no':0,   
}
def _get_line_no(self, cr, uid, ids, name, arg, context=None):
  res = {}
  nextno =0
  total =0
  for record in self.browse(cr, uid, ids, context=context):                             
    no = record.next_line_no        
    next_no = nextno + no
    total += next_no
    res[record.id]={
              'next_line_no':next_no,
              'line_no': total,                                 
    }        
  return res

But im getting this kind of output . Any advice would be greatful.

PO0001      PO0002    PO0003  
  Line      Line      Line
  10          40        60
  20          50        70
  30                    80

Anyone could help me to achive the required output.

The same requirement used in the different way in the link http://stackoverflow.com/questions/21375392/openerp-v7-sequence-number

Prakash
on 2/1/14, 4:58 AM

That output also what im getting now.Im not requesting that.

Silviaa
on 2/1/14, 5:13 AM

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.

Register

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)

Stats

Asked: 2/1/14, 4:15 AM
Seen: 714 times
Last updated: 3/16/15, 8:10 AM