keyError, When import data in openerp - string

File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 219, in parse_preview
fields = self.get_fields(cr, uid, record.res_model, context=context)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 116, in get_fields
cr, uid, field['relation'], context=context, depth=depth-1)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 116, in get_fields
cr, uid, field['relation'], context=context, depth=depth-1)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 103, in get_fields
'string': field['string'],
KeyError: 'string'
I am getting this error, When i import in customer form. This form inherited from res_partner.
this is csv file.
id,"name"
__export__.res_partner_10,"1"
__export__.res_partner_11,"2"
__export__.res_partner_579,"abrajeethan"
__export__.res_partner_640,"Abu"
__export__.res_partner_584,"ahmekldsgjfmkp"
__export__.res_partner_469,"Anand"
__export__.res_partner_672,"aniasdftha"
__export__.res_partner_49,"Ayantasdfika"
__export__.res_partner_481,"Aasdfyantikr"
csv format is working fine, when i import other form. But not working in customer.
xml code:
<record id="extended_view_partner_tree" model="ir.ui.view">
<field name="name">Customers</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="client_id"/>
<field name="clientadded_date"/>
<field name="branch"/>
<field name="phone"/>
<field name="email"/>
</tree>
</field>
</record>
Can you please tell how to clear this error.

I got answer. In addons/base_import folder at models.py file. in 103 line.
I have changed as
'string':fields.get('string'),
instead of
'string':fields['string']

Related

Odoo12 Error XML When upgrade module or install module

I got an error lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 13, column 9 in Odoo 12, When I upgraded each module or install new module. I cannot working. T_T
I'm not sure my code is wrong or any thing else, But i try to debug variable view_arch i found the XML start is missing.
Help me please, Thank you for advance.
file view.xml:
<record id="view_company_form_inherit_social_media" model="ir.ui.view">
<field name="name">res.company.form.inherit.social.media</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//group[#name='social_media']" position="replace">
<group string="Social Media" name="social_media">
<field name="social_twitter"/>
<field name="social_facebook"/>
<field name="social_github"/>
<field name="social_linkedin"/>
<field name="social_youtube"/>
<field name="social_googleplus"/>
<field name="social_instagram"/>
</group>
</xpath>
</field>
</record>
XML Parser when install or upgrade:
<?xml version="1.0"?>
<xpath expr="//group[#name=\'social_media\']" position="replace">
<group string="Social Media" name="social_media">
<field name="social_twitter"/>
<field name="social_facebook"/>
<field name="social_github"/>
<field name="social_linkedin"/>
<field name="social_youtube"/>
<field name="social_googleplus"/>
<field name="social_instagram"/>
</group>
</xpath>
</field>
</record>
</odoo>
This error:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1111, in _validate_fields
check(self)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 346, in _check_xml
view_arch = etree.fromstring(view.arch.encode('utf-8'))
File "src/lxml/etree.pyx", line 3213, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1764, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1126, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 600, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 710, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 639, in lxml.etree._raiseParseError
File "<string>", line 13
lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 13, column 9
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 757, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 662, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3841, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3755, in _load_records_create
return self.create(values)
File "<decorator-gen-32>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 431, in create
return super(View, self).create(vals_list)
File "<decorator-gen-3>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3572, in create
fields[0].determine_inverse(batch_recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1114, in determine_inverse
getattr(records, self.inverse)()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch
view.write(data)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 447, in write
return super(View, self).write(self._compute_defaults(vals))
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3287, in write
self._write(store_vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3433, in _write
self._validate_fields(vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1115, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.exceptions.ValidationError: ('Error while validating constraint\n\nExtra content at the end of the document, line 13, column 9', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-61>", line 2, in button_immediate_install
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 445, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 421, in load_modules
loaded_modules, update_module, models_to_check)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 801, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 864, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 763, in parse
exc_info[2]
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 757, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 662, in _tag_record
record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3841, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3755, in _load_records_create
return self.create(values)
File "<decorator-gen-32>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 431, in create
return super(View, self).create(vals_list)
File "<decorator-gen-3>", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
return create(self, arg)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3572, in create
fields[0].determine_inverse(batch_recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1114, in determine_inverse
getattr(records, self.inverse)()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch
view.write(data)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 447, in write
return super(View, self).write(self._compute_defaults(vals))
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3287, in write
self._write(store_vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3433, in _write
self._validate_fields(vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1115, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.tools.convert.ParseError: "Error while validating constraint
Extra content at the end of the document, line 13, column 9
None" while parsing /usr/lib/python3/dist-packages/odoo/addons/social_media/views/res_company_views.xml:4, near
<record id="view_company_form_inherit_social_media" model="ir.ui.view">
<field name="name">res.company.form.inherit.social.media</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//group[#name='social_media']" position="replace">
<group string="Social Media" name="social_media">
<field name="social_twitter"/>
<field name="social_facebook"/>
<field name="social_github"/>
<field name="social_linkedin"/>
<field name="social_youtube"/>
<field name="social_googleplus"/>
<field name="social_instagram"/>
</group>
</xpath>
</field>
</record>
</odoo>
Add <odoo> tag as like below
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_company_form_inherit_social_media" model="ir.ui.view">
<field name="name">res.company.form.inherit.social.media</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//group[#name='social_media']" position="replace">
<group string="Social Media" name="social_media">
<field name="social_twitter"/>
<field name="social_facebook"/>
<field name="social_github"/>
<field name="social_linkedin"/>
<field name="social_youtube"/>
<field name="social_googleplus"/>
<field name="social_instagram"/>
</group>
</xpath>
</field>
</record>
</odoo>

How to solve MultipleObjectsReturned with ForeignKeywidget in django-import-export

I have a resource that should help me import data into my model but it doesn't work. I have tried all the options I could but to no success.
This is the resource.
class ImportStudentsResource(resources.ModelResource):
klass = fields.Field(attribute = 'class',column_name='class',widget= ForeignKeyWidget(Klass,'name'))
stream = fields.Field(attribute = 'stream',column_name='stream',widget=ForeignKeyWidget(Stream,'name'))
gender = fields.Field(attribute = 'gender',column_name='gender', widget=ForeignKeyWidget(Gender, 'name'))
school = fields.Field(attribute = 'school',column_name='school', widget=ForeignKeyWidget(School, 'name'))
class Meta:
model = Students
fields = ('school','adm','name','kcpe','klass','stream','gender','notes')
import_id_fields = ('adm',)
import_order = ('school','adm','name','kcpe','klass','stream','gender','notes')
This is the data to import into the model through the resource
This is the Traceback.
Traceback (most recent call last):
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\django\views\generic\base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\django\views\generic\base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "D:\Python\Django\Links Online Exams\Links_Online_Results\students\views.py", line 52, in post
result = resource.import_data(data_set, dry_run=True, collect_failed_rows=True, raise_errors=True)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\resources.py", line 741, in import_data
return self.import_data_inner(dataset, dry_run, raise_errors, using_transactions, collect_failed_rows, **kwargs)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\resources.py", line 788, in import_data_inner
raise row_result.errors[-1].error
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\resources.py", line 658, in import_row
self.import_obj(instance, row, dry_run)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\resources.py", line 512, in import_obj
self.import_field(field, obj, data)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\resources.py", line 495, in import_field
field.save(obj, data, is_m2m)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\fields.py", line 110, in save
cleaned = self.clean(data)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\fields.py", line 66, in clean
value = self.widget.clean(value, row=data)
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\import_export\widgets.py", line 396, in clean
return self.get_queryset(value, row, *args, **kwargs).get(**{self.field: val})
File "D:\Python\Django\Links Online Exams\env\lib\site-packages\django\db\models\query.py", line 433, in get
raise self.model.MultipleObjectsReturned(
students.models.Klass.MultipleObjectsReturned: get() returned more than one Klass -- it returned 2!
Possible cause of the None values
class StudentsForm(forms.ModelForm):
class Meta:
model = Students
fields = ("school","name","adm",'klass',"stream","kcpe","gender","notes")
widgets = {
'school':forms.TextInput(attrs={"class":'form-control','value':'','id':'identifier','type':'hidden'}),
'name':forms.TextInput(attrs={"class":'form-control'}),
}
def __init__(self, school, *args, **kwargs):
super(StudentsForm, self).__init__(*args, **kwargs)
self.fields['klass'] = forms.ModelChoiceField(
queryset=Klass.objects.filter(school=school),label='Class')
self.fields['stream'].queryset = Stream.objects.none()
if 'klass' in self.data:
try:
klass = int(self.data.get('klass'))
self.fields['stream'].queryset = Stream.objects.filter(klass_id=klass).order_by('name')
except (ValueError, TypeError):
pass # invalid input from the client; ignore and fallback to empty City queryset
elif self.instance.pk:
self.fields['stream'].queryset = self.instance.klass.stream_set.order_by('name')
You are violating the ForeignKey constraint with class (klass) (and also stream) row
Jaq / class 2
Lucy / class 2
# only 1 can have 2 as its a ForeignKey
# same error will happen in stream row 4 Eagle 2 Hawk
You should insted of Foreignkey use a ManyToMany field
documentation: https://docs.djangoproject.com/en/3.2/ref/models/fields/#manytomanyfield

sqlite3.IntegrityError: NOT NULL constraint failed: store_comment.post_id(Implementing Comment functionality.)

I am getting sqlite3.IntegrityError: NOT NULL constraint failed: store_comment.post_id.Please find the below error details.
Django version 3.0.2, using settings 'ShaileshShop.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Checking comment post is happening or not:YES
Product in comment post: Black Skater Dress
Check Check Check
Internal Server Error: /details/3
Traceback (most recent call last):
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: NOT NULL constraint failed: store_comment.post_id
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/Users/shaileshyadaav/djangoshaileshdurga/ShaileshEcomm/store/views.py", line 295, in post
new_comment.save()
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/base.py", line 746, in save
force_update=force_update, update_fields=update_fields)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/base.py", line 784, in save_base
force_update, using, update_fields,
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/base.py", line 887, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/base.py", line 926, in _do_insert
using=using, raw=raw,
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1204, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1384, in execute_sql
cursor.execute(sql, params)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: store_comment.post_id
[02/Nov/2020 14:42:46] "POST /details/3 HTTP/1.1" 500 155444
/Users/shaileshyadaav/djangoshaileshdurga/ShaileshEcomm/store/models/comment.py changed, reloading.
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/shaileshyadaav/PycharmProjects/first/venv/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/shaileshyadaav/djangoshaileshdurga/ShaileshEcomm/store/models/__init__.py", line 7, in <module>
from .comment import Comment
File "/Users/shaileshyadaav/djangoshaileshdurga/ShaileshEcomm/store/models/comment.py", line 14
post=models.ForeignKey(Product,related_name='comment',on_delete=models.CASCADE,null)
so to resolve this error I have used null=True in my models.py file as shown below.
After which I am not getting any error however data is not getting saved and it's redirecting to the same page(http://127.0.0.1:8000/details/10) with the form filling data.(Please check the attached image).
from django.db import models
# need to import Category model
from .product import Product
class Comment(models.Model):
post=models.ForeignKey(Product,related_name='comment',on_delete=models.CASCADE,null=True)
name=models.CharField(max_length=32)
email=models.EmailField()
body=models.TextField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)
#now order we can define.
class Meta:
ordering=('-created',)
#now let me take str if any person wants to display comment object.
def __str__(self):
return 'Commented by {} on {}'.format(self.name,self.post)
views.py
from store.forms import CommentForm
class Details(View):
def get(self,request,myid):
product = Product.objects.get(id=myid)
print('Checking product value in details:',product)
comments= product.comment.filter(active=True)
form = CommentForm()
return render(request, 'details.html', {'product':product,'form':form,'comments':comments})
def post(self,request,myid):
print('Checking comment post is happening or not:YES')
product = Product.objects.get(id=myid)
print('Product in comment post:',product) # here i am getting product
form = CommentForm(request.POST)
if form.is_valid():
# print('Checking Form valid:',form )
print('Check Check Check')
new_comment = form.save(commit = False)
new_comment.product = product ##trying to associated post for which user commented
# print('Pk:',new_comment)
new_comment.save()
return render(request, 'details.html', {'product':product, 'form':form , })
details.html
<!--#######adding comment section below to post######-->
{% with comments.count as comment_count %}
<h2>{{comments_count}} Comment{{comments_count|pluralize}}</h2>
{%endwith%}
<!--#now lets display comments:)-->
{%if comments%}
{%for comment in comments%}
<p id='ch'> comment {{forloop.counter}} by {{comment.name}} on {{comment.created}}</p>
<div class="commentbody">{{comment.body|linebreaks}}</div>
<hr>
{%endfor%}
{%else%}
<p>There is no Comment Yet!!You are the first to comment on this..</p>
{%endif%}
<!--###Now if cooment is Submitted then we need to display form to end user.-->
{%if csubmit%}
<p>Hey!,Your comment has submitted successfully.To submit another comment please refresh
browser! </p>
{%else%}
<!-- <p id="submit1">Please submit your comment.</p>-->
<form method="post">
{{form.as_p}}
{%csrf_token%}
<input type="submit" name="" class='btn btn-lg
btn-success' value="Submit Your Comment">
</form>
{%endif%}
i think you can't put null value inside post=models.ForeignKey(Product,related_name='comment',on_delete=models.CASCADE,null=True)
try to remove null=True and add a default=Product.objects.all().first() value to the field or blank=True.

odoo error field not found 'architect_ids'

This is the error and I've already reset the server, compiler and remove all .pyc files and there is no typo error. architect_ids is present in the module and also imported in init.py. Still, the error is that it won't recognize or it cannot read the field "architect_ids". depends are already in place. I don't know how to resolve this.
Error:
Odoo Server Error
Traceback (most recent call last):
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 392, in _check_xml
self.postprocess_and_fields(view.model, view_doc, view.id)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 952, in postprocess_and_fields
fields_def = self.postprocess(model, node, view_id, False, fields)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 882, in postprocess
fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 882, in postprocess
fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 882, in postprocess
fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
[Previous line repeated 1 more time]
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 803, in postprocess
xarch, xfields = self.with_context(
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 964, in postprocess_and_fields
self.raise_view_error(message, view_id)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 592, in raise_view_error
raise ValueError(message)
ValueError: Field `architect_ids` does not exist
Error context:
View `architect.page.view`
[view_id: 849, xml_id: n/a, model: sale.order, parent_id: 756]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 712, in parse
self._tag_root(de)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 674, in _tag_root
f(rec)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 577, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "D:\dev\odoo-13.0\odoo\models.py", line 4067, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "D:\dev\odoo-13.0\odoo\models.py", line 3981, in _load_records_create
return self.create(values)
File "<decorator-gen-32>", line 2, in create
File "D:\dev\odoo-13.0\odoo\api.py", line 336, in _model_create_multi
return create(self, arg)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 473, in create
return super(View, self).create(vals_list)
File "<decorator-gen-3>", line 2, in create
File "D:\dev\odoo-13.0\odoo\api.py", line 336, in _model_create_multi
return create(self, arg)
File "D:\dev\odoo-13.0\odoo\models.py", line 3762, in create
fields[0].determine_inverse(batch_recs)
File "D:\dev\odoo-13.0\odoo\fields.py", line 1114, in determine_inverse
getattr(records, self.inverse)()
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 299, in _inverse_arch
view.write(data)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 490, in write
return super(View, self).write(self._compute_defaults(vals))
File "D:\dev\odoo-13.0\odoo\models.py", line 3551, in write
real_recs._validate_fields(set(vals) - set(inverse_fields))
File "D:\dev\odoo-13.0\odoo\models.py", line 1167, in _validate_fields
check(self)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 394, in _check_xml
raise ValidationError("%s\n\n%s" % (_("Error while validating view"), tools.ustr(e)))
odoo.exceptions.ValidationError: ('Error while validating view\n\nField `architect_ids` does not exist\n\nError context:\nView `architect.page.view`\n[view_id: 849, xml_id: n/a, model: sale.order, parent_id: 756]', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\dev\odoo-13.0\odoo\http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\dev\odoo-13.0\odoo\http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "D:\dev\odoo-13.0\odoo\tools\pycompat.py", line 14, in reraise
raise value
File "D:\dev\odoo-13.0\odoo\http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "D:\dev\odoo-13.0\odoo\http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\dev\odoo-13.0\odoo\service\model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "D:\dev\odoo-13.0\odoo\http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "D:\dev\odoo-13.0\odoo\http.py", line 910, in __call__
return self.method(*args, **kw)
File "D:\dev\odoo-13.0\odoo\http.py", line 510, in response_wrap
response = f(*args, **kw)
File "d:\dev\odoo-13.0\addons\web\controllers\main.py", line 1324, in call_button
action = self._call_kw(model, method, args, kwargs)
File "d:\dev\odoo-13.0\addons\web\controllers\main.py", line 1312, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "D:\dev\odoo-13.0\odoo\api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "D:\dev\odoo-13.0\odoo\api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-59>", line 2, in button_immediate_install
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_module.py", line 463, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "D:\dev\odoo-13.0\odoo\modules\registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "D:\dev\odoo-13.0\odoo\modules\loading.py", line 421, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "D:\dev\odoo-13.0\odoo\modules\loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "D:\dev\odoo-13.0\odoo\modules\loading.py", line 225, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "D:\dev\odoo-13.0\odoo\modules\loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 736, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 803, in convert_xml_import
obj.parse(doc.getroot())
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 715, in parse
pycompat.reraise(
File "D:\dev\odoo-13.0\odoo\tools\pycompat.py", line 13, in reraise
raise value.with_traceback(tb)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 712, in parse
self._tag_root(de)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 674, in _tag_root
f(rec)
File "D:\dev\odoo-13.0\odoo\tools\convert.py", line 577, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "D:\dev\odoo-13.0\odoo\models.py", line 4067, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "D:\dev\odoo-13.0\odoo\models.py", line 3981, in _load_records_create
return self.create(values)
File "<decorator-gen-32>", line 2, in create
File "D:\dev\odoo-13.0\odoo\api.py", line 336, in _model_create_multi
return create(self, arg)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 473, in create
return super(View, self).create(vals_list)
File "<decorator-gen-3>", line 2, in create
File "D:\dev\odoo-13.0\odoo\api.py", line 336, in _model_create_multi
return create(self, arg)
File "D:\dev\odoo-13.0\odoo\models.py", line 3762, in create
fields[0].determine_inverse(batch_recs)
File "D:\dev\odoo-13.0\odoo\fields.py", line 1114, in determine_inverse
getattr(records, self.inverse)()
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 299, in _inverse_arch
view.write(data)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 490, in write
return super(View, self).write(self._compute_defaults(vals))
File "D:\dev\odoo-13.0\odoo\models.py", line 3551, in write
real_recs._validate_fields(set(vals) - set(inverse_fields))
File "D:\dev\odoo-13.0\odoo\models.py", line 1167, in _validate_fields
check(self)
File "D:\dev\odoo-13.0\odoo\addons\base\models\ir_ui_view.py", line 394, in _check_xml
raise ValidationError("%s\n\n%s" % (_("Error while validating view"), tools.ustr(e)))
odoo.tools.convert.ParseError: "Error while validating view
Field `architect_ids` does not exist
Error context:
View `architect.page.view`
[view_id: 849, xml_id: n/a, model: sale.order, parent_id: 756]
None" while parsing file:/d:/dev/odoo-13.0/custom/architect_page/views/architect_page.xml:1, near
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">architect.page.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//page[#name='order_lines']" position="after">
<page string="Architect and Interior Designer">
<field name="architect_ids">
<tree string="Architect and Interior Designer" editable="bottom">
<control>
<create name="add_architect_control" string="Add a architect"/>
</control>
<field name="architect_ids"/>
<field name="architect_commission"/>
<field name="architect_com_type"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>
These are my models:
architectpage.py
from odoo import models, fields
class ArchitectPage(models.Model):
_inherit = 'sale.order'
architect_ids = fields.One2many(string='Architect',
comodel_name='res.architect', inverse_name='sale_id')
res_architect.py
from odoo import models, fields, api, exceptions
class ResArchitect(models.Model):
_name = 'res.architect'
name = fields.Char('name')
architect_com_type = fields.Selection(string='Commission type',
selection=[('percentage', 'Percentage'), ('float', 'Float')])
architect_commission = fields.Float(string='Architect Commission')
sale_id = fields.Many2one(string='sale', comodel_name='sale.order')
# put your constraint here
#api.constrains('architect_com_type', 'architect_commission')
def _validate_commission(self):
for field in self:
if field.architect_com_type == 'Percentage':
if (field.architect_com_type > 100) or (field.architect_com_type <= 0):
raise exceptions.ValidationError(
"Percentage fields must be less than equal to 100 or greater than 0")
xml:
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">architect.page.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//page[#name='order_lines']" position="after">
<page string="Architect and Interior Designer">
<field name='architect_ids'>
<tree string="Architect and Interior Designer"
editable="bottom">
<control>
<create name="add_architect_control" string="Add a architect"/>
</control>
<field name="architect_ids"/>
<field name="architect_commission"/>
<field name="architect_com_type"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>
other custom modules:
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class architect(models.Model):
_name = 'architect.form'
_description = 'architect'
prefix_id = fields.Selection(
[('company', 'COMPANY'), ('architect', 'ARCH'), ('interior designer', 'ID'), ('others', 'OTHERS')],
required=True)
first_name = fields.Char(string="First Name", required=True)
last_name = fields.Char(string="Last Name", required=True)
address = fields.Char(string="Address", required=True)
email = fields.Char(string="Email")
mobile_no = fields.Char(string="Mobile No.")
tel_no = fields.Char(string="Telephone No.")
Remove
architect_ids
from tree view
<field name='architect_ids'>
<tree string="Architect and Interior Designer"
editable="bottom">
<control>
<create name="add_architect_control" string="Add a architect"/>
</control>
<!-- Removing architect_ids from view -->
<!-- <field name="architect_ids"/> -->
<field name="architect_commission"/>
<field name="architect_com_type"/>
</tree>
</field>
On your model['sale.order'] view there is architect_ids field [One2many] defined.
On your XML file, you have added that One2many field from there you have add the unwanted field architect_ids which is not on that model you are accessing ['res.architect'].
Check here,
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">architect.page.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="XML">
<xpath expr="//page[#name='order_lines']" position="after">
<page string="Architect and Interior Designer">
<field name='architect_ids'>
<tree string="Architect and Interior Designer"
editable="bottom">
<control>
<create name="add_architect_control" string="Add a architect"/>
</control>
<field name="architect_commission"/>
<field name="architect_com_type"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>
Thanks

odoo8+pgpool2 ParseError: "Incorrect padding

i try to connect my odoo8 to my pgpool.
I write into the odoo-server.conf corrects paramters to connect with my pgpool and it work fine..
but, when I create a new database trought odoo, it begins to create tables, index, .. but give me next error:
Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-server/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-server/openerp/http.py", line 311, in _call_function
return self.endpoint(*args, **kwargs)
File "/opt/odoo/odoo-server/openerp/http.py", line 803, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 403, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 705, in create
request.session.authenticate(params['db_name'], 'admin', params['create_admin_pwd'])
File "/opt/odoo/odoo-server/openerp/http.py", line 956, in authenticate
uid = dispatch_rpc('common', 'authenticate', [db, login, password, env])
File "/opt/odoo/odoo-server/openerp/http.py", line 115, in dispatch_rpc
result = dispatch(method, params)
File "/opt/odoo/odoo-server/openerp/service/common.py", line 26, in dispatch
return fn(*params)
File "/opt/odoo/odoo-server/openerp/service/common.py", line 37, in exp_authenticate
res_users = openerp.registry(db)['res.users']
File "/opt/odoo/odoo-server/openerp/__init__.py", line 68, in registry
return modules.registry.RegistryManager.get(database_name)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 339, in get
update_module)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 297, in load_modules
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 900, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 986, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/odoo-server/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/opt/odoo/odoo-server/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 "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 1064, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 863, in create
return super(users_view, self).create(cr, uid, values, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 661, in create
user_id = super(users_implied, self).create(cr, uid, values, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_users.py", line 332, in create
user_id = super(res_users, self).create(cr, uid, vals, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4093, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4151, in _create
self.pool[table].write(cr, user, [record_id], tocreate[table], context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 564, in write
result = super(res_partner, self).write(vals)
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 3788, in write
self._write(old_vals)
File "/opt/odoo/odoo-server/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 592, in new_api
result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4036, in _write
cr, user, todo, fields_to_recompute, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/models.py", line 4409, in _store_set_values
result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context)
File "/opt/odoo/odoo-server/openerp/osv/fields.py", line 1460, in get
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 191, in _get_image
return dict((p.id, tools.image_get_resized_images(p.image)) for p in self)
File "/opt/odoo/odoo-server/openerp/addons/base/res/res_partner.py", line 191, in <genexpr>
return dict((p.id, tools.image_get_resized_images(p.image)) for p in self)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 223, in image_get_resized_images
return_dict[medium_name] = image_resize_image_medium(base64_source, avoid_if_small=avoid_resize_medium)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 161, in image_resize_image_medium
return image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)
File "/opt/odoo/odoo-server/openerp/tools/image.py", line 70, in image_resize_image
image_stream = StringIO.StringIO(base64_source.decode(encoding))
File "/usr/lib/python2.7/encodings/base64_codec.py", line 42, in base64_decode
output = base64.decodestring(input)
File "/usr/lib/python2.7/base64.py", line 321, in decodestring
return binascii.a2b_base64(s)
ParseError: "Incorrect padding" while parsing /opt/odoo/odoo-server/openerp/addons/base/base_data.xml:128, near
<record id="public_user" model="res.users">
<field name="name">Public user</field>
<field name="login">public</field>
<field name="password"/>
<!-- Avoid auto-including this demo user in any default group -->
<field name="groups_id" eval="[(6,0,[ref('base.group_public')])]"/>
<field name="image" type="base64" file="base/static/img/public_user-image.png"/>
<field name="partner_id" ref="public_partner"/>
<field name="active" eval="False"/>
</record>
it creates some tables, index..., so it isn't a permissions error...
In odoo9 i have not this error and work fine ( but i need odoo8 version..)
thanks

Resources