Skip to Content
Menu
This question has been flagged

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
Discard
Best Answer

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
Discard
Author

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

Related Posts Replies Views Activity
2
Sep 23
8064
1
Jun 21
4883
1
Jun 23
1297
2
Apr 17
4002
1
Apr 17
2722