簡體   English   中英

sale.order.line數量更新

[英]sale.order.line Quantity Update

我試圖做一個“每月”的定期賬單,即:-test_months是要結算的月數; -行數量應為=到test_months;

因此,每當test_months發生變化時,我都試圖獲取“行數”更新,但所有訂單行都被刪除了嗎?

我的代碼:

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

您是否嘗試過使用OpenERP的循環發票模塊,因為使用該模塊進行循環計費比從頭開始做更容易。

干杯,Parthiv

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM