0

エラーが発生します ERROR openerp.netsvc: 'sale.order' object has no attribute 'test_onchange_months'

openERP 7 で関数を追加する方法をフォローしました。、しかしそれは機能していません。

私のコード:

class test_salesOrder(osv.osv):
    _name = 'sale.order'
    _inherit = 'sale.order'

    _columns = {
        'test_years_from': fields.many2one('test.year', 'Years From'),
        'test_years_to': fields.many2one('test.year', 'Years From'),
        'test_months_from': fields.integer('Months From'),
        'test_months_to': fields.integer('Months To'),
        'test_months': fields.integer('Months'),
        'test_dummy': fields.char('TEST Dummy - CHAR', size=64, required=False),
    }

    def test_onchange_months(self, cr, uid, ids, test_months, context=None):
        test_product_uom_qty = test_months
        res = {}

        if context is None:
            context = {}

        if test_product_uom_qty: 
            for order in self.browse(cr, uid, ids, context=context):
                for line in order.order_line:
                    res[line.id] = {'product_uom_qty' : 0}
                    res[line.id]['product_uom_qty'] = test_product_uom_qty

        return res

    def test_onchange_months_from(self, cr, uid, ids, test_months_from, test_months_to, context=None):
        v = {}
        v['test_months'] = test_months_to - test_months_from
        return {'value': v}

    def test_onchange_months_to(self, cr, uid, ids, test_months_from, test_months_to, context=None):
        v = {}
        v['test_months'] = test_months_to - test_months_from
        return {'value': v}

test_salesOrder()
4

1 に答える 1