Skip to content

Migrating nereid modules to 3.2

Prakash Pandey edited this page Jul 21, 2014 · 5 revisions

Changes to testing

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.

Changeset

This seems to have broken the ability to run tests directly from test modules (Ex. python test_something.py).

x2Many actions

Tryton API for one2many and many2many fields also have changed.

Trytond Changeset

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

Context Processor Decorator

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)

Product Module Changes

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())]
}])