'Test timesheet invoicing and uom conversion'

def test_timesheet_uom(self):

    prod_ts = self.env.ref('product.product_product_2')
    uom_days = self.env.ref('product.product_uom_day')
    so_vals = {'partner_id': self.partner.id, 'partner_invoice_id': self.partner.id, 'partner_shipping_id': self.partner.id, 'order_line': [(0, 0, {'name': prod_ts.name, 'product_id': prod_ts.id, 'product_uom_qty': 5, 'product_uom': uom_days.id, 'price_unit': prod_ts.list_price})], 'pricelist_id': self.env.ref('product.list0').id}
    so = self.env['sale.order'].create(so_vals)
    so.action_confirm()
    self.env['account.analytic.line'].create({'name': 'Test    Line', 'project_id': so.project_project_id.id, 'unit_amount': 16, 'user_id': self.manager.id})
    self.assertEqual(so.order_line.qty_delivered, 2, 'Sale:    uom    conversion    of    timesheets    is    wrong')
    self.env['account.analytic.line'].create({'name': 'Test    Line', 'project_id': so.project_project_id.id, 'unit_amount': 24, 'user_id': self.user.id})
    so.action_invoice_create()
    self.assertEqual(so.invoice_status, 'invoiced', 'Sale    Timesheet:    "invoice    on    delivery"    timesheets    should    not    modify    the    invoice_status    of    the    so')
