Message field(char) too short to allow long messages

Bug #1079548 reported by Kitti Upariphutthiphong on 2012-11-16
46
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Low
OpenERP R&D Addons Team 2
OpenERP Community Backports (Addons)
Status tracked in 7.0
7.0
Undecided
Lionel Sausin - Initiatives/Numérigraphe

Bug Description

On trunk build 14921

Following error occur when trying to convert from Quotation --> Sales Order
(to confirm order, given my product has a very long name)

<pre>
  File "/opt/openerp7/server/openerp/tools/safe_eval.py", line 242, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/opt/openerp7/server/openerp/osv/orm.py", line 375, in function_proxy
    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/opt/openerp7/addons/procurement/procurement.py", line 255, in check_make_to_stock
    ok = ok and self._check_make_to_stock_product(cr, uid, procurement, context)
  File "/opt/openerp7/addons/procurement/procurement.py", line 396, in _check_make_to_stock_product
    cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
  File "/opt/openerp7/server/openerp/sql_db.py", line 162, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/openerp7/server/openerp/sql_db.py", line 227, in execute
    res = self._obj.execute(query, params)
DataError: value too long for type character varying(124)
</pre>

Steps:
=====
1. New Quotation
2. Add product with very long name
3. Confirm order

Problem:
========
In procurement.py --> object = procurement.order, field "message" has length only 124, which I guess not enough when the message is logged.

Solution:
========
I try changing length to 1024 and repeat the process. It works now.

Related branches

Changed in openobject-addons:
status: New → Incomplete

Hello Kitti,

On trunk build (Build 25070)
    server (4563)
    addons (8061)
    web (3441)

I have tested your issue at my end with latest trunk. but I didn't face any problem. So,Would you please provide proper steps to reproduce this ? and notify us If you face any problem.

Thanks you.!!

Amit Parik (amit-parik) wrote :

Hello,

This is hard to reproduce when our procurement exception's message will become more than 124 then this error will raised.
 Increasing the size is not a good way, cause 124 is enough size for message.

But as per my "Opinion" size 124 is not good as per the coding convention it should be 128.

That's why I am confirming this issue. *Please Set the field size to 128 instead of 124*.

Thanks for the reporting!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
status: Incomplete → Confirmed
Amit Parik (amit-parik) on 2012-11-26
summary: - Error: Product - not enough stock - when convert from Quotation to Sales
- Order
+ Message field(char) not proper on procurement as per the coding
+ convention.
Changed in openobject-addons:
status: Confirmed → In Progress

Hello,

Thanks For Reporting.
It has been Fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1079548-sgo
revision-id : <email address hidden>
revno: 8184
It will be available in trunk soon.

Thanks.

Changed in openobject-addons:
status: In Progress → Fix Committed
Oliver Stanton (oliverstanton) wrote :

Hello,

We also have the exact same problem - i have tried changing the field length but i get this error:

Error!

Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably by a custom addon!

Is there a work around until this is fixed?

Stephan Diehl (stephan-diehl-4) wrote :

Hi,

we are using pgAdmin and change the db field directly (with ALTER TABLE ...)

Oliver Stanton (oliverstanton) wrote :

Hi thanks for the reply - i am also using it, however it says the 'character' is invalid - syntax error.

Stephan Diehl (stephan-diehl-4) wrote :

Sorry, where is the error message? Here is the correct ALTER TABLE:

ALTER TABLE procurement_order ALTER COLUMN message TYPE character varying(512);

Changed in ocb-addons:
assignee: nobody → Lionel Sausin - Numérigraphe (lionel-sausin)
status: New → In Progress
Changed in ocb-addons:
status: In Progress → Fix Committed
summary: - Message field(char) not proper on procurement as per the coding
- convention.
+ Message field(char) too short to allow long messages
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments