Odoo Help


Mail Attachment problem in contracts

Shivam Goyal
on 4/1/14, 8:40 AM 1,635 views

Hello everyone,

I have a problem in the contract module.When I create a sale order from the contract and then create an invoice it throws an error when press the "Send by Email" button for invoice

Client Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/web/controllers/main.py", line 1128, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/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 "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/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 "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/osv/osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/osv/osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/email_template/wizard/mail_compose_message.py", line 103, in onchange_template_id values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context)) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/document/document.py", line 129, in create return super(document_file, self).create(cr, uid, vals, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/addons/base/ir/ir_attachment.py", line 298, in create return super(ir_attachment, self).create(cr, uid, values, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/osv/orm.py", line 4454, in create cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2)) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/sql_db.py", line 161, in wrapper return f(self, args, *kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20131212_002408-py2.6.egg/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) ProgrammingError: column "partner_id" is of type integer but expression is of type integer[] LINE 1: ...,E'mail.compose.message',E'',1,NULL,E'binary',0,0,ARRAY[97],... ^ HINT: You will need to rewrite or cast the expression.

I tested out everything and then what i found out was that when i detach the attachment from the template it works fine bu t when i attach the invoice report attachment to the template it throws me this error and that too only when i create the invoice from the contract but usually if i goto account--->cusotmer invoice ---->choose an invoice --->"Send by mail" it works totally fine.

Your help will be deeply appreciated Thanx in advance

Can you detail the steps, from the creation till the moment when the error is thrown

Med Said BARA
on 4/1/14, 9:16 AM

First of all thanx for your interest. Now first i goto the sales--->contract--->create sales order ---> invoice the sales order --->create invoice --->"Send by mail button". at this moment i get the above error. i have temporarily fixed the error as the error says it does not have correct value of partner_id.So what i did is i went to email_template/wizard/mail_compose_message.py/onchange_template_id() and added the value of partner_id as False in the data_attach dictionary.Everything's working fine now but just that i want to confirm whether this is right way to do it. Thanx in advance

Shivam Goyal
on 4/1/14, 2:28 PM

I'm facing the same problem did you fix it ?

Versão Integral, Anabela Damas
on 7/2/14, 10:34 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/1/14, 8:40 AM
Seen: 1635 times
Last updated: 3/16/15, 8:10 AM