Odoo Help

0

0
1 Risposta
0
Avatar

Waleed Mohsen Yemen

--Waleed Mohsen--

3647
| 5 3 7
Sana'a, Yemen
--Waleed Mohsen--


Waleed Mohsen Yemen
28/07/19, 15:41

Hi, if I understand you correctly, you can try the below:

You already in sale.order.line model and you want to use onchange for sale_caractheristic_product field to populate sale line data

So you can use the below:

@api.onchange('sale_caractheristic_product ')
def _onchange_sale_caractheristic_product (self):
//Do you check here to retrieve the required data //Set values to sale line  
self.product_id = 
self.product_uom_qty =
..
etc
5 Commenti
Gabriel Brasile
28/07/19, 15:44

Hi, unffortily wont work.

What i want to do is, grab product caracteristics and use it on sale_product_caracteristc,.

If i change sale_product_caracterist i wont it change on product_caracteristcs.

Waleed Mohsen Yemen
28/07/19, 16:34

You will use something like that:

self.update({'move_line_ids': [(0, 0, {

'product_id': self.product1.id,

'product_uom_id': self.uom_unit.id,

'qty_done': 2,

'product_uom_qty': 0,

'lot_id': False,

'package_id': False,

'result_package_id': False,

'location_id': move1.location_id.id,

'location_dest_id': move1.location_dest_id.id,

})]})

Gabriel Brasile
29/07/19, 21:21

Hi, that was perfect.. but i need one last help :/

I'm trying insert multiples lines, when i use a for, like

for x in move_line_ids:

It will just show the last line, the cursor pass over the first,secound, etc, but only show the last one.

Some Tip?

Waleed Mohsen Yemen
30/07/19, 09:30

Yes, it will show only the last one so you have to have a loop and append all line into list and then assigned it to your ids in update method as below:

You can do something like this:

update = []

for record in data.order_line:

update.append((0, 0, {

'product_id': record.product_id.id,

'product_uom': record.product_uom.id,

'order_id': record.order_id.id,

'name': record.name,

'product_qty': record.product_uom_qty,

'price_unit': record.price_unit,

'taxes_id': False,

'product_subtotal': record.price_subtotal,

'analytic_account_id': record.order_id.analytic_account_id.id,

}))

self.update({'new_order_line_ids': update})

Gabriel Brasile
30/07/19, 22:05

Last 2 question i promisse...

If a field, integer, its not show in the many2many table widget, it wont be update corret? even if i got:

update.append((0, 0, {

'product_id': record.product_id.id, -- Show field in the table

'numeric_field': record.product_id.numeric_field.id, -- Not show field in the widget table

}))

If inside the order_line_id i got a field many2one i wont be able to update that to?

update.append((0, 0, {

'product_id': record.product_id.id,

'attributes': record.product_id.ids, -- this field is many2many

}))

Even if this case i use something like

'attributes': ((0,0{'id':1})),

I promisse i will compile every information and make a anser in the end :P

Fai una domanda
Writer
Keep Informed
2 follower(s)
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.

Register
Odoo Training Center

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

Test it now