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

sale.order.line Quantity Update

By
Pat
on 10/24/13, 5:47 AM 789 views

I am trying to do a "monthly" recurring bill, that is: - test_months, is the number of months to bill - the line quantity shall be = to test_months

So, I trying to get "line quantity" updates, whenever the test_months onchange, but all order lines are removed?

My code: class test_sale_order_line(osv.osv): _name = 'sale.order.line' _inherit = 'sale.order.line'

def _test_product_uom_qty_line(self, cr, uid, ids, field_name, arg, context=None):
    res = {}

    if context is None:
        context = {}

    if not test_months:
        test_months = 1

    for line in self.browse(cr, uid, ids, context=context):
        res = { 'product_uom_qty': 0.0 }
        res['product_uom_qty'] = test_months

    return res

_columns = {
    'product_uom_qty': fields.function(_test_product_uom_qty_line, string='Quantity', digits_compute= dp.get_precision('Product UoS'), required=True, readonly=True, states={'draft': [('readonly', False)]}),
}

test_sale_order_line()

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: 10/24/13, 5:47 AM
Seen: 789 times
Last updated: 3/16/15, 8:10 AM