Error creating invoice from settlement

Bug #1180743 reported by Javier Fuentes
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
openerp-icm
New
Undecided
Unassigned

Bug Description

Hi, when trying to create an invoice from a salesman's settlement, I am getting the following error:

Client Traceback (most recent call last):
  File "/opt/openerp-cb-test/server/openerp/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/opt/openerp-cb-test/server/openerp/addons/web/controllers/main.py", line 1134, in call_button
    action = self._call_kw(req, model, method, args, {})
  File "/opt/openerp-cb-test/server/openerp/addons/web/controllers/main.py", line 1122, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/opt/openerp-cb-test/server/openerp/addons/web/session.py", line 42, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/opt/openerp-cb-test/server/openerp/addons/web/session.py", line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/opt/openerp-cb-test/server/openerp/addons/web/session.py", line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last):
  File "/opt/openerp-cb-test/server/openerp/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/opt/openerp-cb-test/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp-cb-test/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp-cb-test/server/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/opt/openerp-cb-test/server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp-cb-test/server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp-cb-test/server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp-cb-test/server/openerp/addons/sale_commission/wizard/wizard_invoice.py", line 48, in create_invoice
    journal_id=o.journal_id.id, product_id=o.product_id.id, context=context)
  File "/opt/openerp-cb-test/server/openerp/addons/sale_commission/settled.py", line 150, in action_invoice_create
    invoices_agent = agents_pool.action_invoice_create(cursor, user, settlement_agent_ids, journal_id, product_id)
  File "/opt/openerp-cb-test/server/openerp/addons/sale_commission/settled.py", line 255, in action_invoice_create
    self._get_address_invoice(cursor, user, settlement).values()
ValueError: too many values to unpack

In our case, the problem is probably caused because get_address_invoice is returning three values and only two of them (address_contact_id, address_invoice) are being collected. The problematic line is the following:

address_contact_id, address_invoice_id = \
                    self._get_address_invoice(cursor, user, settlement).values()

This problem has been found using v7.0.
Thank you very much for your time.

Related branches

Revision history for this message
KennyLeung (yyy886) wrote :

Hi, Javier

Have you solved this issue ?

Thanks

Kenny

Revision history for this message
KennyLeung (yyy886) wrote :

Hi, Javier

I have solved this issue just moment.

It caused by addons/sale_commission/settled.py", line 255, in action_invoice_create
---------------------------------------------------------------------------------
           address_contact_id, address_invoice_id = \
                    self._get_address_invoice(cursor, user, settlement).values()
---------------------------------------------------------------------------------

the values() return three values, so, we add a variant “address_default_id” to accept the first value:

---------------------------------------------------------------------------------
           address_default_id, address_contact_id, address_invoice_id = \
                    self._get_address_invoice(cursor, user, settlement).values()
---------------------------------------------------------------------------------

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.