Error editing existing pricelist

Bug #925345 reported by Antoine(OpenERP)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Web Team

Bug Description

1. [Create]
2. Enter pricelist name, "Pricelist Version" [Create]
3. Enter name, "Listprice Items" [Create]
4. Select product (e.g. Ice Cream), based on "partner section…", surcharge 2.00 (rightmost fields, second from bottom)
5. [Save and close] [Save and close] [Save]
6. [Edit], then edit version and item
7. Set surcharge to 3.00
8. [Save] (item), [Save] (version), [Save] (pricelist)

Expected: pricelist saving
Observed: error dialog, product_pricelist_item set "product_id"=ARRAY[50, E'[1] Ice …

the product_id m2o seems to try setting the whole name_get somehow, rather than just the id. Not sure where that comes from.

Final RPC requests are:

object.execute_kw('trunk',
  1,
  '*',
  'product.pricelist.item',
  'read',
  [[8],
   ['sequence',
    'name',
    'product_id',
    'product_tmpl_id',
    'categ_id',
    'min_quantity',
    'base'],
   {'lang': 'en_US', 'tz': False, 'uid': 1}],
  {})
 object.execute_kw time:0.012s [{'base': -2,
    'categ_id': False,
    'id': 8,
    'min_quantity': 0,
    'name': u'1',
    'product_id': (50, u'[1] Ice Cream'),
    'product_tmpl_id': False,
    'sequence': 5}]

 object.execute_kw('trunk',
  1,
  '*',
  'product.pricelist',
  'write',
  [[4],
   {'version_id': [[1,
        5,
        {'items_id': [[1,
           8,
           {'base': -2,
            'categ_id': False,
            'id': 8,
            'min_quantity': 0,
            'name': '1',
            'price_surcharge': 3,
            'product_id': [50, '[1] Ice Cream'],
            'product_tmpl_id': False,
            'sequence': 5}]]}]]},
   {'default_type': 'sale',
    'lang': 'en_US',
    'search_default_type': 'sale',
    'tz': False,
    'uid': 1}],
  {})

[old description]

1) Use demo data
2) Assign a supplier for a specific product, add some pricelists for this specific supplier
3) Create a new pricelist based on "Partner section of the product form" and make some price computation
4) Create a sale order, apply the pricelist and select the product on which you added some supplier info in step2
5) Error: No valid pricelist line found ! :Couldn't find a pricelist line matching this product and quantity.
You have to change either the product, the quantity or the pricelist.

6) If you try to modify the pricelist after that (I try to add a name to the rule I've created):

Client Traceback (most recent call last):
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/controllers/main.py", line 830, in save
    r = m.write([id], data, req.session.eval_context(req.context))
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/openerplib/main.py", line 250, in proxy
    args, kw)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 609, in send
    raise fault

Server Traceback (most recent call last):
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 590, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/netsvc.py", line 324, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/service/web_services.py", line 591, in dispatch
    res = fn(db, uid, *params)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 166, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 120, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 175, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/audittrail/audittrail.py", line 495, in execute_cr
    return fct_src(cr, uid, model, method, *args)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 163, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/orm.py", line 3920, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/fields.py", line 496, in set
    obj.write(cr, user, [act[1]], act[2], context=context)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/orm.py", line 3920, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/fields.py", line 496, in set
    obj.write(cr, user, [act[1]], act[2], context=context)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/orm.py", line 3892, in write
    'where id IN %s', upd1 + [sub_ids])
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/sql_db.py", line 214, in execute
    res = self._obj.execute(query, params)
DataError: invalid input syntax for integer: "All products"
LINE 1: ..."base"=E'-2',"min_quantity"=0,"categ_id"=ARRAY[1, E'All prod...
                                                             ^

More or less the same bug under 6.0.3. No error but the price computation is false.

Related branches

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote : Re: [Bug 925345] [NEW] Problem on pricelist when price computation based on "partner section on the product form"
Download full text (4.9 KiB)

Le 02/02/2012 10:19, Antoine(OpenERP) a écrit :
> Public bug reported:
>
> 1) Use demo data
> 2) Assign a supplier for a specific product, add some pricelists for this specific supplier
> 3) Create a new pricelist based on "Partner section of the product form" and make some price computation
> 4) Create a sale order, apply the pricelist and select the product on which you added some supplier info in step2
> 5) Error: No valid pricelist line found ! :Couldn't find a pricelist line matching this product and quantity.
> You have to change either the product, the quantity or the pricelist.
>
> 6) If you try to modify the pricelist after that (I try to add a name to
> the rule I've created):
>
>
> Client Traceback (most recent call last):
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 180, in dispatch
> response["result"] = method(controller, self, **self.params)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/controllers/main.py", line 830, in save
> r = m.write([id], data, req.session.eval_context(req.context))
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/openerplib/main.py", line 250, in proxy
> args, kw)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
> result = self.connector.send(self.service_name, method, *args)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 609, in send
> raise fault
>
>
> Server Traceback (most recent call last):
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/web/common/http.py", line 590, in send
> result = openerp.netsvc.dispatch_rpc(service_name, method, args)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/netsvc.py", line 324, in dispatch_rpc
> result = ExportService.getService(service_name).dispatch(method, params)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/service/web_services.py", line 591, in dispatch
> res = fn(db, uid, *params)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 166, in execute_kw
> return self.execute(db, uid, obj, method, *args, **kw or {})
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 120, in wrapper
> return f(self, dbname, *args, **kwargs)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 175, in execute
> res = self.execute_cr(cr, uid, obj, method, *args, **kw)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/addons/audittrail/audittrail.py", line 495, in execute_cr
> return fct_src(cr, uid, model, method, *args)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/osv.py", line 163, in execute_cr
> return getattr(object, method)(cr, uid, *args, **kw)
> File "/home/odoo/runbot/static/openerp-dev-trunk-1276/server/openerp/osv/orm.py", line 3920, in write
> result += self._columns[field].set(cr, self...

Read more...

Revision history for this message
Numérigraphe (numerigraphe) wrote : Re: Problem on pricelist when price computation based on "partner section on the product form"

Dear Quentin,
It does somewhat make sense because nothing prevents you from entering a customer in the partner section of the product form, and to use it for sales pricelists. It can actually be pretty useful as it lets you enter prices for specific customers in mass.
So as long as it's not forbidden it should actually work.
Lionel

Revision history for this message
Numérigraphe (numerigraphe) wrote :

v6 has a known bug related to this sort of pricelists : please see Bug #860625.
It's been fixed in the trunk, but maybe the fix introduced a regression ?
Lionel Sausin.

Revision history for this message
Amit Bhavsar (Open ERP) (amb-openerp) wrote :

Hello Antoine,

For Issue#1 (step-5),I have tested your scenario, but I think you might have a misunderstand something. the system shouldn't give the option 'Partner section in product form' for a sale pricelist. So we can not consider this Issue.

For Issue#2 (step-6), When I am try to rename the rule name at that I've face the same traceback. That's why I am confirm this Issue and assign to web-team.

Also I have attached the video for more reference.

Thanks!

affects: openobject-addons → openobject-web
affects: openobject-web → openerp-web
Changed in openerp-web:
status: New → Confirmed
importance: Undecided → Medium
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
summary: - Problem on pricelist when price computation based on "partner section on
- the product form"
+ Error editing existing pricelist
description: updated
Revision history for this message
Antoine(OpenERP) (ahu-openerp) wrote :

Hello Quentin,

I encoded this bug after a small webinar with a client. He wanted to have a sale pricelist base on the cost of the selected supplier on the product form.

I don't think it's complete nonsense if your goal is selling products according to the purchase prices of several customers (lets say, you want to apply a margin for the cost price of each customer). I know the cost price can help but if the cost price is in average or that you have different cost prices for several suppliers (and quantities) then you cannot achieve your goal.

Moreover, if I'm wrong with this reasoning, then it's a usability bug: why should we display an option in the pricelist computation (rules) for the base price if it's possible to select an item that would give your errors in any case?..

description: updated
Changed in openerp-web:
status: Confirmed → Fix Released
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.