1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as req
- def get_pickings():
- purchase_orders = req.env['purchase.order'].search([('from_pop', '=', True)])
- purchase_orders = purchase_orders.mapped(lambda x: x.name)
- domain = [
- ('origin', 'in', purchase_orders),
- ('state', '=', 'assigned')
- ]
- return [
- {
- 'id': sp.id,
- 'name': sp.display_name,
- 'origin': sp.origin,
- 'packOperationExist': sp.pack_operation_exist,
- 'moveLines': [
- {
- 'id': m.id,
- 'name': m.display_name,
- 'availability': m.availability,
- 'origin': m.origin,
- 'quantity': m.product_qty,
- 'product': {
- 'id': m.product_id.id,
- 'name': m.product_id.display_name,
- 'image': m.product_id.image_medium
- }
- }
- for m in sp.move_lines
- ],
- 'partner': {
- 'id': sp.partner_id.id,
- 'name': sp.partner_id.display_name,
- 'image': sp.partner_id.image_medium or None,
- 'ruc': sp.partner_id.ruc or None,
- 'phone': sp.partner_id.phone or None,
- 'mobile': sp.partner_id.mobile or None,
- 'email': sp.partner_id.email or None
- }
- } for sp in req.env['stock.picking'].search(domain)
- ]
- def confirm_picking(stock_picking_id):
- stock_picking = req.env['stock.picking'].browse(stock_picking_id)
- stock_picking.do_transfer()
|