Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
help with sequence (auto number)
I wrote the sequnce as I read in various posts, but the number does not load. Can someone help me?
in the view.xml:
<record id="seq_type_student_number" model="ir.sequence.type">
<field name="name">Student Number</field>
<field name="code">intrac.students.number</field>
</record>
<record id="seq_student_number" model="ir.sequence">
<field name="name">Student Number</field>
<field name="code">intrac.students.number</field>
<field name="prefix">%(year)s%(month)s</field>
<field name="padding">3</field>
</record>
==================================================
and in the students.py
class intrac_students(osv.osv):
_name = 'intrac.students'
_columns = {
'name': fields.many2one('res.partner', 'Student Name'),
'student_number': fields.char('Student Number'),
'student_image': fields.binary("Student Picture"),
'student_id_type': fields.selection([('gid','Govt ID'),('passport','Passport')],'Identification Type'),
'student_id_number': fields.char('ID Number', size=100),
'student_gender': fields.selection([('m','Male'),('f','Female')], 'Gender'),
'student_education_level': fields.selection([('hs','High School'),('c','College')], 'Education Level'),
'student_notes': fields.one2many('intrac.students.notes', 'student_name', 'Student Notes'),
'student_dob': fields.date('Date of Birth'),
}
_defaults = {
'student_number': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'intrac.students.number'),
}
intrac_students()
=====================================
What am I missing?
About This Community
This platform 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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 12/1/14, 3:19 PM |
Seen: 958 times |
Last updated: 3/16/15, 8:10 AM |
try to replace in .py and .xml files: intrac.students.number by intrac.students
I can't see an error in your code. Maybe the error is in the rest of your code (Part of the code not posted, if any).
Have you put the XML file that generates the sequences in 'data' section of __openerp__.py? If you have, you should be able to see your sequence from Settings >> Technical >> Sequences & Identifiers >> Sequences (also Sequence Codes). Also you might have used noupdate="1" attribute and change your Sequence (Code) afterwards. Just check from that menu and see if the Sequence and Sequence Code exist and the data is as what you have defined. Also please note that get method of sequence has been deprecated, you might want to change it to next_by_code(cr, uid, sequence_code, context=context) instead.