This question has been flagged
6 Replies
4995 Views

I'm using odoo v8 and POS (Point of sale) module.

But when I make a sale and choose the payment method and then the option "Invoice", the system creates an invoice but in the state open. It shouldn't be in the state paid?

How do I configure the POS to create the Invoices in the state paid thought the POS ?

Thanks 


 

Avatar
Discard
Author Best Answer

This worked for me:

https://github.com/odoo/odoo/issues/6534

Avatar
Discard

Did you use the method def _confirm_orders(self, cr, uid, ids, context=None): ???? Is this what works for you?

Ok! this new method works very well. Thanks

Best Answer

We have corrected the method on https://github.com/odoo/odoo/issues/6534. 

Here is our new method who can manage also the return amount (the money we give back to customer).

We hope it could help somebody.

from openerp.osv import fields, osv
import logging
logger = logging.getLogger(__name_)

class pos_session(osv.osv):
_inherit = 'pos.session'

def _confirm_orders(self, cr, uid, ids, context=None):

account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
pos_order_obj = self.pool.get('pos.order')
for session in self.browse(cr, uid, ids, context=context):
local_context = dict(context or {}, force_company=session.config_id.journal_id.company_id.id)
order_ids = [order.id for order in session.order_ids if order.state == 'paid']
move_id = account_move_obj.create(cr, uid, {'ref' : session.name, 'journal_id' : session.config_id.journal_id.id, }, context=local_context)
pos_order_obj._create_account_move_line(cr, uid, order_ids, session, move_id, context=local_context)
for order in session.order_ids:
if order.state == 'done':
continue
if order.state not in ('paid', 'invoiced'):
raise osv.except_osv(
_('Error!'),
_("You cannot confirm all orders of this session, because they have not the 'paid' status"))
else:
pos_order_obj.signal_workflow(cr, uid, [order.id], 'done')
order_ids = self.pool.get('pos.order').search(cr, uid, [('session_id','=', session.id)])

for obj_order_id in self.pool.get('pos.order').browse(cr, uid, order_ids, context=context):
move_line = []
for move_line_id in obj_order_id.invoice_id.move_id.line_id:
if move_line_id.name == obj_order_id.name:
move_line.append(move_line_id.id)

move_line_ids_1 = []

for statement_id in obj_order_id.statement_ids:

move_line_ids = account_move_line_obj.search(cr, uid, [('statement_id','=', statement_id.statement_id and statement_id.statement_id.id)])

if (move_line_ids != move_line_ids_1) :

for line in account_move_line_obj.browse(cr, uid, move_line_ids):

if line.credit and line.name.strip().strip(':') == obj_order_id.name:
move_line.append(line.id)
if line.debit and 'return' in line.name:
move_line.append(line.id)


move_line_ids_1 = move_line_ids

ctx = context.copy()
ctx.update({'active_ids': move_line})
self.pool.get('account.move.line.reconcile').trans_rec_reconcile_full(cr, uid, [], ctx)

return True
Avatar
Discard
Best Answer

Hello !


There is not specific configuration for this situation in POS that you want.

We have to customize because, we have to select payment method again from Invoice also when registering payment but it is possible by changing workflow.


Thanks,

Acespritech Solutions Pvt. Ltd.

Skype: acespritech

info@acespritech.com

Avatar
Discard
Best Answer

 Hi,

For your query, to set POS payment invoice to PAID status automatically there is no configuration in Odoo. For this we need to have customized module as because, in general without any customization unless we register a payment in the Invoicing Menu for any POS Order,we wont be able to see the POS order invoice in PAID state

Hope this helps

Cheers!!

Avatar
Discard