x_barcode_id

Bug #1266277 reported by Med Said BARA
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Stock And Logistic Bar Code
Fix Released
Undecided
Unassigned

Bug Description

All modules from ~stock-logistic-core-editors/stock-logistic-barcode/7.0 : / (revision 61) installed without problem, all working well.

The issue:

Under: Settings --> configuration --> Sales : when trying to check "Generate invoices based on the sales order lines " or "Generate invoices after and based on delivery orders" and apply change, i get the following error.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
 File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/res/res_config.py", line 558, in execute
    getattr(self, method)(cr, uid, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/sale_stock/res_config.py", line 87, in set_sale_defaults
    res = super(sale_configuration, self).set_sale_defaults(cr, uid, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/sale/res_config.py", line 111, in set_sale_defaults
    product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 377, in function_proxy
    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 130, in write
    if not obj.x_barcode_id:
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 499, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'x_barcode_id' does not exist in object 'browse_record(product.product, 1)'"
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1- In the Database, there is really no x_barcode _id field .
2- When and where x_barcode_id field is supposed to be created ???
3- Is ther any missing inheritance in /tr_barcode_config/barcode/barcode_osv.py
4- What's wrong with /tr_barcode_field/barcode_field.py and tr_barcode_field/barcode_field_view.xml in tr_barcode_field modul ???

Best regards and Happy New Year.

Related branches

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

the tr_barcode.installer in tr_barcode_field is in charge for creating the field. Did you run that wizard?

Revision history for this message
Med Said BARA (diassynthesis) wrote :

Dear Alexandre;
Still the same issue.
In your last comment, do you mean: tr_barcode.installer in tr_barcode not in tr_barcode_field" ?

second: in barcode_field_view.xml (under tr_barcode_field), why record tag is commented !!!

Waiting for reply .

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : Re: [Bug 1266277] Re: x_barcode_id

On mer. 26 févr. 2014 16:30:14 CET, diassynthesis wrote:
> Dear Alexandre;
> Still the same issue.
> In your last comment, do you mean: tr_barcode.installer in tr_barcode not in tr_barcode_field" ?
>
> second: in barcode_field_view.xml (under tr_barcode_field), why record
> tag is commented !!!
>
> Waiting for reply .
>

Hello,

I've pushed an updated branch to
lp:~camptocamp/stock-logistic-barcode/7.0-fix_1266277-afe

Could you test that it fixes your issue (and report back if it does
not)?

--
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

Revision history for this message
Med Said BARA (diassynthesis) wrote :

The issue is not fixed but the error message changed:

I'm getting the following error message when i click on "Apply" as described in my first comment

-----log content --------
 File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/res/res_config.py", line 558, in execute
    getattr(self, method)(cr, uid, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/sale_stock/res_config.py", line 87, in set_sale_defaults
    res = super(sale_configuration, self).set_sale_defaults(cr, uid, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/sale/res_config.py", line 111, in set_sale_defaults
    product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 377, in function_proxy
    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 139, in write
    vals['x_barcode_id'] = barcode_ids[0]
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 64, in create_barcode
    pool = pooler.get_pool(cr.dbname)
NameError: global name 'pooler' is not defined
-----End--------

I also get an error message slightly differnet, when under product form i click on "Generate the EAN13 "

-------Log content----
 File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/audittrail/audittrail.py", line 522, in execute_cr
    return fct_src(cr, uid, model, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/product_barcode_generator/product.py", line 109, in generate_ean13
    }, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 139, in write
    vals['x_barcode_id'] = barcode_ids[0]
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 64, in create_barcode
    pool = pooler.get_pool(cr.dbname)
NameError: global name 'pooler' is not defined

-----End-----------------------------

Revision history for this message
Med Said BARA (diassynthesis) wrote :

Attachment for errors messages

Revision history for this message
Med Said BARA (diassynthesis) wrote :

+ Attachment for errors messages

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Not sure I see what you mean. If you check the code, you'll see that pooler is defined in that module (http://bazaar.launchpad.net/~camptocamp/stock-logistic-barcode/7.0-fix_1266277-afe/view/head:/tr_barcode_config/barcode/barcode_osv.py#L23)

Also I'm not sure what the "Generate the EAN13 " link or button you are referring to actually is. I see no such button / link in a stripped down installation (on which I installed sale, stock, barcode_link, tr_barcode, tr_barcode_config, tr_barcode_field, tr_barcode_on_picking, tr_barcode_on_prodlots, tr_barcode_on_product, tr_barcode_on_tracking). On that fresh install I went to settings -> sales, activated the "Generate invoices based on the sales order lines " setting, clicked "install" and no stack trace occured.

I'll need more information from you in order to reproduce and fix.

Revision history for this message
Med Said BARA (diassynthesis) wrote :

partially solved !!!

1_ About "pooler": partially solved by a little modification in barcode_osv.py:

from openerp.osv import orm, fields
from openerp import pooler ---> modification here
from openerp.tools.translate import _ ----> and here
from openerp import SUPERUSER_ID

2- Now getting an IO error this new error about barcode.png:

    return attr(self._cr, self._uid, [self._id], *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 142, in write
    barcode_id = create_barcode(cr, uid, obj.id, vals, self._name, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 91, in create_barcode
    barcode_obj.generate_image(cr, uid, [barcode_id], context=context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode/tr_barcode.py", line 98, in generate_image
    hr=self_obj.hr_form)
  File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode/tr_barcode.py", line 81, in get_image
    return base64.encodestring(open("/tmp/barcode.png","rb").read())
IOError: [Errno 2] No such file or directory: '/tmp/barcode.png'

Revision history for this message
Med Said BARA (diassynthesis) wrote :

About the "GENERATE THE EAN13".
-----------------------------------------------------
It's created by "addons/product_barcode_generator/product_view.xml" module

Yes, the issue may be hard to reproduce , cause in my development platform i have actually more than 1400 modules with 598 installed, and there is probably a conflict between some of them and perhaps some incompatibilities and hidden bugs.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

You will have to resolve this by yourself then, or together with the
folks in charge for product_barcode_generator.

Alexandre

On jeu. 27 févr. 2014 18:53:01 CET, diassynthesis wrote:
> About the "GENERATE THE EAN13".
> -----------------------------------------------------
> It's created by "addons/product_barcode_generator/product_view.xml" module
>
> Yes, the issue may be hard to reproduce , cause in my development
> platform i have actually more than 1400 modules with 598 installed, and
> there is probably a conflict between some of them and perhaps some
> incompatibilities and hidden bugs.
>
>
>
> ** Attachment added: "generate EAN13.png"
> https://bugs.launchpad.net/stock-logistic-barcode/+bug/1266277/+attachment/3999800/+files/generate%20EAN13.png
>

--
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

On 27/02/2014 18:42, diassynthesis wrote:
> partially solved !!!
>
> 1_ About "pooler": partially solved by a little modification in
> barcode_osv.py:
>
> from openerp.osv import orm, fields
> from openerp import pooler ---> modification here
> from openerp.tools.translate import _ ----> and here
> from openerp import SUPERUSER_ID

Please use diff -u to report changes.

The first version does work in in v7, although the shortcut import is
indeed deprecated. I'll report another bug for this.

>
> 2- Now getting an IO error this new error about barcode.png:
>
> return attr(self._cr, self._uid, [self._id], *args, **kwargs)
> File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 142, in write
> barcode_id = create_barcode(cr, uid, obj.id, vals, self._name, context=context)
> File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode_config/barcode/barcode_osv.py", line 91, in create_barcode
> barcode_obj.generate_image(cr, uid, [barcode_id], context=context)
> File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode/tr_barcode.py", line 98, in generate_image
> hr=self_obj.hr_form)
> File "/usr/lib/pymodules/python2.7/openerp/addons/tr_barcode/tr_barcode.py", line 81, in get_image
> return base64.encodestring(open("/tmp/barcode.png","rb").read())
> IOError: [Errno 2] No such file or directory: '/tmp/barcode.png'
>

There is a race condition in this code (see
https://bugs.launchpad.net/stock-logistic-barcode/+bug/1285603 and the
related branch fixing it).

--
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

Changed in stock-logistic-barcode:
status: New → Fix Committed
Revision history for this message
gonssal (gonssal) wrote :

Hi.

I'm having the same problem and I'd like to ask how can you run the wizard Alexandre talks about in comment #1?. Should it be fired when installing the module? If that's the case, it didn't fire for me and I can't find it anywhere.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

@gonssal: it is in the Settings menu, under Barcode.

Changed in stock-logistic-barcode:
status: Fix Committed → 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.