Odoo Hilfe


1 Answer


I  ​just found some mistake into code which i corrected. Hope this will help.

Problem in code which i changed it.

1. if picking is creating. so it will contain backorder_id.but you are searching wrong like created record as reference into backorder it.

2. second search will give you browse record, or blank object. not True or False.

Please verify code. Hope this will help.

    @ api.model 
    def create (self, vals): 
        res = super (StockPicking, self) .create (vals) 
        res.generate_quality_alert () 
        return res

    @ api.multi 
    def generate_quality_alert (self): 
        quality_alert = self.env ['quality.alert'] 
        quality_measure = self.env ['quality.measure'] 
        stockpick = self.env ['stock.picking'] 
        for pick in self :  
            if pick.backorder_id:
                for line in pick.backorder_id.move_lines:
                    measures = quality_measure.search ([] ('product_id ',' = ', line.product_id.id)]) 
                    if measures:
                        quality_alert.create ({
                            product_id: line.product_id.id, 
                            picking_id: pick.backorder_id.id, 
                            origin: pick.backorder_id.name, 
                            company_id: pick.backorder_id.company_id.id, 
                            order_id: false, 
                            ordered_quantity: line.product_uom_qty, 
                            'pending_quantity': line.product_uom_qty , 

Fragen Sie
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now