Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5024 Tampilan

Hello Guys,

I am wondering if in Odoo you can have Purchase order numbers start with different sequence numbers, depending on user whom requests the purchase order ?


e.g,


User bob will have his Purchase orders start with 7000.

whereas, user mel will have her purchase orders start with 6000.


I am not sure if this is possible at all and if it is would anyone be kind enough to let me know how to achieve this please ?

Avatar
Buang
Jawaban Terbai

Hi,

you may achieve it through code customization. In Odoo the sequence of purchase order is defined according the special object 'ir.sequence' (see the function create of 'purchase.order'). You may re-define the method next_by_code:

1. add column "user_id" (res.users) to "ir.sequence"

2. define a sequence for each user. Here you may also indicate some prefix (like 'Brown/' to get  "Brown/2121" instead of "PO2121"). In case you prefer a 1000 increment, put in sequence the 'number_next_actual' a required start number (e.g. 6000). I think, prefix is better than just 1000 increment, since no further troubles appear when there are more than 1000 orders per one user.

3. in the method next_by_code beside checking a company, check for a user: current_seq = self.search([('code', '=', sequence_code), ('company_id', '=', self.env.user.company_id.id),('user_id','=',self.env.user.id)])

Avatar
Buang
Penulis

Sorry I am new to odoo development. How would I carry out your recommended steps?

In general:

1. Create your own app which depends on 'purchase'

2. Inherit ir.sequence to add user_id field and re-define the method next_by_code

3. Create a few sequences in the interfaces related to all possible users

It is not simple if you don't have exp in Odoo. However, if you have intention to learn, use this documentation - https://www.odoo.com/documentation/8.0/ - to start with

Post Terkait Replies Tampilan Aktivitas
2
Sep 23
9315
1
Jun 21
5973
1
Jun 23
2342
2
Apr 17
5026
1
Apr 17
3322