Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4925 Lượt xem

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()

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 24
21743
0
thg 9 24
1307
3
thg 8 24
2612
0
thg 2 24
1735
0
thg 2 24
1321