No move numbers in Stock journal

Asked by Grzegorz Grzelak (OpenGLOBE.pl) on 2009-09-30

When I create db with default settings I am able to create Sequence for Sale Journal and Purchase Journal which works, But I am not able to create sequence for Stock Journal. There are ID numbers (with asterisks) in move field in Draft status and Names after Validation. What should I do to have correct sequence numbers with prefix and suffix?

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Grzegorz Grzelak (OpenGLOBE.pl)
Solved:
2009-10-08
Last query:
2009-10-08
Last reply:
2009-10-08

Hello,

Follow the following path and apply the sequence and change the prefix or suffix.

Financial Management => Configuration => Financial Accounting => Financial Journals menu

Open the form view of journal and assign the Invoice Sequence what you want and you can change the sequence prefix or suffix from there.

Hope this will help.

Thanks.

I made quick check and it doesn't work.
But anyway I am surprised you advice me to change "Invoice Sequence". I think this field is not applicable for Stock moves.
Maybe I wrongly described my problem: I cannot set Sequence for account moves (account entries) in Stock journal. For Sales Journal and Purchase Journal I changed "Entry Sequence" and it works perfectly for account entry numbers. But field "Entry Sequence" doesn't change anything and doesn't set account moves numbers (account entries numbers). I still see product name instead of sequence number after validating account move.

When I look at Financial journals view I see that Stock journal is the only journal without Company. I don't use any multicompany functionality. I don't see where can I set Company to journal. For other journal it is set automatically. Stock journal is type of General by default. But I have checked with type Situation and it is the same. Maybe this is a problem for sequence numbers?

Hello,

In journal tree view company_id is relate field so it is related with default_debit_account and default_credit_account field. when you given those account in stock journal it will be taken company_id in tree view.

I have check stock journal by taking it in to invoice and i have changed the Entry Sequence field : prefix and suffix. It will create proper number seq in account_move object. i cann't reproduce your side problem.

So can you provide me more proper steps what you did follow to generate this problem?

I have made following steps on fresh database:
1. Create new database: All defaults with Account chart UK-minimal, profile manufacturing, Sample data.
2. Create new account on the same level as 110100 Purchased stocks, name STOCK code ST, Type Assets, Internal Type Others (like Purchased Stock).
3. Assign account STOCK to Stock location
4. In Product category ....../PC enter Stock incoming account 110100 Purchased stock
5. In Stock journal: Entry Sequence is by default Account sequence. Enter "Invoice sequence" the same as Entry sequence or any other (I tried to enter there "Account Journal" sequence, "Packing", and my own "New seq" of type Account Journal )
5. Create purchase order from any Supplier for 1 Basic PC (from ..../PC Category), Confirm, Approve.
6. validate Picking for this PC
7. And I see in in "Financial Management - Entries Encoding - Entries Encoding by move" that all account moves for stock moves are with product name in place of number (in column Number). This is if account move is in Draft Status and in Posted Status as well.

Hm I cannot attach a picture in Answers.
I am using 5.0.6 on Ubuntu 9.04. Maybe we have different effects because of something strange.

1. Create new database: All defaults with Account chart UK-minimal, profile manufacturing, Sample data.
2. Create new account on the same level as 110100 Purchased stocks, name STOCK code ST, Type Assets, Internal Type Others (like Purchased Stock).
3. Assign account STOCK to Stock location
4. In Product category ....../PC enter Stock incoming account 110100 Purchased stock
5. In Stock journal: Entry Sequence is by default Account sequence. Enter "Invoice sequence" the same as Entry sequence or any other (I tried to enter there "Account Journal" sequence, "Packing", and my own "New seq" of type Account Journal )
5. Create purchase order from any Supplier for 1 Basic PC (from ..../PC Category), Confirm, Approve.
6. validate Picking for this PC

This steps i follow but without creating invoice how the account_move_line entry is created. I think You missing something.
7. And I see in in "Financial Management - Entries Encoding - Entries Encoding by move" that all account moves for stock moves are with product name in place of number (in column Number). This is if account move is in Draft Status and in Posted Status as well.

so 7 step is happen after creating invoice.and in invoice it will take the expense journal by default so account move is generated on the bases of expense journal not the stock journal.

I have changed manually the journal from the invoice and that is stock journal and then create the invoice.so my side i have got right result in account_move entry sequence related to prefix and suffix.

Can you please tell me your side situation?

Account move for stock move is created during Picking list validation in "Incoming Products" (before creating or validating the invoice).

Let me explain more precise my procedure:
3. Assign correctly account "ST STOCK" to Stock location ("Stock Management - Configuration - Location" in field "Inventory account").
4. In Product category or Product enter account "110100 Purchased Stock" in field "Stock incoming account" (this account have to be different than one from point 3).

Then after validating Picking list the account move is created:
ST STOCK Dt 300
110100 Purchased stock Ct 300
and this account move is placed in "Stock Journal" assigned to Product Category in field "Stock Journal"

Don't mind the name of accounts. They are just examples.
You have to see this account move to get the numbering problem. Invoice has nothing to do with that. I know that when you create the invoice it is another account move placed in Sales Journal. But I am asking about account move created from Picking list. I think we are closer to understand each other. Probably till now you have no account moves in Stock journal at all. Another way to create such moves is to create Internal move Picking list from one location to another, and these location have to have different "Inventory account" assigned.

hello,

please apply the following patch:

=== modified file 'stock/stock.py'
--- stock/stock.py 2009-09-29 11:58:04 +0000
+++ stock/stock.py 2009-10-07 12:00:39 +0000
@@ -1282,12 +1282,20 @@
                                 'date': date,
                                 'partner_id': partner_id})
                     ]
- self.pool.get('account.move').create(cr, uid, {
+ account_move = self.pool.get('account.move')
+ account_move_id = account_move.create(cr, uid, {
                         'name': move.name,
                         'journal_id': journal_id,
                         'line_id': lines,
                         'ref': ref,
                     })
+ account_move_obj = account_move.browse(cr, uid, account_move_id, context)
+ move_name = False
+ if account_move_obj.journal_id.sequence_id:
+ sid = account_move_obj.journal_id.sequence_id.id
+ move_name = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id=%s', {'fiscalyear_id': account_move_obj.period_id.fiscalyear_id.id})
+ if move_name:
+ account_move.write(cr, uid, [account_move_id], {'name':move_name})
         self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
         wf_service = netsvc.LocalService("workflow")
         for id in ids:

i think this will help you.

Thanks .

I have tried to do so and no effect. But I am not familiar what patches. I have changed indicated lines in stock.py file located in /usr/lib/pyton2.5/site-packages/openerp-server/addons/stock. And I made check. Then I upgrade module stock (in Module Management) and again nothing changed. No errors and no new effect.

Hello,

I have followed all the steps which you have mentioned above.
After applying the above patch, i have got the number in a mention sequence in the stock journal.
so after creating purchase order and then validate the picking, i have got account move entry with unique number.

so i do not know whats your side problem why it will not work.
can you please check again by creating new purchase order.

It works today. Yesterday I didn't restarted the OpenERP server. That was probably the problem.
I will test it more next few days. But basic problem is solved.

When and how should I upgrade Stock module officially?

Thank you vra for the patch and patience.