openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #26505
[Bug 1244711] Re: Runtime Error: Error: [_.sprintf] expecting number but found string
The classes.
class school_teacher(osv.osv):
_name = "school_teacher"
_description = "school_teacher"
_inherit = 'school_person'
_columns = {
'school_teacher_register_academic': fields.one2many('school_register_academic_teacher','school_register_academic_teacher','Título'),
'school_teacher_register_permission_discount': fields.one2many('school_register_permission_discount_teacher','school_register_permission_discount_teacher','Permisos descontables'),
'school_teacher_biennium': fields.one2many('school_biennium_teacher','school_biennium_teacher','Bienio'),
'school_teacher_work': fields.one2many('school_work','school_work_teacher','Trabajo'),
}
_order = 'name asc'
school_teacher()
..........
class school_biennium_teacher(osv.osv):
_name = "school_biennium_teacher"
_description = "school_biennium_teacher"
_inherit = 'school_biennium'
_columns = {
'school_biennium_teacher':fields.many2one('school_teacher','Profesor', select=True),
}
def _check_exist_biennium(self, cr, uid, ids):
for biennium in self.browse(cr, uid, ids):
biennium_ids = self.search(cr, uid, [('school_biennium_number', '=', str(biennium.school_biennium_number)), ('school_biennium_teacher', '=', biennium.school_biennium_teacher.id), ('id', '<>', biennium.id)])
if (biennium_ids):
return False
return True
def _check_exist_date_biennium(self, cr, uid, ids):
for biennium in self.browse(cr, uid, ids):
biennium_ids = self.search(cr, uid, [('school_biennium_date_start', '=', biennium.school_biennium_date_start), ('school_biennium_teacher', '=', biennium.school_biennium_teacher.id), ('id', '<>', biennium.id)])
if (biennium_ids):
return False
return True
def _check_number_biennium(self, cr, uid, ids):
for biennium in self.browse(cr, uid, ids):
if (biennium.school_biennium_number<=15 and biennium.school_biennium_number>=1):
return True
return False
_constraints = [
(_check_exist_biennium, 'Error! ya existe este bienio para el profesor.', ['school_biennium_number']),
(_check_exist_date_biennium, 'Error! ya existe un bienio con esta fecha para el profesor.', ['school_biennium_date_start']),
(_check_number_biennium, 'Error! el numero de bienio debe ser mayor o igual a 1 y menor o igual que 15.', ['school_biennium_number']),
]
_order = 'school_biennium_date_start asc'
school_biennium_teacher()
_______________________________________________________________________________________________________________
The views
<record model="ir.ui.view" id="view_school_teacher_form">
<field name="name">school_teacher.form</field>
<field name="model">school_teacher</field>
<field name="arch" type="xml">
<form string="school_teacher.form" version="7.0">
<sheet>
<center>
<group>
<group>
<label for="school_teacher_photo"/>
<div class="teacher_image_100">
<field name="school_person_photo" widget="image" img_width="100" img_height="auto"/>
</div>
</group>
<group>
<h1>
<label for="name" class="oe_edit_only"/>
<field name="name"/>
</h1>
</group>
</group>
</center>
<notebook>
<page string="DATOS PROFESOR">
<group>
<group string="DATOS PERSONALES">
<field name="school_person_nif"/>
<field name="school_person_birth"/>
<field name="school_person_address"/>
<field name="school_person_city"/>
<field name="school_person_phone"/>
<field name="school_person_email" widget="email"/>
</group>
<group string="DATOS PROFESIONALES">
<field name="school_person_date_start" colspan="1"/>
<field name="school_teacher_register_academic" colspan="1"/>
</group>
</group>
<group>
<field name="school_teacher_biennium" colspan="1"/>
<field name="school_teacher_work" colspan="1"/>
</group>
</page>
<page string="RRHH">
<group>
<group>
<field name="school_teacher_register_permission_discount" colspan="1"/>
</group>
</group>
</page>
<separator colspan="4"/>
</notebook>
</sheet>
</form>
</field>
</record>
......................................
<record model="ir.ui.view" id="view_school_biennium_teacher_tree">
<field name="name">school_biennium_teacher.tree</field>
<field name="model">school_biennium_teacher</field>
<field name="arch" type="xml">
<tree string="school_biennium_teacher.tree" editable="bottom" version="7.0">
<field name="school_biennium_number" widget="integer"/>
<field name="school_biennium_date_start"/>
</tree>
</field>
</record>
I have similar classes and relationship with one2many fields and have the same error.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1244711
Title:
Runtime Error: Error: [_.sprintf] expecting number but found string
Status in OpenERP Addons (modules):
Incomplete
Bug description:
I CREATE A ADDON AND HAVE FIELDS, ONE OF THEY IS A ONE2MANY, WHEN Y CREATE THIS FIELD NOT HAVE A PROBLEM BUT WHEN MODIFY A FIELD ONE2MANY MY ADDON CRASH AND SHOW THIS MESSAGE : Uncaught Error: QWeb2 - template['ListView.rows']: Runtime Error: Error: QWeb2 - template['ListView.row']: Runtime Error: Error: [_.sprintf] expecting number but found string
http://192.168.0.132:8069/web/webclient/js?db=11:2446, THE ONE2MANY HAVE A FIELD NUMBER
THANKS FOR YOUR ATTENTION.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1244711/+subscriptions
References