Help

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

TypeError: product.step1() is not JSON serializable

Avatar
Uppili
0
0
3,314

I like to add some fields in the warehouse so I added the class with columns in the stock.py. But it shows error. I can not find what the error is.

The error message is

Traceback (most recent call last):
File "/home/rck/Desktop/odoo-8.0/openerp/http.py", line 539, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/rck/Desktop/odoo-8.0/openerp/http.py", line 590, in dispatch return self._json_response(result) File "/home/rck/Desktop/odoo-8.0/openerp/http.py", line 528, in _json_response body = simplejson.dumps(response) File "/usr/local/lib/python2.7/dist-packages/simplejson/__init__.py", line 366, in dumps return _default_encoder.encode(obj) File "/usr/local/lib/python2.7/dist-packages/simplejson/encoder.py", line 269, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/local/lib/python2.7/dist-packages/simplejson/encoder.py", line 348, in iterencode return _iterencode(o, 0) File "/usr/local/lib/python2.7/dist-packages/simplejson/encoder.py", line 246, in default

raise TypeError(repr(o) + " is not JSON serializable")

TypeError: product.step1() is not JSON serializable


My py code in stock.py is

class product_step1(osv.osv):
_name = "product.step1"

_columns = {

'name':fields.float('Name'),

'b':fields.float('B'),

'c':fields.float('C'),

'd':fields.float('D'),

'e':fields.float('E'),

'f':fields.float('F'),

'g':fields.float('G'),

'h':fields.float('H'),

'i':fields.float('I'),

'j':fields.float('J'),

}

my xml code in stock_view.xml is


<record model="ir.ui.view" id="step1_tree_view">

<field name="name">step1.tree</field>

<field name="model">product.step1</field>

<field name="type">tree</field>

<field name="arch" type="xml">

<tree string="Product Details">

<field name="name"/>

<field name="b"/>

<field name="c"/>

</tree> </field> </record>


<record model="ir.ui.view" id="step1_form_view">

<field name="name">step1.form</field>

<field name="model">product.step1</field>

<field name="type">form</field>

<field name="arch" type="xml">

<form string="Product Details">

<sheet>

<group>

<group>

<field name="name"/>

<field name="b"/>

<field name="c"/>

<field name="d"/>

<field name="e"/>

</group>

<group>

<field name="f"/>

<field name="g"/>

<field name="h"/>

<field name="i"/>

<field name="j"/>

</group>

</group>

</sheet>

</form> </field> </record>


<record model="ir.actions.act_window" id="action_step1_form">

<field name="name">step1</field>

<field name="res_model">product.step1</field>

</record>
<menuitem name="Product Details" parent="menu_stock_root" id="step1_menu_mainform"/>

<menuitem name="Product Description" parent="step1_menu_mainform" id="step1_menu1_mainform" action="action_step1_form"/>


When I click the Quants and stock Moves tab in warehouse this error has been shown.

Notify me where I'm doing the mistake.

Thank you.

Avatar
Uppili
Avatar
Discard
0 Answers

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Q&A Forum Regulations

Forum Regulations

By using the FAQ Forum on ERPOnline.vn website, you unconditionally agree to the following terms:

    1. Q&A Forum is a discussion environment to support each other in Odoo/ERPOnline implementation, in the spirit of "community support community", with internet address at: https://www.erponline.vn/forum/hoi-dap-7

    2. You are thoroughly responsible for the content submitted by you.

    3. DO NOT use the Q&A Forum for any activities that violate Vietnamese law and International Conventions to which Vietnam is a participant.

    4. DO NOT post content that is offensive, defamatory, or discredits other individuals or legal entities.

    5. DO NOT post advertisements or advertising content.

    6. DO NOT post content that is not related to management software and ERP in general as well as OpenERP and ERPOnline.vn in particular.

    7. DO NOT post copyrighted content or content, materials, products protected by Intellectual Property law without the written consent of the author.

    8. DO NOT embed images from other websites.

    9. You agree that all options, solutions, answers in the Q&A section on ERPOnline.vn website are for reference only. ERPOnline.vn website will not be liable if you have any damage when applying the plans given in the Q&A section on ERPOnline.vn website.

These terms and conditions may be amended to suit reality at any time without prior notice.