'In order to test the Point of Sale in module, I will do three orders from the sale to the payment,
invoicing + picking, but will only check the picking consistency in the end.
TODO: Check the negative picking after changing the picking relation to One2many (also for a mixed use case),
check the quantity, the locations and return picking logic'

def test_order_to_picking(self):

    self.pos_config.open_session_cb()
    self.pos_order_pos1 = self.PosOrder.create({'company_id': self.company_id, 'pricelist_id': self.partner1.property_product_pricelist.id, 'partner_id': self.partner1.id, 'lines': [(0, 0, {'name': 'OL/0001', 'product_id': self.product3.id, 'price_unit': 450, 'discount': 0.0, 'qty': 2.0, 'tax_ids': [(6, 0, self.product3.taxes_id.ids)]}), (0, 0, {'name': 'OL/0002', 'product_id': self.product4.id, 'price_unit': 300, 'discount': 0.0, 'qty': 3.0, 'tax_ids': [(6, 0, self.product4.taxes_id.ids)]})]})
    context_make_payment = {'active_ids': [self.pos_order_pos1.id], 'active_id': self.pos_order_pos1.id}
    self.pos_make_payment_2 = self.PosMakePayment.with_context(context_make_payment).create({'amount': 1845})
    context_payment = {'active_id': self.pos_order_pos1.id}
    self.pos_make_payment_2.with_context(context_payment).check()
    self.assertEqual(self.pos_order_pos1.state, 'paid', 'Order    should    be    in    paid    state.')
    self.pos_order_pos1._create_account_move_line()
    self.assertTrue(self.pos_order_pos1.account_move, 'Journal    entry    has    not    been    attached    to    Pos    order.')
    self.pos_order_pos1.create_picking()
    self.assertEqual(self.pos_order_pos1.picking_id.state, 'done', 'Picking    should    be    in    done    state.')
    self.assertEqual(self.pos_order_pos1.picking_id.move_lines.mapped('state'), ['done', 'done'], 'Move    Lines    should    be    in    done    state.')
    self.pos_order_pos2 = self.PosOrder.create({'company_id': self.company_id, 'pricelist_id': self.partner1.property_product_pricelist.id, 'partner_id': self.partner1.id, 'lines': [(0, 0, {'name': 'OL/0003', 'product_id': self.product3.id, 'price_unit': 450, 'discount': 0.0, 'qty': (-2.0), 'tax_ids': [(6, 0, self.product3.taxes_id.ids)]}), (0, 0, {'name': 'OL/0004', 'product_id': self.product4.id, 'price_unit': 300, 'discount': 0.0, 'qty': (-3.0), 'tax_ids': [(6, 0, self.product4.taxes_id.ids)]})]})
    context_make_payment = {'active_ids': [self.pos_order_pos2.id], 'active_id': self.pos_order_pos2.id}
    self.pos_make_payment_3 = self.PosMakePayment.with_context(context_make_payment).create({'amount': (-1845)})
    context_payment = {'active_id': self.pos_order_pos2.id}
    self.pos_make_payment_3.with_context(context_payment).check()
    self.assertEqual(self.pos_order_pos2.state, 'paid', 'Order    should    be    in    paid    state.')
    self.pos_order_pos2._create_account_move_line()
    self.assertTrue(self.pos_order_pos2.account_move, 'Journal    entry    has    not    been    attached    to    PoS    order.')
    self.pos_order_pos2.create_picking()
    self.assertEqual(self.pos_order_pos2.picking_id.state, 'done', 'Picking    should    be    in    done    state.')
    self.assertEqual(self.pos_order_pos2.picking_id.move_lines.mapped('state'), ['done', 'done'], 'Move    Lines    should    be    in    done    state.')
    self.pos_order_pos3 = self.PosOrder.create({'company_id': self.company_id, 'pricelist_id': self.partner1.property_product_pricelist.id, 'partner_id': self.partner1.id, 'lines': [(0, 0, {'name': 'OL/0005', 'product_id': self.product3.id, 'price_unit': 450, 'discount': 0.0, 'qty': (-2.0), 'tax_ids': [(6, 0, self.product3.taxes_id.ids)]}), (0, 0, {'name': 'OL/0006', 'product_id': self.product4.id, 'price_unit': 300, 'discount': 0.0, 'qty': 3.0, 'tax_ids': [(6, 0, self.product4.taxes_id.ids)]})]})
    context_make_payment = {'active_ids': [self.pos_order_pos3.id], 'active_id': self.pos_order_pos3.id}
    self.pos_make_payment_4 = self.PosMakePayment.with_context(context_make_payment).create({'amount': 45})
    context_payment = {'active_id': self.pos_order_pos3.id}
    self.pos_make_payment_4.with_context(context_payment).check()
    self.assertEqual(self.pos_order_pos3.state, 'paid', 'Order    should    be    in    paid    state.')
    self.pos_order_pos3._create_account_move_line()
    self.assertTrue(self.pos_order_pos3.account_move, 'Journal    entry    has    not    been    attached    to    PoS    order.')
    self.pos_order_pos3.create_picking()
    self.assertEqual(self.pos_order_pos3.picking_id.state, 'done', 'Picking    should    be    in    done    state.')
    self.assertEqual(self.pos_order_pos3.picking_id.move_lines.mapped('state'), ['done'], 'Move    Lines    should    be    in    done    state.')
