NAME
OpenERP::OOM::Class
SYNOPSIS
package
Package::OpenERP::Class::Account;
use
5.010;
use
OpenERP::OOM::Class;
object_type
'Package::OpenERP::Object::Account'
;
around
'create'
=>
sub
{
my
(
$orig
,
$self
,
$object
) =
@_
;
# Make sure active is set to 1
$object
->{active} = 1;
# Create the object
return
$self
->
$orig
(
$object
);
};
sub
account_by_code
{
my
$self
=
shift
;
my
$code
=
shift
;
return
$self
->find([
'code'
,
'='
,
$code
]);
}
1;
DESCRIPTION
Use this module to create the 'classes' for your modules. It also implicitly loads Moose too. In addition to the Moose bindings it also ties up the class with a corresponding class for your individual objects using the object_type property.
METHODS
init_meta
This is in internal method that hooks up your class to inherit the class OpenERP::OOM::Class::Base
.
See the OpenERP::OOM::Class::Base
class for the methods your objects that use this class will automatically have available.
object_type
This links the class to the object class. When you create a new object using create or you are returned objects after doing a find or search they will be of the type specified.
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.