Skip to Content
Menu
This question has been flagged
6250 Views
Hi,
When creating a quotation, i am trying to divide sale.order.line if quantity is more than 1. My code is like:

        if 'order_line' in vals:
order_line = []
for line in vals['order_line']:
if line[0] in [0, 1]:
if vals['x_action'] == 'foo':
if 'product_uom_qty' in line[2]:
if int(line[2].get('product_uom_qty')) > 1:
totalqty = line[2].get('product_uom_qty')
if vals['x_action'] == 'foo':
line[2].update({'product_uom_qty': 1, 'foo1': True, 'foo2': True, 'state': 'draft', 'foo3': 'Open'})
for _ in itertools.repeat(None, int(totalqty)):
order_line.append([0, 0, line[2]])
else:
line[2].update({'foo1': True, 'foo2': True})
order_line.append([0, 0, line[2]])
else:
order_line.append([0, 0, line[2]])
else:
line[2].update({'foo1': False, 'foo2': False})
order_line.append(line)
else:
order_line.append(line)
vals['order_line'] = order_line

Code goes wrong in:

 self.message_post(cr, uid, [new_id], body=_("Quotation created"), context=ctx)

My error code is:

TypeError: 'NoneType' object is not callable
Any help would be appreciated!
Avatar
Discard

can you please give your logs

Author

Hi, the logs:

Odoo Server Error

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 537, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 574, in dispatch

result = self._call_function(**self.params)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 310, in _call_function

return checked_call(self.db, *args, **kwargs)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\service\model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 307, in checked_call

return self.endpoint(*a, **kw)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 803, in __call__

return self.method(*args, **kw)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\http.py", line 403, in response_wrap

response = f(*args, **kw)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\addons\web\controllers\main.py", line 944, in call_kw

return self._call_kw(model, method, args, kwargs)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw

return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "C:\Program Files (x86)\Odoo 8.0-20150803\server\openerp\addons\sale\sale.py", line 957, in create

self.message_post(cr, uid, [new_id], body=_("Quotation created"), context=ctx)

TypeError: 'NoneType' object is not callable

Related Posts Replies Views Activity
0
Apr 24
402
4
Nov 23
4253
0
Oct 23
378
0
Dec 22
1336
2
Dec 23
17354