Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5047 Widoki

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 ?

Awatar
Odrzuć
Najlepsza odpowiedź

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)])

Awatar
Odrzuć
Autor

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

Powiązane posty Odpowiedzi Widoki Czynność
2
wrz 23
9332
1
cze 21
6022
1
cze 23
2355
2
kwi 17
5039
1
kwi 17
3328