我创建了一个方法如下:但它只需要最后一个循环数据而不是所有数据到xml来生成pdf,所以需要一种方法来从这个方法循环生成pdf
def bsku_asin_picking(self):
website = self.env['website'].search([('company_id', '=', self.env.company.id)], limit=1)
# print('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%', website.label_type)
# vals = []
for rec in self.move_ids_without_package:
product = self.env['product.product'].browse(rec.product_id.id)
data = {
'quantity': rec.product_uom_qty,
'display_name': product.display_name,
'product': product,
}
if website.label_type == 'bsku':
data['barcode_value'] = product.bsku
else:
data['barcode_value'] = product.asin
# vals.append(data)
return self.env.ref('product_label_bsku_sin.report_product_template_label').report_action(product, data=data)