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

How to Override a field in OpenERP7.0

By
Rakhi sudevan
on 3/14/14, 1:41 AM 691 views

Hi, In my DB ,i create one float field"TotalQty" in sale.order.line using this code

from osv import osv from osv import fields

class jrquantity(osv.osv):

_name = 'sale.order.line'
_inherit = 'sale.order.line'

def _total(self, cr, uid, ids,name,args, context=None):
    res = {}
    for record in self.browse(cr, uid, ids, context=context):
        res[record.id] =  record.noofcarton * record.pcs
    return res
_columns = {
        'noofcarton':fields.integer('No of CartonBoxes',size=64, required=False, readonly=False),
          'pcs':fields.integer('No of Pcs', size=64, required=False, readonly=False),
          'qty': fields.function(_total, type='integer', method=True, string='TotalQty')
    }

jrquantity()

I need the value of the "TotalQty" to the existing field "product_uom_qty"(Quantity) I want to change the function in the field "product_uom_qty" (sale.order.line).

Thanks,

1

Atul Kumar jain

--Atul Kumar jain--
914
| 5 3 7
Indore, India
--Atul Kumar jain--

.

Atul Kumar jain
On 3/14/14, 3:06 AM

You can copy that function from the sale_order_line class and put it in your custom classs

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: 3/14/14, 1:41 AM
Seen: 691 times
Last updated: 3/16/15, 8:10 AM