The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenERP::OOM::Object

SYNOPSIS

    package Package::OpenERP::Object::Account;

    use 5.010;
    use OpenERP::OOM::Object;

    openerp_model 'account.account';

    has active => (is => 'rw', isa => 'Bool'); # Active
    has code => (is => 'rw', isa => 'Str'); # (required) Code

    ...

    relationship 'consolidated_children' => (
        key   => 'child_consol_ids',
        type  => 'many2many',
        class => 'Account',
    ); # Consolidated Children

    ...

    1;

DESCRIPTION

Use this module to create the 'objects' for your models. It also implicitly loads Moose too.

The class is linked to a model in OpenERP.

METHODS

openerp_model

Specify the model in OpenERP.

init_meta

An internal method that hooks up the Moose internals and implicitly makes your new classes inherit from OpenERP::OOM::Object::Base. See the OpenERP::OOM::Object::Base documentation for a list of the methods your objects will have by default.

relationship

Used to specify relationships between this object and others in OpenERP.

Possible options for the type are many2one, one2many and many2many. These are specified in OpenERP in those terms.

Used to indicate links with other systems. Typically this is to another table in DBIC at the moment.

The key field is in OpenERP and is used for the ids of the objects to link to.

The class is used to ask the link provider to provide a link by this name. It is not necessarily treated as a class, but the default link provider does do that.

Possible options for type are single and multiple.

    has_link 'details' => (
        key   => 'x_dbic_link_id',
        type  => 'single',
        class => 'DBIC',
        args  => {class => 'AuctionHouseDetails'},
    );

COPYRIGHT & LICENSE

Copyright (C) 2011 OpusVL

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.