Technical mailing list archives


Re: [12][XML-RPC] Variants get deleted after template update

Matt Taylor
- 23.02.2019 09:14:26
Maybe you need to set the no-update field on the record for the variants? 


On Fri, Feb 22, 2019, 8:31 AM Friedemann Stoffregen <> wrote:
Hi everyone,
this is surely just a small issue. Currently I'm having an issue with the product.template-update process:

I can create and update the `product.template` with no issue via the XML-RPC. I can also create a new Variant for the `product.template`. No problems so far.

But if I update the product.template after the variants were created, the variants get deleted. I assume it has something to do with the `product.template.product_variant_ids` field. So I’m trying to add the field to the information given by the “write” command, but it looks like it doesn’t work :(.

Has anyone an example how it should look like? I just want to keep the Variants which were created by me :(.

I tried these values for `product.template.product_variant_ids`

1: [[4,ID1,false],[4,ID2,false],[4,ID3,false], ... ]
2: [[0, false, [ID1,ID2,ID3,...]]]

I assume that the first one is not usable, because the field is a One2Many relation.

Without the field added, the logger’s output looks like this:

call product.template(4705,).write({'image': 'imagedata', 'lst_price': 0.0, 'uom_po_id': 1, 'sale_ok': True, 'active': True, 'list_price': 0.0, 'type': 'product', 'taxes_id': [[6, False, [15]]], 'uom_id': 1, 'price': 0.0, 'id': 4705,  'default_code': 'MyProduct-p'}) 

2019-02-22 15:13:32,141 28395 INFO odoo1 odoo.models.unlink: User #8 deleted mail.message records with IDs: [220410, 220409, 220408] 
2019-02-22 15:13:32,172 28395 INFO odoo1 odoo.models.unlink: User #1 deleted records with IDs: [149251, 149252, 149253] 
2019-02-22 15:13:32,319 28395 INFO odoo1 odoo.models.unlink: User #8 deleted product.product records with IDs: [212440, 212439, 212438] 
2019-02-22 15:13:32,347 28395 INFO odoo1 odoo.models.unlink: User #1 deleted mail.followers records with IDs: [219828, 219829, 219830] 
2019-02-22 15:13:32,349 28395 INFO odoo1 odoo.modules.registry: At least one model cache has been invalidated, signaling through the database.

Has anyone an idea what I’m doing wrong?

Post to: