iam use odoo 11 and python 3.5
my py
class LicenseVehicle(models.Model):
_inherit = 'ir.attachment'
_description = 'License Vehicle'
attach_doc_name = fields.Selection([('BPKB','BPKB'),('STNK','STNK'),('KIR/Kartu Uji Berkala Kendaraan Bermotor – Uji Emisi','KIR/Kartu Uji Berkala Kendaraan Bermotor – Uji Emisi'),
('Bukti Pajak Kendaraan','Bukti Pajak Kendaraan'),('KIU/SIPA/KKPKB/Kartu Pengawasan Kendaraan','KIU/SIPA/KKPKB/Kartu Pengawasan Kendaraan'),
('IBM (Izin Bongkar Muat)','IBM (Izin Bongkar Muat)'),('STCK (Surat Tanda Coba Kendaraan)','STCK (Surat Tanda Coba Kendaraan)'),
('TNKB (Tanda Nomor Kendaraan Bermotor)','TNKB (Tanda Nomor Kendaraan Bermotor)')])
doc_number = fields.Char(string='Document Number')
start_date = fields.Date(string='Start Date')
end_date = fields.Date(string='End Date')
description = fields.Text(string='Description')
my xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model='ir.ui.view' id='ext_fleet_vehicle_log_services_view_attach'>
<field name="name">ext.fleet.vehicle.log.services_view_attach</field>
<field name="model">fleet.vehicle.log.services</field>
<field name="inherit_id" ref="fleet_operations.fleet_vehicle_log_services_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='wrk_attach_ids']/tree/field[@name='datas']" position="after">
<field name="description"/>
<field name="doc_number"/>
<field name="attach_doc_name"/>
<field name="start_date"/>
<field name="end_date"/>
</xpath>
<xpath expr="//field[@name='wrk_attach_ids']/form/group/field[@name='datas']" position="after">
<field name="description" string="Description"/>
<field name="doc_number"/>
<field name="attach_doc_name"/>
<field name="start_date"/>
<field name="end_date"/>
</xpath>
</field>
</record>
</odoo>
my error
2019-04-01 03:40:15,925 13300 INFO KMDI-DEV odoo.addons.base.ir.ir_http: Generating routing map
2019-04-01 03:40:16,678 13300 ERROR KMDI-DEV odoo.sql_db: bad query: b'SELECT "ir_attachment"."id" as "id","ir_attachment"."url" as "url","ir_attachment"."file_size" as "file_size","ir_attachment"."description" as "description","ir_attachment"."write_uid" as "write_uid","ir_attachment"."start_date" as "start_date","ir_attachment"."access_token" as "access_token","ir_attachment"."create_uid" as "create_uid","ir_attachment"."type" as "type","ir_attachment"."datas_fname" as "datas_fname","ir_attachment"."doc_number" as "doc_number","ir_attachment"."end_date" as "end_date","ir_attachment"."store_fname" as "store_fname","ir_attachment"."company_id" as "company_id","ir_attachment"."res_name" as "res_name","ir_attachment"."name" as "name","ir_attachment"."res_id" as "res_id","ir_attachment"."checksum" as "checksum","ir_attachment"."attachment_id" as "attachment_id","ir_attachment"."res_model" as "res_model","ir_attachment"."create_date" as "create_date","ir_attachment"."write_date" as "write_date","ir_attachment"."mimetype" as "mimetype","ir_attachment"."attach_doc_name" as "attach_doc_name","ir_attachment"."attachment_id_2" as "attachment_id_2","ir_attachment"."res_field" as "res_field","ir_attachment"."public" as "public","ir_attachment"."wo_attachment_id" as "wo_attachment_id" FROM "ir_attachment" WHERE "ir_attachment".id IN (8248, 257, 259, 270, 3858, 3367, 6190, 3763, 6078, 1087, 318, 5569, 6083, 6084, 6085, 6086, 6087, 329, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 3795, 3796, 3797, 3802, 3806, 236, 237, 238)'
ERROR: column ir_attachment.start_date does not exist
LINE 1: ...ption","ir_attachment"."write_uid" as "write_uid","ir_attach...
^
2019-04-01 03:40:17,046 13300 INFO KMDI-DEV werkzeug: 127.0.0.1 - - [01/Apr/2019 03:40:17] "GET /web HTTP/1.1" 500 -
2019-04-01 03:40:17,214 13300 ERROR KMDI-DEV werkzeug: Error on request:
Traceback (most recent call last):
File "C:\Users\ghiya\AppData\Local\Programs\Python\Python35\lib\site-packages\werkzeug\serving.py", line 205, in run_wsgi
execute(self.server.app)
File "C:\Users\ghiya\AppData\Local\Programs\Python\Python35\lib\site-packages\werkzeug\serving.py", line 193, in execute
application_iter = app(environ, start_response)
File "E:\odoo\odoo\service\server.py", line 260, in app
return self.app(e, s)
File "E:\odoo\odoo\service\wsgi_server.py", line 166, in application
return application_unproxied(environ, start_response)
File "E:\odoo\odoo\service\wsgi_server.py", line 154, in application_unproxied
result = handler(environ, start_response)
File "E:\odoo\odoo\http.py", line 1319, in __call__
return self.dispatch(environ, start_response)
File "E:\odoo\odoo\http.py", line 1293, in __call__
return self.app(environ, start_wrapped)
File "C:\Users\ghiya\AppData\Local\Programs\Python\Python35\lib\site-packages\werkzeug\wsgi.py", line 599, in __call__
return self.app(environ, start_response)
File "E:\odoo\odoo\http.py", line 1491, in dispatch
result = ir_http._dispatch()
File "e:\odoo\addons\auth_signup\models\ir_http.py", line 19, in _dispatch
return super(Http, cls)._dispatch()
File "e:\odoo\addons\web_editor\models\ir_http.py", line 22, in _dispatch
return super(IrHttp, cls)._dispatch()
File "e:\odoo\addons\http_routing\models\ir_http.py", line 393, in _dispatch
result = super(IrHttp, cls)._dispatch()
File "e:\odoo\addons\utm\models\ir_http.py", line 26, in _dispatch
response = super(IrHttp, cls)._dispatch()
File "e:\odoo\odoo\addons\base\ir\ir_http.py", line 212, in _dispatch
return cls._handle_exception(e)
File "e:\odoo\addons\website\models\ir_http.py", line 169, in _handle_exception
return super(Http, cls)._handle_exception(exception)
File "e:\odoo\addons\utm\models\ir_http.py", line 31, in _handle_exception
response = super(IrHttp, cls)._handle_exception(exc)
File "e:\odoo\odoo\addons\base\ir\ir_http.py", line 182, in _handle_exception
return request._handle_exception(exception)
File "E:\odoo\odoo\http.py", line 771, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "E:\odoo\odoo\http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "E:\odoo\odoo\tools\pycompat.py", line 87, in reraise
raise value
File "e:\odoo\odoo\addons\base\ir\ir_http.py", line 208, in _dispatch
result = request.dispatch()
File "E:\odoo\odoo\http.py", line 830, in dispatch
r = self._call_function(**self.params)
File "E:\odoo\odoo\http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "E:\odoo\odoo\service\model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "E:\odoo\odoo\http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "E:\odoo\odoo\http.py", line 937, in __call__
return self.method(*args, **kw)
File "E:\odoo\odoo\http.py", line 515, in response_wrap
response = f(*args, **kw)
File "e:\odoo\addons\web\controllers\main.py", line 453, in web_client
context = request.env['ir.http'].webclient_rendering_context()
File "e:\odoo\addons\web\models\ir_http.py", line 17, in webclient_rendering_context
'menu_data': request.env['ir.ui.menu'].load_menus(request.debug),
File "<decorator-gen-24>", line 2, in load_menus
File "E:\odoo\odoo\tools\cache.py", line 89, in lookup
value = d[key] = self.method(*args, **kwargs)
File "e:\odoo\odoo\addons\base\ir\ir_ui_menu.py", line 232, in load_menus
menu_roots_data = menu_roots.read(fields) if menu_roots else []
File "E:\odoo\odoo\models.py", line 2591, in read
self._read_from_database(stored, inherited)
File "E:\odoo\odoo\models.py", line 2752, in _read_from_database
field.read(fetched)
File "E:\odoo\odoo\fields.py", line 1688, in read
for att in records.env['ir.attachment'].sudo().search(domain)}
File "E:\odoo\odoo\fields.py", line 1688, in <dictcomp>
for att in records.env['ir.attachment'].sudo().search(domain)}
File "E:\odoo\odoo\fields.py", line 944, in __get__
self.determine_value(record)
File "E:\odoo\odoo\fields.py", line 1055, in determine_value
self.compute_value(recs)
File "E:\odoo\odoo\fields.py", line 1011, in compute_value
self._compute_value(records)
File "E:\odoo\odoo\fields.py", line 1002, in _compute_value
getattr(records, self.compute)()
File "e:\odoo\odoo\addons\base\ir\ir_attachment.py", line 189, in _compute_datas
if attach.store_fname:
File "E:\odoo\odoo\fields.py", line 944, in __get__
self.determine_value(record)
File "E:\odoo\odoo\fields.py", line 1045, in determine_value
record._prefetch_field(self)
File "E:\odoo\odoo\models.py", line 2653, in _prefetch_field
result = records.read([f.name for f in fs], load='_classic_write')
File "e:\odoo\odoo\addons\base\ir\ir_attachment.py", line 427, in read
return super(IrAttachment, self).read(fields, load=load)
File "E:\odoo\odoo\models.py", line 2591, in read
self._read_from_database(stored, inherited)
File "E:\odoo\odoo\models.py", line 2718, in _read_from_database
cr.execute(query_str, params)
File "E:\odoo\odoo\sql_db.py", line 155, in wrapper
return f(self, *args, **kwargs)
File "E:\odoo\odoo\sql_db.py", line 232, in execute
res = self._obj.execute(query, params)
psycopg2.ProgrammingError: column ir_attachment.start_date does not exist
LINE 1: ...ption","ir_attachment"."write_uid" as "write_uid","ir_attach...
^
can anyone help ?
or ir.attachment cant inherit or something wrong with my code ?