-
Notifications
You must be signed in to change notification settings - Fork 27
Migrating nereid modules to 3.2
Tryton server had a major refactoring of the testing API. Nereid also had to change for this. The current change involves setting up the tryton configuration and injecting a database name into the environment variables.
This seems to have broken the ability to run tests directly from
test modules (Ex. python test_something.py
).
Tryton API for one2many and many2many fields also have changed.
With the above commit version 3.2 deprecates the following actions:
-
set
: which only the target ids to this record. -
unlink
: use remove instead. -
unlink_all
: which removed all related records.
Of which set
was the most widely used action in nereid and
mostly within tests. They have been changed in
commit fb8560a2e7a47cc
With 3.2 context processor decorator should be used to make method available in template context.
[Change set] (https://github.com/openlabs/nereid/commit/b969e5072bd62078ccf8c74755362fadfa5f39d6)
Unlike previous 3.0, you need to create product variant manually in this version. In test you can create a product this way:
# Create product template with default product
product_template, = self.Template.create([{
'name': 'test template',
'category': self.category.id,
'type': 'goods',
'list_price': Decimal('10'),
'cost_price': Decimal('5'),
'default_uom': uom.id,
'description': 'Description of template',
'products': [('create', self.Template.default_products())]
}])