Skip to Content
Menu
This question has been flagged
1 Reply
3477 Views

hello community,
i am facing a problem with value error ,

			​ValueError: : "ProductTemplate._get_report_values() missing 1 required positional argument: 'docids'" while evaluating
'action = model._get_report_values()'

that's the code i am writing

@api.model
def _get_report_values
(self, docids, data=None):
print('docids', docids)
docs = self.env['product.template'].browse(docids)
return {
​'doc_model': 'product.template',
​'data'
: data,
​'docids'
: docids,
​'docs'
: docs,
​'lines'
: docids.get_lines()
}

hope i can get an answer 
thanks in advanced 

Avatar
Discard
Best Answer

Hi,

Try the following code.

@api.model
def _get_report_values(self, docids, data=None):
docs = self.env['product.template'].browse(docids)
return {
'docs': docs,
'doc_ids': docids,
'doc_model': 'product.template',
'data': data and data['form'] or {}}

Regards

Avatar
Discard
Author

thanks a lot
but when iam trying to call the function in XML File it doesn't give any thing in return
here is my XML
<record id="action_price_poster" model="ir.actions.server">
<field name="name">Price Poster</field>
<field name="model_id" ref="woa_odoo_inherit.model_product_template"/>
<field name="binding_model_id" ref="woa_odoo_inherit.model_product_template"/>
<field name="binding_view_types">form,tree</field>
<field name="state">code</field>
<field name="code">model._get_report_values()</field>
</record>
hope i can get explanation
thanks a lot

Author

or it's just because the function has multiple Parameters ?

Related Posts Replies Views Activity
0
Jul 25
2
0
Mar 25
1319
4
Apr 24
174168
0
Dec 23
2096
5
Jul 25
227823