自动生成编码问题,求解答,谢谢!
-
好像有类似的模块,https://github.com/osbzr/gooderp_addons/blob/master/ir_sequence_autoreset/ir_sequence.py 这个应该能满足你的需求,只不过是odoo10
-
@静静 在 自动生成编码问题,求解答,谢谢! 中说:
选择或者修改成适合自己
不好意思啊,忘记了!报找不到哪个字段!错误:
Odoo Server ErrorTraceback (most recent call last):
File "D:\Works\odoo\odoo\models.py", line 1036, in _validate_fields
check(self)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 335, in _check_xml
self.postprocess_and_fields(view.model, view_doc, view.id)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 1042, in postprocess_and_fields
self.raise_view_error(message, view_id)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 503, in raise_view_error
raise ValueError(message)
ValueError: 字段auto_reset
不存在错误的上下文:
视图ir.sequence form
[view_id: 883, xml_id: 不适用, model: ir.sequence, parent_id: 55]During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Works\odoo\odoo\tools\convert.py", line 744, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "D:\Works\odoo\odoo\tools\convert.py", line 654, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "D:\Works\odoo\odoo\addons\base\ir\ir_model.py", line 1476, in _update
record = record.create(values)
File "D:\Works\enterprise\web_studio\models\studio_mixin.py", line 18, in create
res = super(StudioMixin, self).create(vals)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 398, in create
return super(View, self).create(self._compute_defaults(values))
File "D:\Works\odoo\odoo\models.py", line 3381, in create
self._fields[key].determine_inverse(record)
File "D:\Works\odoo\odoo\fields.py", line 1071, in determine_inverse
getattr(records, self.inverse)()
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 266, in _inverse_arch
view.write(data)
File "D:\Works\enterprise\web_studio\models\studio_mixin.py", line 27, in write
res = super(StudioMixin, self).write(vals)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 414, in write
return super(View, self).write(self._compute_defaults(vals))
File "D:\Works\odoo\odoo\models.py", line 3090, in write
self._write(old_vals)
File "D:\Works\odoo\odoo\models.py", line 3256, in _write
self._validate_fields(vals)
File "D:\Works\odoo\odoo\models.py", line 1040, in validate_fields
raise ValidationError("%s\n\n%s" % (("Error while validating constraint"), tools.ustr(e)))
odoo.exceptions.ValidationError: ('constraint 检查错误\n\n字段auto_reset
不存在\n\n错误的上下文:\n视图ir.sequence form
\n[view_id: 883, xml_id: 不适用, model: ir.sequence, parent_id: 55]', None)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Works\odoo\odoo\http.py", line 650, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\Works\odoo\odoo\http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "D:\Works\odoo\odoo\tools\pycompat.py", line 87, in reraise
raise value
File "D:\Works\odoo\odoo\http.py", line 692, in dispatch
result = self._call_function(**self.params)
File "D:\Works\odoo\odoo\http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\Works\odoo\odoo\service\model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "D:\Works\odoo\odoo\http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "D:\Works\odoo\odoo\http.py", line 936, in call
return self.method(*args, **kw)
File "D:\Works\odoo\odoo\http.py", line 515, in response_wrap
response = f(*args, **kw)
File "D:\Works\odoo\addons\web\controllers\main.py", line 935, in call_button
action = self._call_kw(model, method, args, {})
File "D:\Works\odoo\addons\web\controllers\main.py", line 923, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "D:\Works\odoo\odoo\api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "D:\Works\odoo\odoo\api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "", line 2, in button_immediate_install
File "D:\Works\odoo\odoo\addons\base\module\module.py", line 71, in check_and_log
return method(self, *args, **kwargs)
File "D:\Works\odoo\odoo\addons\base\module\module.py", line 448, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "D:\Works\odoo\odoo\addons\base\module\module.py", line 541, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "D:\Works\odoo\odoo\modules\registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "D:\Works\odoo\odoo\modules\loading.py", line 343, in load_modules
loaded_modules, update_module)
File "D:\Works\odoo\odoo\modules\loading.py", line 242, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "D:\Works\odoo\odoo\modules\loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "D:\Works\odoo\odoo\modules\loading.py", line 94, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "D:\Works\odoo\odoo\tools\convert.py", line 791, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "D:\Works\odoo\odoo\tools\convert.py", line 852, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "D:\Works\odoo\odoo\tools\convert.py", line 741, in parse
self.parse(rec, mode)
File "D:\Works\odoo\odoo\tools\convert.py", line 751, in parse
exc_info[2]
File "D:\Works\odoo\odoo\tools\pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "D:\Works\odoo\odoo\tools\convert.py", line 744, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "D:\Works\odoo\odoo\tools\convert.py", line 654, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "D:\Works\odoo\odoo\addons\base\ir\ir_model.py", line 1476, in _update
record = record.create(values)
File "D:\Works\enterprise\web_studio\models\studio_mixin.py", line 18, in create
res = super(StudioMixin, self).create(vals)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 398, in create
return super(View, self).create(self._compute_defaults(values))
File "D:\Works\odoo\odoo\models.py", line 3381, in create
self._fields[key].determine_inverse(record)
File "D:\Works\odoo\odoo\fields.py", line 1071, in determine_inverse
getattr(records, self.inverse)()
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 266, in _inverse_arch
view.write(data)
File "D:\Works\enterprise\web_studio\models\studio_mixin.py", line 27, in write
res = super(StudioMixin, self).write(vals)
File "D:\Works\odoo\odoo\addons\base\ir\ir_ui_view.py", line 414, in write
return super(View, self).write(self._compute_defaults(vals))
File "D:\Works\odoo\odoo\models.py", line 3090, in write
self._write(old_vals)
File "D:\Works\odoo\odoo\models.py", line 3256, in _write
self._validate_fields(vals)
File "D:\Works\odoo\odoo\models.py", line 1040, in validate_fields
raise ValidationError("%s\n\n%s" % (("Error while validating constraint"), tools.ustr(e)))
odoo.tools.convert.ParseError: "constraint 检查错误字段
auto_reset
不存在错误的上下文:
视图ir.sequence form
[view_id: 883, xml_id: 不适用, model: ir.sequence, parent_id: 55]
None" while parsing file:/d:/works/myaddons/ir_sequence_autoreset/ir_sequence.xml:5, near
ir.sequence
form