• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
OpenERP and Perl
 

OpenERP and Perl

on

  • 1,343 views

OpenERP is a very flexible open-source ERP system, which handles accounting, CRM, sales, purchasing, manufacturing, and many other business functions. ...

OpenERP is a very flexible open-source ERP system, which handles accounting, CRM, sales, purchasing, manufacturing, and many other business functions.

It is written in Python but has an XML-RPC API so we can control all of its functions from Perl. However, despite OpenERP having an object-oriented architecture the API is quite 'low-level', and using it is a very different experience compared to having an ORM like DBIx::Class.

OpenERP::OOM (Object to Object Mapper) bridges this gap, letting us use Moose classes to represent the OpenERP schema. As with an ORM, the schema and object classes can be extended with our own methods and functions.

With this approach the underlying interface to OpenERP becomes transparent - everything is done with Perl - which means we can write Catalyst models, extend OpenERP with CPAN modules, and use all of OpenERP's functions from our Perl code.

Presented at the YAPC Europe 2012 conference in Frankfurt, Germany.

Statistics

Views

Total Views
1,343
Views on SlideShare
1,335
Embed Views
8

Actions

Likes
0
Downloads
23
Comments
0

2 Embeds 8

https://twitter.com 7
http://www.slashdocs.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    OpenERP and Perl OpenERP and Perl Presentation Transcript

    • OpenERP and Perl Jon  Allen  (JJ)  –  jj@opusvl.com  
    • OpenERP www.opusvl.com!
    • enterprise" resource" planning www.opusvl.com!
    • ? www.opusvl.com!
    • core business" applications www.opusvl.com!
    • sales crm"manufacturing" purchasing www.opusvl.com!
    • accounting www.opusvl.com!
    • integratedaccounting www.opusvl.com!
    • www.opusvl.com!
    • Perl? www.opusvl.com!
    • OpenERPwebsite intranet www.opusvl.com!
    • api www.opusvl.com!
    • XML-RPC www.opusvl.com!
    • single"requests www.opusvl.com!
    • stateless www.opusvl.com!
    • object"model www.opusvl.com!
    • relationships www.opusvl.com!
    • res.partner.address one2manyres.partner many2one res.company www.opusvl.com!
    • database www.opusvl.com!
    • ORM www.opusvl.com!
    • object"relational" mapper www.opusvl.com!
    • OOM www.opusvl.com!
    • object to" object"mapper www.opusvl.com!
    • OpenERP::OOM www.opusvl.com!
    • Moose www.opusvl.com!
    • object model www.opusvl.com!
    • SchemaClass Class ClassObject Object OpenERP www.opusvl.com!
    • # Code layout for module using OpenERP::OOM lib/ MyApp.pm # Schema definition MyApp/ Class/ # Class definitions Company.pm Partner.pm Object/ # Object definitions Company.pm Partner.pm www.opusvl.com!
    • schema www.opusvl.com!
    • # MyApp.pm package MyApp; use Moose; extends OpenERP::OOM::Schema; 1; www.opusvl.com!
    • connection www.opusvl.com!
    • use MyApp; my $schema = MyApp->new( openerp_connect => { host => localhost, dbname => jj_test_1, username => admin, password => admin, }, ); www.opusvl.com!
    • classes www.opusvl.com!
    • # MyApp/Class/Company.pm package MyApp::Class::Company; use OpenERP::OOM::Class; object_type MyApp::Object::Company; # Class methods go here 1; www.opusvl.com!
    • objects www.opusvl.com!
    • fields www.opusvl.com!
    • relationships www.opusvl.com!
    • partner"has many"addresses www.opusvl.com!
    • package MyApp::Object::Partner; use OpenERP::OOM::Object; openerp_model res.partner; has name => (isa=>Str, is=>rw); relationship addresses => ( key => address, # OpenERP field type => one2many, # OpenERP type class => PartnerAddress, ); www.opusvl.com!
    • object "creation www.opusvl.com!
    • # Schema -> Class -> Class Method my $partner = $schema->class(Partner)-> create({ name => JJ }); # Updates $partner->update({name => Jon Allen}); say $partner->name; www.opusvl.com!
    • search www.opusvl.com!
    • # Single result my $jj = $schema->class(Partner)-> find([name => = => JJ]); # Multiple results my @partners = $schema->class(Partner)-> search([name => like => J]); www.opusvl.com!
    • related"objects www.opusvl.com!
    • $partner->create_related( addresses, { name => ..., street => ..., city => ..., } ); www.opusvl.com!
    • add"methods www.opusvl.com!
    • extendOpenERP objects www.opusvl.com!
    • external"data sources www.opusvl.com!
    • DBIx::Class www.opusvl.com!
    • not just" data www.opusvl.com!
    • OpenERP"methods www.opusvl.com!
    • workflows www.opusvl.com!
    • integrated"accounting www.opusvl.com!
    • my $po = $schema->class(PurchaseOrder)-> search([ ... ]); $po->update({ ... }); # Approve purchase order $po->execute_workflow(purchase_confirm); # Print (returns PDF) $po->get_report(purchase.order); www.opusvl.com!
    • applicationlogic = Perl www.opusvl.com!
    • application"data = DBIC www.opusvl.com!
    • generic logic "= OpenERP www.opusvl.com!
    • generic data "= OpenERP www.opusvl.com!
    • many uses www.opusvl.com!
    • Catalyst model www.opusvl.com!
    • 18 months"development www.opusvl.com!
    • 3 commercial"deployments www.opusvl.com!
    • open sourced" today www.opusvl.com!
    • http://search.cpan.org/ dist/OpenERP-OOM www.opusvl.com!
    • questions? www.opusvl.com!
    • www.opusvl.com!