Can't instantiate a model from .rst file

Contract workflow Scenario

    >>> import datetime
    >>> from proteus import Model, Wizard
    >>> from import Employee
    >>> from import Contract

Create contract::

    >>> c = Model.get('company.employee')

Failed example:

    c = Model.get('company.employee')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.7/", line 1329, in __run
        compileflags, 1), test.globs)
      File "<doctest scenario_contract_workflow.rst[4]>", line 1, in <module>
        c = Model.get('company.employee')
      File "/usr/local/lib/python3.7/dist-packages/proteus/", line 760, in get
        class Spam(Model, metaclass=MetaModelFactory(name, config=config)()):
      File "/usr/local/lib/python3.7/dist-packages/proteus/", line 470, in __call__
        models_key = 'c%su%s' % (id(self.config), self.config.user)
    AttributeError: 'NoneType' object has no attribute 'user'

class Employee(ModelSQL, ModelView):

    """Company Employee."""

    __name__ = "company.employee"

Why is there an exception and how to avoid it ?

You must configure proteus by calling for example: proteus.config.set_trytond().
Usually for testing scenario, it is done by activate_modules call.

Thank you you solved my problem

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