Skip to Content
Menu
This question has been flagged

Hello All,

i have a Many2one('product_weight') field in sales order based on product.product. And i try to return that field values in sales order line(product).  In product.template i added a check_box('is_weight'). So, in sales order for 'product_weight' only weight products are available. So, how to return that 'product_weight' value in sales order line(product_id) ?

My code is here:

class sale_order_pet(models.Model):

    _inherit = "sale.order"

 product_weight = fields.Many2one('product.product', string='Service products', domain="[('is_weight','=',True)]")


    @api.onchange('product_id')

    def _onchange_action_weight_add(self):

        res = self.product_id

        print"resss:::", res

        if res:

            line_values = {'product_id': self.product_weight.id,

                           }

            sale_order_line = self.env['sale.order.line'].create(line_values)


Thanks in advance

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 19
3048
0
Oct 17
2292
2
Oct 17
4001
0
Jul 19
2914
0
Jul 19
11468