Hi,
im contiune with study, now im trying to add same fields to sale orders, in developher mode i looked for correct model and inherited :
but im resived
2015-05-13 13:58:22,815 888 WARNING pokus openerp.osv.orm.browse_record.product.product: Field '_asdict' does not exist in object 'browse_record(product.product, 1)'
2015-05-13 13:58:22,815 888 WARNING pokus openerp.osv.orm.browse_record.product.product: Field '_asdict' does not exist in object 'browse_record(product.product, 1)'
2015-05-13 13:58:22,987 888 INFO pokus werkzeug: 127.0.0.1 - - [13/May/2015 13:58:22] "POST /web/dataset/search_read HTTP/1.1" 500 -
2015-05-13 13:58:23,006 888 ERROR pokus werkzeug: Error on request:
Traceback (most recent call last):
File "werkzeug\serving.py", line 177, in run_wsgi
File "werkzeug\serving.py", line 165, in execute
File "C:\OpenERP 7.0\server\openerp\service\wsgi_server.py", line 417, in application
return application_unproxied(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\service\wsgi_server.py", line 403, in application_unproxied
result = handler(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 528, in __call__
return self.dispatch(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 487, in __call__
return self.app(environ, start_wrapped)
File "werkzeug\wsgi.py", line 579, in __call__
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 553, in dispatch
result = handler(request)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 618, in <lambda>
return lambda request: JsonRequest(request).dispatch(method)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 251, in dispatch
body = simplejson.dumps(response)
File "simplejson\__init__.py", line 354, in dumps
File "simplejson\encoder.py", line 264, in encode
File "simplejson\encoder.py", line 612, in _iterencode
File "simplejson\encoder.py", line 568, in _iterencode_dict
File "simplejson\encoder.py", line 568, in _iterencode_dict
File "simplejson\encoder.py", line 455, in _iterencode_list
File "simplejson\encoder.py", line 568, in _iterencode_dict
File "simplejson\encoder.py", line 622, in _iterencode
File "simplejson\encoder.py", line 239, in default
TypeError: browse_record(product.product, 1) is not JSON serializable
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_sale_inherit_tree" model="ir.ui.view">
<field name="name">sale.inherit.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="state" position="after">
<field name="product_id"/>
<field name="product_qty"/>
</field>
</field>
</record>
</data>
</openerp>
from openerp.osv import fields, osv
class sale_order(osv.osv):
_inherit = 'sale.order'
_columns = {
'product_qty': fields.related('order_line', 'product_uom_qty', type='integer', string='Quantity'),
'product_id': fields.related('order_line', 'product_id', type='integer', string='Product'),
}