识别错误 - OpenErp Python

时间:2013-04-22 15:57:04

标签: python module openerp indentation erp

在我的模块

中添加功能字段后出现此错误
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等...我该怎么做才能摆脱这个错误?

0 个答案:

没有答案