Reputation: 560
I have been going through some source code of Python language in order to develop some OpenERP modules . I have come through a syntax of code which I dont think I am getting . Could someone please help me so that I can move onto my learning of Python language for developing OpenERP modules. Here is the code
self.write(cr, uid, ids, {'name': self.pool.get('ir.sequence').get(cr, uid, 'hr.applicant'),'state': 'approved'})
I am sure that ir.sequence is a class but I dont seem to understand the semantics of the code here. Please help me. Thanks, hopes for suggestion
Upvotes: 0
Views: 828
Reputation: 2499
ir.sequence
is where OpenERP keeps configurable sequences. These are installed by modules that need them and they have a couple of functions you can use such as defining prefixes (for example sales orders) and they can also have per company values so if you are running multi-company, you won't find sales orders for a company going up in odd increments due to orders in other companies.
So in the above code snippet, it says "get me the next number in the hr.applicant sequence". The get method on the ir.sequence
model will handle the multi-company and assign prefixes/suffixes etc.
A couple of points to note.
noupdate="1"
on the record or you will reset the counter when you update your module. You can define prefixes and suffixes I believe.Upvotes: 3