[英]sale.order.line Quantity Update
I am trying to do a "monthly" recurring bill, that is: - test_months, is the number of months to bill; 我试图做一个“每月”的定期账单,即:-test_months是要结算的月数; - the line quantity shall be = to test_months; -行数量应为=到test_months;
So, I trying to get "line quantity" updates, whenever the test_months onchange, but all order lines are removed? 因此,每当test_months发生变化时,我都试图获取“行数”更新,但所有订单行都被删除了吗?
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()
have you tried Recurring invoice module from OpenERP, as it is more easy to do recurring billing using it instead of making something from a scratch. 您是否尝试过使用OpenERP的循环发票模块,因为使用该模块进行循环计费比从头开始做更容易。
Cheers, Parthiv 干杯,Parthiv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.