i have this error message when i print point of sale invoice which has a newly added field

Asked by Bushair

i have this error message when i print point of sale invoice which has a newly added field

Environment Information :
System : Linux-2.6.31-16-generic-pae-i686-with-Ubuntu-9.10-karmic
OS Name : posix
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:cxx-3.0-ia32:cxx-3.0-noarch:cxx-3.1-ia32:cxx-3.1-noarch:cxx-3.2-ia32:cxx-3.2-noarch:cxx-4.0-ia32:cxx-4.0-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch:desktop-4.0-ia32:desktop-4.0-noarch:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch:graphics-3.1-ia32:graphics-3.1-noarch:graphics-3.2-ia32:graphics-3.2-noarch:graphics-4.0-ia32:graphics-4.0-noarch:qt4-3.1-ia32:qt4-3.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic
Operating System Release : 2.6.31-16-generic-pae
Operating System Version : #53-Ubuntu SMP Tue Dec 8 05:20:21 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.4
OpenERP-Client Version : 5.0.3
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/lib/openerp-server/service/web_services.py", line 687, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/usr/lib/openerp-server/report/report_sxw.py", line 364, in create
    return fnct(cr, uid, ids, data, report_xml, context)
  File "/usr/lib/openerp-server/report/report_sxw.py", line 421, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/usr/lib/openerp-server/report/report_sxw.py", line 439, in create_single_pdf
    pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
  File "/usr/lib/openerp-server/report/interface.py", line 199, in create_pdf
    obj.render()
  File "/usr/lib/openerp-server/report/render/render.py", line 50, in render
    result = self._render()
  File "/usr/lib/openerp-server/report/render/rml.py", line 41, in _render
    return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 780, in parseNode
    r.render(fp)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 195, in render
    pt_obj.render(el)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 770, in render
    fis += r.render(node_story)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 700, in render
    return process_story(node_story)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 693, in process_story
    flow = self._flowable(node)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 607, in _flowable
    return self._table(node)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 505, in _table
    fl = self._flowable(n, extra_style=paraStyle)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 607, in _flowable
    return self._table(node)
  File "/usr/lib/openerp-server/report/render/rml2pdf/trml2pdf.py", line 525, in _table
    assert length == len(node.get('colWidths').split(','))
AssertionError

Question information

Language:
English Edit question
Status:
Invalid
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Jay Vora (Serpent Consulting Services)
Solved:
Last query:
Last reply:
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#1

Hello Bushair,

Have you modified something on .rml file?

I get the report pretty normally.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#2

If you have added the field in the table, make sure you have added one more value in the colwidths attribute of the same table.

Thank you.

Revision history for this message
Bushair (bushairka) said :
#3

Hi Jay,
Can you please tell me how to add value in the colwidths attribute of the same table ?

    _columns = {
        'name': fields.char('Line Description', size=512),
        'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], required=True, change_default=True),
        'price_unit': fields.float('Unit Price', required=True),
        'qty': fields.float('Quantity'),
        'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
        'discount': fields.float('Discount (%)', digits=(16, 2)),
        'notes': fields.text('Notes'),
        'serial_number': fields.char('Serial Number', size=128),
        'order_id': fields.many2one('pos.order', 'Order Ref', ondelete='cascade'),
        'create_date': fields.datetime('Creation Date', readonly=True),
        }

serial_number and notes are the fields i added,
how to add the colwidths attribute of the same table.?

Thanks
Bushair

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#4

Hello,

You need to create seperate report for that because from Point of sale module it is called the invoice report so you cannot change the original report which is related to account.invoice object.

Thanks.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#5

It has been solved.

Revision history for this message
Mohammed (gaafer5) said :
#6

Sorry, I have the same bug and I noticed it has been solved Jay, May I know what is the solution plz

Revision history for this message
Ray Carnes (rcarnes) said :
#7

We are getting this bug when printing an invoice with a note on an invoice line, using 6.1-1.

Can you share the solution Jay?

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#8

Ray,

This solution was put on official addon long back.

Let me understand your problem:
You are trying to print an invoice report with a note on invoice line and you get error!

Logically,the error of colwidth comes when you have specified unmatched no of columns in colwidth and <td>!

I just gave a try and it seems working quite well.

I guess you have customized the report. Do share your rml if its fine for you.

Thanks.