0

在我的模块中添加函数字段后出现此错误

OpenERP Server Error
Client Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\http.py", line 203, in dispatch
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\controllers\main.py", line 1133, in call_button
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\controllers\main.py", line 1121, in _call_kw
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\session.py", line 43, in proxy
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\session.py", line 31, in proxy_method
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\session.py", line 104, in send


Server Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\web\session.py", line 90, in send
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\netsvc.py", line 293, in dispatch_rpc
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\service\web_services.py", line 622, in dispatch
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\service\security.py", line 40, in check
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\pooler.py", line 49, in get_pool
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\pooler.py", line 33, in get_db_and_pool
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\registry.py", line 192, in get
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\registry.py", line 218, in new
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\loading.py", line 344, in load_modules
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\loading.py", line 259, in load_marked_modules
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\loading.py", line 162, in load_module_graph
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\module.py", line 405, in load_openerp_module
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\.\openerp\modules\module.py", line 133, in load_module
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\certificados\__init__.py", line 1, in <module>
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\certificados\certificados.py", line 30
def multi_a_b(self, cr, uid, ids, name, arg, context=None):
^
IndentationError: unexpected indent

这是我的 module.py 中的代码(给我错误的代码部分)

class certificados_line(osv.osv):

    _name = 'certificados.line'
    _description="Certificados No Produccion"

    def multi_a_b(self, cr, uid, ids, name, arg, context=None):
        res = {}
        for record in self.browse(cr, uid, ids,context):
            res[record.id] = record.Cantidad * record.Precio_Unitario_Declarado
        return res

    _columns = {
        'Codigo_Arancelario' : fields.integer('Codigo Arancelario'),
        'product_id' : fields.many2one('product.product', 'Material'),
        'Descripcion_Arancelaria' : fields.char('Descripcion Arancelaria', size=42, required = True, translate = True), 
        'Especificaciones_Tecnicas' : fields.char('Especificaciones Tecnicas', size=60, required = True, translate = True), 
        'Cantidad' : fields.float('Cantidad'), 'Unidad_de_Medida': fields.many2one('product.uom', 'Unidad de Medida'),
        'Precio_Unitario_Declarado' : fields.float('Precio Unitario Declarado'), 'Moneda' : fields.many2one('res.currency', 'Moneda'),
        'Valor_En_Divisas' : fields.function(multi_a_b, type='integer', string='Valor En Divisas'),
        'requisicion_id' : fields.many2one('certificados.certificados', 'Certificados de No Produccion', ondelete='cascade'),
        'Cantidad_Consumida' : fields.float('Cantidad Consumida'),    'Cantidad_Disponible' : fields.float('Cantidad Disponible'),
         }

正如我在其他模块中看到的那样,可以在我声明它的地方声明函数,所以我不知道,我的意思是,我尝试更改缩进,但其他一切似乎变得混乱,列,​​_name等...我应该怎么做才能摆脱这个错误?

4

0 回答 0