Hi! I’vw made a one2one field that relate user and party but when i try to save a party or a user with this new field filed i get this error:
Fault: RelacionPartyUser.__init__() got an unexpected keyword argument '_ids
Here’s my intermediate class model:
class RelacionPartyUser(ModelSQL):
"RelacionPartyUser"
__name__ = 'jardin.relacionpartyuser'
origin = fields.Many2One('party.party','Origin')
target = fields.Many2One('res.user','Target')
def __init__(self):
super(RelacionPartyUser, self).__init__()
self._sql_constraints += [
('origin_unique','UNIQUE(origin)',
'Origin must be unique'),
('target_unique','UNIQUE(target)',
'Target must be unique')
]
My party.py:
from trytond.model import fields
from trytond.pool import PoolMeta
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
usuario = fields.One2One(
'jardin.relacionpartyuser','origin','target','Usuario')
My user.py:
from trytond.model import fields
from trytond.pool import PoolMeta
class User(metaclass=PoolMeta):
__name__ = 'res.user'
persona = fields.One2One(
'jardin.relacionpartyuser','target','origin','Persona')
my relation table:
Column | Type | Collation | Nullable | Default
-------------+--------------------------------+-----------+----------+------------------------------------------------------
id | integer | | not null | nextval('jardin_relacionpartyuser_id_seq'::regclass)
create_date | timestamp(6) without time zone | | |
create_uid | integer | | |
origin | integer | | |
target | integer | | |
write_date | timestamp(6) without time zone | | |
write_uid | integer | | |
Indexes:
"jardin_relacionpartyuser_pkey" PRIMARY KEY, btree (id)
"idx_jardin_relacionpartyuser_148b804afcb562d610baf0e3d0089bf7" btree (target) WHERE target IS NOT NULL
"idx_jardin_relacionpartyuser_fc2db724cf3f7f84bcc1828d1e3fa760" btree (origin) WHERE origin IS NOT NULL
Check constraints:
"jardin_relacionpartyuser_id_positive" CHECK (id >= 0)
Foreign-key constraints:
"jardin_relacionpartyuser_origin_fkey" FOREIGN KEY (origin) REFERENCES party_party(id) ON DELETE SET NULL
"jardin_relacionpartyuser_target_fkey" FOREIGN KEY (target) REFERENCES res_user(id) ON DELETE SET NULL