OpenERP 5.0.16, 6.0.4, 6.0.3, dan 6.1 Technical Tutorial : Membuat Sequence

Berikut panduan pemrograman untuk membuat sequence pada OpenERP 5.0.16, 6.0.3, 6.0.4 dan 6.1. Mungkin sifatnya hanya algoritma pemrograman saja, codenya silahkan disesuaikan dengan kebiasaan pemrograman masing-masing.

#1 Dapatkan id dari sequence yang ingin digunakan

Contoh menggunakan method search:

obj_sequence = self.pool.get('ir.sequence')

kriteria = [] # contohnya [('name','=','Sale Order')] untuk sequence Sale Order
sequence_id = obj_sequence.search(cr, uid, kriteria)[0]


#2 Mendapatkan sequence

Contoh OpenERP 5.0.16, 6.0.3, dan 6.0.4

sequence = obj_sequence.get_id(cr, uid, sequence_id, 'id=%s')

Contoh OpenERP 6.1

sequence = obj_sequence.next_by_id(cr, uid, sequence_id)

#3 Menuliskan sequence ke field yang dikehendaki

self.write(cr, uid, [1], {'name' : sequence})
About these ads
No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s