Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

TypeError: an integer is required

By
Diogenes Ojeda
on 2/16/15, 4:36 PM 1,415 views

Hello everyone:

I scheduled the next small module Odoo, the files are:

Init conatain:

Import margenes

openerp, contain:

{
    'name': 'Screen Printing',
    'version': '1.0',
    'description': """
    This module adds functionality for
         screen printing companies
    """,
    'author': 'Diogenes Ojeda',
    'depends': ['base','sale'],
    'data': ['vista_margenes.xml'],
    'demo': [],
    'installable': True,
    'auto_install': False,
}

margenes, conatain:

from openerp import models,fields,api


class silkworm_sale_order(models.Model):
    _inherit = 'sale.order'

    _columns = {
        'x_daterequired': fields.date('Date Required'),
        'x_rush': fields.boolean('Rush Order'),
        }

vista_margenes.xml, contain:

<?xml version="1.0" encoding="utf-8"?>

<openerp>
    <data>
       <record id="sale_view_order_form" model="ir.ui.view">
         <field name="model">sale.order</field>
         <field name="inherit_id" ref="sale.view_order_form"/>
         <field name="arch" type="xml">
           <field name="client_order_ref" position="after">
             <field name="x_daterequired"/>
             <field name="x_rush"/>
           </field>
       </record>
    </data>
</openerp>

 

When I try to install the module, shows me the error below, how could I fix it? Thank You

 

 

 

 

Traceback (most recent call last): File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 525, in _handle_exception File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 562, in dispatch File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 302, in _call_function File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\service\model.py", line 113, in wrapper File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 299, in checked_call File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 791, in __call__ File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\http.py", line 395, in response_wrap File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\web\controllers\main.py", line 953, in call_button File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\web\controllers\main.py", line 941, in _call_kw File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\api.py", line 237, in wrapper File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\base\module\module.py", line 450, in button_immediate_install File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\api.py", line 237, in wrapper File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\base\module\module.py", line 498, in _button_immediate_function File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\registry.py", line 346, in new File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\loading.py", line 363, in load_modules File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\loading.py", line 263, in load_marked_modules File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\loading.py", line 149, in load_module_graph File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\module.py", line 312, in load_openerp_module File "C:\Program Files\Odoo 8.0-20150114\server\.\openerp\modules\module.py", line 77, in load_module File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\margen_producto\__init__.py", line 1, in <module> File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\margen_producto\margenes.py", line 4, in <module> File "C:\Program Files\Odoo 8.0-20150114\server\openerp\addons\margen_producto\margenes.py", line 8, in silkworm_sale_order TypeError: an integer is required

 

 

1

Felipe

--Felipe--
962
| 5 3 8
Bogotá, Colombia
--Felipe--
Informatics engineer Industrial engineer
Felipe
On 2/16/15, 6:23 PM

You are combining the new API and the old one(osv) in the same Class, thats wrong.

class silkworm_sale_order(models.Model): (NEW API)
class silkworm_sale_order(osv.osv): (OLD API)
from openerp.osv import fields, osv (OLD API)
from openerp import models, fields, api (NEW API)

example of fields definition in the (NEW API):
x_daterequired=fields.Date(string='Date Required')

example of the fields definition in the (OLD API):
_columns = {
        'x_daterequired': fields.date('Date Required'),
        }

for more information you can check the official documentation:
https://www.odoo.com/documentation/8.0/reference/orm.html
 

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!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/16/15, 4:36 PM
Seen: 1415 times
Last updated: 3/16/15, 8:10 AM