تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2408 أدوات العرض


In Odoo 10 when I wanted to print multiple barcode labels for one product this code was working for me.

@api.multi
def print_product_lables(self):
    product_to_return = []
    for product in self.product_ids:
        product_to_return.extend([product.product_id.id] * product.qty)
    return {
        'type': 'ir.actions.report.xml',
        'report_name': 'config_gr_nature.report_label',
        'datas': {'ids': product_to_return},
        'context': {'report_name': _('Product Label'), 'show_origin': False},
    }

but have can I make the same thing in Odoo 12? as I can see there is no 'report' model and no ir.actions.report.xml?


الصورة الرمزية
إهمال
أفضل إجابة

Odoo 12 syntax:

return self.env.ref('module_name.report_xml_name').with_context(test='TEST').report_action(docids, data)

See model:  ir.actions.report in base module

and documentation Qweb Reports

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
ديسمبر 20
2934
2
سبتمبر 20
3145
1
فبراير 20
2949
0
مارس 22
2412
2
أكتوبر 20
27846