Skip to Content
Menu
This question has been flagged
1 Reply
3189 Views

File "/odoo/odoo-server/openerp/fields.py", line 1431, in convert_to_cache
raise ValueError("Wrong value for %s: %r" % (self, value))
ParseError: "Wrong value for ir.sequence.code: 'hospital.group'" while parsing /odoo/custom/addons/hospital/data/sequence.xml:5, near
<record id="sequence_hospital" model="ir.sequence">
<field name="name">Hospital patient code</field>
<field name="code">hospital.group</field>
<field name="prefix">PH/</field>
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>

sequence file is

<openerp>
<data noupdate="1">

<record id="sequence_hospital" model="ir.sequence">
<field name="name">Hospital patient code</field>
<field name="code">hospital.group</field>
<field name="prefix">PH/</field>
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>


</data>
</openerp>


models

name_seq = fields.Char(string="Order reference", readonly=True, copy=False, index=True, default='New')
@api.model
def create(self, values):
if values.get('name_seq', 'New') == 'New':
values['name_seq']=self.env['ir.sequence'].next_by_code('hospital.group') or 'New'
return super(HospitalPatient, self).create(values)


please help me hw to resolve this

Avatar
Discard
Best Answer

Hi,

Try this code instead of yours :

@api.model
def create(self, values):
    	if values.get('name_seq', 'New') == 'New':
    		seq_id = self.pool.get('ir.model.data').get_object_reference(self._cr,self._uid,'hospital', 'sequence_hospital')[1]

values['name_seq']=self.pool.get('ir.sequence').get_id(self._cr,self._uid , seq_id, 'id',self._context) or 'New' return super(HospitalPatient, self).create(values)

Please Vote if you find it usefull.

Avatar
Discard
Related Posts Replies Views Activity
3
Oct 19
3651
3
Nov 18
5733
4
Apr 16
4770
1
Aug 23
12549
1
Aug 23
11058