Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
10263 Weergaven

After connecting to the server using "xmlrpc" and following the instructions from here (https://www.odoo.com/documentation/8.0/api_integration.html), I try to change the value of the "route_ids" (Procurement -> Supply Chain Information -> Routes) so none of the three options (Manufacture, Buy, Make To Order) is selected. 

First I take the current values:

>>> models.execute_kw(db, uid, password,
...     'product.template', 'read',
...     [125], {'fields': ['route_ids']})
{'route_ids': [5, 6, 1], 'id': 125}

Then I attempt to update the values:

>>> models.execute_kw(db, uid, password, 'product.template', 'write', 
... [[125], {'route_ids': []}])    
True

And finally I check whether the values have been updated or not: 

>>> models.execute_kw(db, uid, password,
...     'product.template', 'read',
...     [125], {'fields': ['route_ids']})
{'route_ids': [5, 6, 1], 'id': 125}

Any idea why this does not work? I got the same results, i.e. no change, when I tried to change the 'display_name' but when I tried to change the 'weight_net' everything works fine. Any ideas?

Avatar
Annuleer
Auteur Beste antwoord

Ok, so the answer is actually heavily dependent on the documentation and has to do with the special way the many2many relationships are managed: https://www.odoo.com/documentation/8.0/reference/orm.html#openerp.models.Model.write

So in order to delete all the routes you have to do:

models.execute_kw(db, uid, password, 'product.template', 'write', [[id], {'route_ids': [(5, 0, 0)]}])

And in order to add a route (e.g. with route id '1'):

models.execute_kw(db, uid, password, 'product.template', 'write', [[id], {'route_ids': [(4, 1, 0)]}])

Avatar
Annuleer
Beste antwoord

With a XML file :


<record id="stock_lapagept.warehouse_pt" model="stock.warehouse">

<field name="name">La Page PT - PT2warehouse</field>

<field name="code">WHPT</field>

<field name="partner_id" ref="partners_lapagept.partner_pt" />

<field name="company_id" ref="partners_lapagept.company_pt" />

<field name="view_location_id" ref="stock_lapagept.warehouse_loc_pt" />

<field name="wh_input_stock_loc_id" ref="stock_lapagept.input_loc_pt" />

<field name="wh_output_stock_loc_id" ref="stock_lapagept.output_loc_pt" />

<field name="lot_stock_id" ref="stock_lapagept.etagere_sous_sol_pt" />

<field name="route_ids" eval="[ (6, 0, [ref('stock_lapagept.make_to_order_route_pt'), ref('stock_lapagept.drop_shipping_route_pt') , ref('stock_lapagept.buy_from_supplier_route_pt'), ref('stock_lapagept.receipt_in_1_step_route_pt'), ref('stock_lapagept.ship_to_customer_route_pt') ] ) ]" />

</record>

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
jun. 22
6763
1
okt. 24
4409
2
dec. 22
4242
5
sep. 19
8470
0
apr. 18
2483