Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
4642 Представления

Hello, I have a button that will print a report ( view Qweb ) but when i press the button to print on the form I get the following message:

TypeError: print_report() takes at least 6 arguments (5 given)

The button that I have in view is as follows:

<button name="print_report" string="Print Service Ticket" type="object" icon="gtk-print"/>

And the function that is used to print is:

@api.v7

def print_report(self, cr, uid, ids, context=None):

if context is None:

context = {}

data = {}

data['ids'] = context.get('active_ids', [])

data['model'] = context.get('active_model', 'ir.ui.menu')

 

return self.pool['report'].get_action(cr, uid, [], 'custom_module.report_pricelist', data=data, context=context)


PLease help me with this. Thanks.

Аватар
Отменить
Лучший ответ

You will be ok if you remove this code:

@api.v7
Аватар
Отменить

short and simple ;)

Лучший ответ

You may correct it like this:

@api.multi

def print_report(self):

  return self.env['report'].get_action(self, 'custom_module.report_pricelist')

Аватар
Отменить