Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

[SOLVED] Point of sale and invoices

By
Ludovic CHEVALIER
on 6/5/15, 6:18 AM 1,853 views

Hi!

I have a problem with point of sale and invoices for few months now.

I really nead advices about this question.

My first problem is about invoicing pos orders.

 From point of sale, when I validate a pos order, an account entrie will be created at pos closing. If my customer want an invoice for his/her purchase, OpenERP permit to create invoice from the pos order. But, that generate a second account entrie. So, my accounting is false. :-(

I already have discussion about this with OpenERP employees, but I never had a answer that solved this problem.

My second problem, which is the consequence of the first.

I disable the invoice button of the point of sale module due to the first problem. So, my customers never have invoices for their purchases.

Then, I thank there was no matter having same sale journal for sales from point of sale orders and sales from invoices. Indeed, when we close a point of sale session, an account with a number wich come from journal sequence is created.

If  the point of sale use the same journal as invoices, we make holes in the invoices numbering.

So, I created a new sale journal, just for the point of sale, with its own sequence.

Problem: when I create an invoice, this point of sale journal was selected by default. So, I created a default value with condition, like its describe in this thread: https://www.odoo.com/fr_FR/forum/help-1/question/how-to-change-default-journal-when-i-create-a-new-customer-invoice-74128

It works, but, when I create an invoice from a sale order (not point of sale order, just sale order), that doesn't work.

Maybe it was not a good idea to create a different journal for point of sale. But I'm not sure that create account entries numbered with invoice sequence, with point of sale session, account entries that are not related to an invoice, is a good idea.

Is someone have the same thoughts as me?

Is someone have some answers for those questions/problems?

Thanks.

HiLudovic did you solve this issue? I am interested in understanding the solution when it works.

AD LIBITOM, michel Guénard
on 9/29/15, 7:52 AM

Absolutely no. Sorry.

L'Heureux-Cyclage, Ludovic CHEVALIER
on 10/5/15, 8:19 AM

OK. I finally found the solution. account_journal object is sorted by code by default: addons/account/account.py:763 _order = 'code' So, if we set a sale journal code that is less than pos journal code, it will be preselected when we will create invoices.

L'Heureux-Cyclage, Ludovic CHEVALIER
on 10/23/15, 9:39 AM
0
Ludovic CHEVALIER
On 7/8/15, 6:39 AM

For my second problem, here is the method of account.invoice object (from account module) that select the journal: 

     def _get_journal(self, cr, uid, context=None):
if context is None:
context = {}
type_inv = context.get('type', 'out_invoice')
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
company_id = context.get('company_id', user.company_id.id)
type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
journal_obj = self.pool.get('account.journal')
domain = [('company_id', '=', company_id)]
if isinstance(type_inv, list):
domain.append(('type', 'in', [type2journal.get(type) for type in type_inv if type2journal.get(type)]))
else:
domain.append(('type', '=', type2journal.get(type_inv, 'sale')))
res = journal_obj.search(cr, uid, domain, limit=1)
self.search(cr, uid, [('state', '=', 'done')], context=context)
return res and res[0] or False

We can see that the journal is chosen arbitrary by selecting the first one of the request ("limit=1").

Is it normal that users can't choose the journal they want for invoices? Why OpenERP prefers choose it by chance?


Edit 2015-10-23:

In addons/account/account.py:763, we could see:

    _order = 'code'

So, just have to put a correct code for invoices default journal. :-)

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 6/5/15, 6:18 AM
Seen: 1853 times
Last updated: 3/1/16, 12:11 PM