Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3522 Tampilan

I have a field linked with  Vehicle_id this  Vehicle had a product 

when I chose any  Vehicle I need to add it to the order line

when I save the record i got it "

Missing required fields on accountable sale order line.

my code :

@api.onchange('vehicle_id')

    def_add_product(self):

        lines=[]

        vals={}

        forrecinself:

            ifrec.vehicle_id:

                product=self.env['fleet.vehicle'].search([('id' , '=' ,rec.vehicle_id.id)]) 

               print('product >>>' + str(product.product))

                asd=product.product 

               vals = { 

                      'product_id' : asd.id 

,                     'order_id': id,
                    'name': asd['name'],
                    'product_uom_qty':  1,
                    'price_unit': 1,

                     'product_uom_qty' : 1

              }    

                lines.append((0,0,vals))

                rec.order_line = lines

 


 


Avatar
Buang
Jawaban Terbai

Hi Ali Ammar,

Please add  product_uom (Unit of Measure) in the order line dictionary.  As you are creating the sale order line, then you must have a value of product and UOM in the line.

Hope it will help you.

Avatar
Buang
Penulis

Thanx
It work now

Post Terkait Replies Tampilan Aktivitas
0
Nov 23
1166
2
Mar 24
4349
1
Mar 23
2391
0
Okt 22
2673
Open a URL Diselesaikan
2
Okt 22
6773