简体   繁体   English

sale.order.line数量更新

[英]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.

相关问题 如何从sale.order.line访问sale.order字段对视图Qweb进行建模 - How to access the sale.order fields from sale.order.line model a view Qweb 如何在Odoo 8的sale.order.line中的onchange_product_id方法中添加功能? - How to add a functionality to onchange_product_id method in sale.order.line in Odoo 8? 我该怎么办? ValueError:预期的单例:sale.order.line(26,27) - What I can do with this error? ValueError: Expected singleton: sale.order.line(26, 27) 如何从sale.order.line发送自定义值到stock.move in odoo - how to send custom value from sale.order.line to stock.move in odoo 启动弹出窗口以在 sale.order.line 视图中选择某种类型的产品 - Launch popup to select a certain type of product in the sale.order.line view odoo 中销售订单行中具有库存数量的产品过滤器 - Product filter with stock quantity in sale order line in odoo 如何根据 sale_order_line 中的自定义日期时间字段更新 stock_move 文档中的 date_expected 值 - How to update date_expected value in stock_move document based on custom datetime field in sale_order_line 我可以根据Odoo中的销售订单值隐藏销售订单行中的字段列吗? - Can i hide the field's column from Sale order line Based on sale order value In Odoo? 如何从sale_order_line onchange方法获取sale_order.id? 在odoo 9 - How can I get the sale_order.id from sale_order_line onchange method? In odoo 9 Saleor 是否支持十进制订单行数量? - Does Saleor support decimal order line quantity?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM