Le 20/06/2017 à 15:19, Cédric Krier a écrit :
On 2017-06-20 15:10, Richard PALO wrote:
Le 20/06/2017 à 14:27, Cédric Krier a écrit :
On 2017-06-20 09:08, Richard PALO wrote:
Not very fluent in proteus nor the recent ir.sequence usage changes, I'm having 
difficulty
getting a critical portion of the openerp2tryton to work on 4.4...

In migrate_party, there is the following code around line 254 (nb:this has been 
2to3'd):
      # Reset the sequence
      configuration = Configuration(1)
      configuration.party_sequence.number_next = max(
          list(map(int, iter(code2party.keys())))) + 1
      configuration.party_sequence.save()


Unfortunately party_sequence is null and I can't seem to determine the 
incantation
that will fill it in correctly...

Is it also null when using the client?
Did you do a proper installation?


It appears so.  I checked my existing bases, plus a base created under 4.4

Under party->configuration->party configuration the sequence field is blank for 
all.

So it seems you have decided to not have automatic code on party.
We could improve the script for this case because obviously it does not
need to be updated.


Hmm, I've haven't [consciously] decided this at all... how would one do this, 
and why?
Moreso, has always worked as intended (automatically, that is). I've never 
fiddled with
this form prior to you just now asking me to check there in the client.

Therefore I believe at run-time the party.party sequence seems to be 
effectively used,
but the script (at least as is) is not able to update the number_next value, 
therefore dies
when trying to create the first employee because code '1' is already used (the 
company).

That is, I need to explicitly select 'party' to load it.

I do not understand what this means.
Do you mean, you have to fill the code field explicitly when creating a
party?

No. In the party configuration form for the sequence, if I select 'party' then 
it seems
selected in a persistent manner.

The problem is that all the modules are typically loaded by the script...

The following code, for example, works as expected if I manually install party 
and select
the party sequence with the tryton client.
    # Reset the sequence
    Sequence = Model.get('ir.sequence')
    configuration = Configuration(1)
    if not configuration.party_sequence:
        configuration.party_sequence = Sequence.find([('code', '=', 
'party.party')])
    configuration.party_sequence.number_next = max(
        list(map(int, iter(code2party.keys())))) + 1
    configuration.party_sequence.save()


But if I don't, the assignment fails after the find as follows:
/opt/trytond/trytond/modules/__init__.py:143: DeprecationWarning: This method 
will be removed in future versions.  Use 'parser.read_file()' instead.
  module_config.readfp(fp)
/opt/trytond/trytond/modules/__init__.py:143: DeprecationWarning: This method 
will be removed in future versions.  Use 'parser.read_file()' instead.
  module_config.readfp(fp)
/opt/trytond/trytond/model/fields/function.py:100: DeprecationWarning: 
inspect.getargspec() is deprecated, use inspect.signature() or 
inspect.getfullargspec()
  if 'names' in inspect.getargspec(method)[0]:
Traceback (most recent call last):
  File "migration.py", line 1141, in <module>
    'account': args.load_account,
  File "migration.py", line 30, in main
    migrate_party(installed, cur)
  File "migration.py", line 258, in migrate_party
    configuration.party_sequence = Sequence.find([('code', '=', 'party.party')])
  File 
"/usr/lib/python3.6/site-packages/proteus-4.4.1-py3.6.egg/proteus/__init__.py", 
line 256, in __set__
AssertionError

cheers,
--

Richard PALO

--
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/ee4dd7f5-cf04-6b4e-9612-b35750aac94e%40free.fr.

Reply via email to