Browse Source

Fix init hook problem, more checks

pull/486/head
Giovanni Francesco Capalbo 7 years ago
parent
commit
6c78017402
  1. 5
      partner_multi_relation_parent/models/res_partner.py

5
partner_multi_relation_parent/models/res_partner.py

@ -32,7 +32,10 @@ class ResPartner(models.Model):
this.id, type_relation, old_parent_id this.id, type_relation, old_parent_id
) )
previous.unlink() previous.unlink()
# create new relations
# create new relations only if all the needed partners are there
# for example if on create it failed this.id will be false or if it
# has no parent also would fail.
if this.id and parent_id:
par_rel_mod.create({ par_rel_mod.create({
'left_partner_id': this.id, 'left_partner_id': this.id,
'type_id': type_relation, 'type_id': type_relation,

Loading…
Cancel
Save