How to select the origin in the query??

28 views
Skip to first unread message

Markus Bala

unread,
Feb 1, 2016, 3:15:04 AM2/1/16
to tryton
Hi All,

I face some technical issue and unable to get any reference. 
Please give me some advice.

I am intend to get a list of "stock.move" with "stock.shipment.in" state is "Receive" and "stock.move" state is "Draft".
When I create the query, I lost at where how to compare the origin. below is my query:

    @staticmethod
    def table_query():
        pool = Pool()
        ShipmentIns = pool.get('stock.shipment.in')
        
        Moves = pool.get('stock.move')
        move = Moves.__table__()
        
        query = move.select(
                            move.id.as_('id'),
                            Literal(0).as_('create_uid'),
                            Now().as_('create_date'),
                            Literal(None).as_('write_uid'),
                            Literal(None).as_('write_date'),
                            move.product,
                            move.quantity,
                            move.from_location,
                            move.to_location,
                            move.planned_date,
                            move.effective_date,
                            move.lot_no,
                            move.serial_no,
                            move.weight,
                            move.expiry_date,
                            where = (move.origin = {stock.shipment.in} and state = 'draft') ----> What is the correct query?

Please help
                            

Jesús Martín Jiménez

unread,
Feb 1, 2016, 3:27:03 AM2/1/16
to try...@googlegroups.com
Hi Markus,

2016-02-01 7:25 GMT+01:00 Markus Bala <marku...@gmail.com>:
Hi All,

I face some technical issue and unable to get any reference. 
Please give me some advice.

I am intend to get a list of "stock.move" with "stock.shipment.in" state is "Receive" and "stock.move" state is "Draft".
When I create the query, I lost at where how to compare the origin. below is my query:


    @staticmethod
    def table_query():
        pool = Pool()
        ShipmentIns = pool.get('stock.shipment.in')
        
        Moves = pool.get('stock.move')
        move = Moves.__table__()
        
        query = move.select(
                            move.id.as_('id'),
                            Literal(0).as_('create_uid'),
                            Now().as_('create_date'),
                            Literal(None).as_('write_uid'),
                            Literal(None).as_('write_date'),
                            move.product,
                            move.quantity,
                            move.from_location,
                            move.to_location,
                            move.planned_date,
                            move.effective_date,
                            move.lot_no,
                            move.serial_no,
                            move.weight,
                            move.expiry_date,
                            where = (move.origin = {stock.shipment.in} and state = 'draft') ----> What is the correct query?

Please help
                            

--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/0f4abfc2-d96f-4a6d-a17f-6c4dd101eb51%40googlegroups.com.



--

Jesús Martín

Zikzakmedia SL
C/ de Sant Jaume, 9, baixos, 2ª
08720 Vilafranca del Penedès
☏ 93 890 21 08
Reply all
Reply to author
Forward
0 new messages