Skip to Content
Menu
This question has been flagged

I need a way to create a new FORM view, for displaying the stock picking operations (similar to stock.picking.form), and to group the lines by -purchase_order.partner_ref- but I can't find a way to link my custom module to 2 modules and inherit the values to display.

Also, I'd like the lines of the form to be editable "onclick", like in stock.picking.form.

I'm using 9. Thanks to anybody who can help me find a solution.

I made a SQL tree view, but it's no use for what I'm trying to accomplish.


class shipment_by_line(models.Model):   
 _name = 'shipment.by.line' 
 _auto = False  
 _columns = {
    'container' : fields.char('Container', readonly=True),  
 'name' : fields.char('Name', readonly=True),    
'product_id' : fields.integer('Product_id', readonly=True),  
 'date' : fields.datetime('Date', readonly=True),    
'date_expected' : fields.datetime('Date_expected', readonly=True),    
 'receipt'  : fields.char('Receipt', readonly=True),  
 'quantity' : fields.integer('Quantity', readonly=True),   
 'quantity_received' : fields.float('Quantity_received', readonly=False)    }

    def init(self,cr):       
          tools.drop_view_if_exists(cr, 'shipment_by_line')        
          cr.execute("""            CREATE OR REPLACE VIEW shipment_by_line AS(               
 select                     
 substring(purchase_order.partner_ref,1,40) as container,      
 purchase_order.name as receipt,                    
 purchase_order_line.product_qty as quantity,       
 purchase_order_line.qty_received as quantity_received,   
 stock_move.product_id as product_id,      
 stock_move.name as name,                   
 stock_move.date as date,                     
 stock_move.date_expected as date_expected,       
 stock_move.id as id               
 from                    
 purchase_order,          
 procurement_group,         
 stock_picking,                   
 stock_move,                   
 purchase_order_line             
 where                 
 purchase_order.group_id = procurement_group.id         
 and stock_picking.group_id = procurement_group.id     
 and stock_move.picking_id = stock_picking.id               
 and purchase_order_line.order_id=purchase_order.id         
 and stock_move.purchase_line_id=purchase_order_line.id       
 and purchase_order.partner_ref is not null
            )
    """)


Avatar
Discard
Related Posts Replies Views Activity
3
Apr 21
7711
1
Jan 17
15841
1
Dec 16
5019
1
Nov 16
2663
7
Aug 19
4683