我有错误
git archive HEAD -o archive.tar
tar -f archive.tar --delete listoffiles1
tar -f archive.tar --delete listoffiles2
tar -f archive.tar --delete listoffiles..
tar -f archive.tar --delete listoffilesN
我的模特延伸sale.order:
2016-08-03 08:07:05,005 29822 ERROR odoov8 openerp.addons.base.ir.ir_ui_view: Field `shipaddr` not exist
虽然我没有添加模板以查看所有工作正常(字段未创建,但我没有错误)
from openerp.osv import osv, fields
class sale_order(osv.osv):
_inherit = 'sale.order'
_columns = {
#shipaddr = fields.Many2many('res.partner', string="Shipping address", readonly=False),
'shipaddr' : fields.many2many('res.partner', 'vips_shop_order_to_ship_rel', 'order_id', 'shipping_address_id', string="Shipping address"),
}
添加此模板后,我收到错误。我也收到了这个:
<record model="ir.ui.view" id="sale_order_shipaddr_form_view">
<field name="name">order.shipaddr</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Shipping address">
<group>
<field name="shipaddr"/>
</group>
</page>
</notebook>
</field>
</record>
为什么我的模型中没有创建字段?
__的OpenERP __。PY
2016-08-03 08:07:05,022 29822 ERROR odoov8 werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/home/skif/odoo/openerp/service/server.py", line 291, in app
return self.app(e, s)
File "/home/skif/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/home/skif/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1293, in __call__
return self.dispatch(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1267, in __call__
return self.app(environ, start_wrapped)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
return self.app(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1431, in dispatch
ir_http = request.registry['ir.http']
File "/home/skif/odoo/openerp/http.py", line 349, in registry
return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
File "/home/skif/odoo/openerp/modules/registry.py", line 339, in get
update_module)
File "/home/skif/odoo/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/skif/odoo/openerp/modules/loading.py", line 351, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/skif/odoo/openerp/modules/loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/skif/odoo/openerp/modules/loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/skif/odoo/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/skif/odoo/openerp/tools/convert.py", line 900, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/home/skif/odoo/openerp/tools/convert.py", line 986, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/home/skif/odoo/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/home/skif/odoo/openerp/tools/convert.py", line 762, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/addons/base/ir/ir_model.py", line 1065, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/addons/base/ir/ir_ui_view.py", line 255, in create
context=context)
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/home/skif/odoo/openerp/models.py", line 4094, in create
record = self.browse(self._create(old_vals))
File "/home/skif/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/home/skif/odoo/openerp/models.py", line 4285, in _create
recs._validate_fields(vals)
File "/home/skif/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/models.py", line 1271, in _validate_fields
raise ValidationError('
'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `shipaddr` not exist
Context error:
View `order.shipaddr`
[view_id: 1642, xml_id: n/a, model: sale.order, parent_id: 582]" while parsing /home/skif/odoo/my-modules/vips_shop/views/sale_order.xml:5, near
<record model="ir.ui.view" id="sale_order_shipaddr_form_view">
<field name="name">order.shipaddr</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Shipping address">
<group>
<field name="shipaddr"/>
</group>
</page>
</notebook>
</field>
</record>
模块销售使用的是osv.osv模型。 Odoo8的文档指定了model.Model for create columns。我找不到osv的doc。这个结构我用其他模块编写代码。可能是不对的。 哪里有错误?我在哪里可以阅读osv的文档?
答案 0 :(得分:0)
感谢 Rawly 的回答 在文件openerp.py中我将添加'import sale_order'。 现在这个文件包含:
import controllers
import models
import partner
import product
import sale_order
如您所见,我添加了sale_order。
一切正常