Comment 23 for bug 1127114

Revision history for this message
Francisco Martinez (pxntium) wrote : Re: [Bug 1127114] Re: [Trunk/7.0]: Returning products causing credit - debit value error

Hi Ravi,
I think I'm doing something wrong:

   1. I have downloaded the point_of_sale.py from the rev 8792
   2. Restarted the Openerp server
   3. Create a new session in POS
   4. Making 3 orders
   5. Refund the second order
   6. Try to close the session, and I have the same error

The log says:
2013-04-23 21:02:56,825 10212 ERROR None openerp.sql_db: bad query: insert
into "account_move_line"
(id,"account_id","company_id","currency_id","period_id","date_created","date","partner_id","move_id","blocked","tax_amount","product_id","centralisation","journal_id","name","tax_code_id","credit","state","debit","amount_currency","ref","quantity",create_uid,create_date,write_uid,write_date)
values
(164226,1158,'1',NULL,'5','2013-04-23','2013-04-23',NULL,43162,'False','5.64',863,'normal','1','PIRULETA
ARBOL
LECHE',8,'2.82','draft','2.82','0.00','POS/2013/04/29332','0.00',15,(now()
at time zone 'UTC'),15,(now() at time zone 'UTC'))
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 227, in
execute
    res = self._obj.execute(query, params)
IntegrityError: el nuevo registro para la relación «account_move_line»
viola la restricción check «account_move_line_credit_debit1»

2013-04-23 21:02:56,826 10212 ERROR None openerp.tools.safe_eval: Cannot
eval u'wkf_action_close()'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/tools/safe_eval.py", line 241,
in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict,
locals_dict)
  File "", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 374, in
function_proxy
    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/usr/share/pyshared/openerp/addons/point_of_sale/point_of_sale.py",
line 435, in wkf_action_close
    self._confirm_orders(cr, uid, ids, context=context)
  File "/usr/share/pyshared/openerp/addons/point_of_sale/point_of_sale.py",
line 454, in _confirm_orders
    self.pool.get('pos.order')._create_account_move_line(cr, uid,
order_ids, session, move_id, context=context)
  File "/usr/share/pyshared/openerp/addons/point_of_sale/point_of_sale.py",
line 1110, in _create_account_move_line
    self.pool.get("account.move").write(cr, uid, [move_id],
{'line_id':all_lines}, context=context)
  File "/usr/share/pyshared/openerp/addons/account/account.py", line 1339,
in write
    result = super(account_move, self).write(cr, uid, ids, vals, c)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4180, in
write
    result += self._columns[field].set(cr, self, id, field, vals[field],
user, context=rel_context) or []
  File "/usr/lib/pymodules/python2.7/openerp/osv/fields.py", line 557, in
set
    id_new = obj.create(cr, user, act[2], context=context)
  File "/usr/share/pyshared/openerp/addons/account/account_move_line.py",
line 1229, in create
    result = super(account_move_line, self).create(cr, uid, vals,
context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4436, in
create
    cr.execute('insert into "'+self._table+'" (id'+upd0+") values
("+str(id_new)+upd1+')', tuple(upd2))
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 162, in
wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 227, in
execute
    res = self._obj.execute(query, params)
IntegrityError: el nuevo registro para la relación «account_move_line»
viola la restricción check «account_move_line_credit_debit1»

2013-04-23 21:02:56,828 10212 ERROR None openerp.netsvc: Constraint Error
Wrong credit or debit value in accounting entry !
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 289, in
dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line
614, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 133, in
wrapper
    tr(osv_pool._sql_error[key], 'sql_constraint') or inst[0])
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 72, in
abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: ('Constraint Error', 'Wrong credit or debit value in accounting
entry !')

It's possible that I have wrong other thing?

Thanks in advance.
Regards
Fran

2013/4/23 Ravi Gohil (OpenERP) <email address hidden>

> ** Attachment added: "journal_items_for_session_main_00003.png"
>
> https://bugs.launchpad.net/openobject-addons/+bug/1127114/+attachment/3651320/+files/journal_items_for_session_main_00003.png
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1138698).
> https://bugs.launchpad.net/bugs/1127114
>
> Title:
> [Trunk/7.0]: Returning products causing credit - debit value error
>
> Status in OpenERP Addons (modules):
> Fix Committed
>
> Bug description:
> Hello,
>
> Also tested on latest runbot for 7.0 (built 3921)
>
> Crete some sales in one pos session.
> When you return a product using the Point of Sales - Orders list. Choose
> a previous POS order ref of that day, return a product, pay it back (it
> proposes a negative saldo which seems to be correct).
>
> At the end of your session when you want to close and post your
> session to the sales journal it gives you an error:
>
> "Constraint Error - Wrong credit or debit value in accounting entry !"
>
> When you have a session without returning products it seems to work
> fine, even with taking money in or out your session using the
> corresponding buttons.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-addons/+bug/1127114/+subscriptions
>