Skip to Content
Menu
This question has been flagged
2135 Views

hello ,I am new to odoo, i am trying to add a button on the sale order form to cout the expense list connect to the sale order ,but when i click the button i got the Error: unsupported operand type(s) for +: 'bool' and 'str', i use the same way on the purchase order ,it works without any error ,do not know why. can anyone help me ,Thank you !(i do not want use the re invoice policy )

class Texpense(models.Model):
_inherit = 'hr.expense'
x_e_sale_order = fields.Many2one('sale.order')


class Tsaleorder(models.Model):
_inherit = 'sale.order'
x_count_e = fields.Integer(compute="xs_count_e")
@api.depends('x_sale_order_id')
def xs_count_e(self):
for order_ec in self:
order_ec.x_count_e = len(order_ec.x_sale_order_id)

T-expense
{'search_default_ex_sale_order': active_id,'default_ex_sale_order': active_id}
[('ex_sale_order', '=', active_id)]
hr.expense
tree,form




the detailed error 

Traceback (most recent call last):
  File "D:\odoo\odoo\addons\base\models\ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "D:\odoo\odoo\http.py", line 688, in dispatch
    result = self._call_function(**self.params)
  File "D:\odoo\odoo\http.py", line 360, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "D:\odoo\odoo\service\model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "D:\odoo\odoo\http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
  File "D:\odoo\odoo\http.py", line 917, in __call__
    return self.method(*args, **kw)
  File "D:\odoo\odoo\http.py", line 536, in response_wrap
    response = f(*args, **kw)
  File "d:\odoo\addons\web\controllers\main.py", line 1607, in load
    action = request.env[action_type].sudo().browse([action_id]).read()
  File "D:\odoo\odoo\addons\base\models\ir_actions.py", line 261, in read
    values['help'] = self.with_context(**ctx).env[model].get_empty_list_help(values.get('help', ''))
  File "d:\odoo\addons\hr_expense\models\hr_expense.py", line 362, in get_empty_list_help
    return super(HrExpense, self).get_empty_list_help(help_message + self._get_empty_list_mail_alias())
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\odoo\odoo\http.py", line 644, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "D:\odoo\odoo\http.py", line 302, in _handle_exception
    raise exception.with_traceback(None) from new_cause
TypeError: unsupported operand type(s) for +: 'bool' and 'str'


Avatar
Discard