Using proteus with identifiers list index out of range

I am trying to work ‘the good way’ and using proteus to do some inserts.

i think i missed something

from proteus import config, Model, Wizard, Report
(...)
Party = Model.get('party.party')
Identifier =  Model.get('party.identifier')
(...)
party = Party(name='tartempion')
        party.identifiers.pop()

it says

  File "/usr/lib/python3/dist-packages/proteus/__init__.py", line 598, in pop
    self.record_removed.add(self[index])
                            ~~~~^^^^^^^
IndexError: list index out of range

no need for pop()…
do not know why…

In order to create a party with a tax identifer you should do:

party = Party(name='SAMPLE PARTY')
identifier = party.tax_identifiers.new()
identifier.code = 'CODE'
party.save()

The new methid is used to create record in One2Many fields which will be saved latter with the parent records, having the same behaviour as tryton client.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.