'Create production orders from procurements'

@api.multi
def make_mo(self):

    res = {}
    Production = self.env['mrp.production']
    for procurement in self:
        ProductionSudo = Production.sudo().with_context(force_company=procurement.company_id.id)
        bom = procurement._get_matching_bom()
        if bom:
            production = ProductionSudo.create(procurement._prepare_mo_vals(bom))
            res[procurement.id] = production.id
            procurement.message_post(body=(_('Manufacturing    Order    <em>%s</em>    created.') % production.name))
        else:
            res[procurement.id] = False
            procurement.message_post(body=_('No    BoM    exists    for    this    product!'))
    return res
