openerp 应用和开发基础 0.2 版) -...

Download OpenERP 应用和开发基础 0.2 版) - docs.huihoo.comdocs.huihoo.com/odoo/OSCG-OpenERP-App-Dev.pdf · 第三节 报表中文化 ... 始学习编程序,2002年当他还在Louvain-la-Neuve大学土木工程系学习时

If you can't read please download the document

Upload: duongkhuong

Post on 10-Feb-2018

259 views

Category:

Documents


13 download

TRANSCRIPT

  • OpenERP 0.2

    OSCG

    msn: [email protected]

    mail: [email protected]

    QQ: 1417063315

    2010 1 0.1 2010 3 0.2 2010 4

  • OpenERP ........................................................................................................................................ 1

    OpenERP ............................................................................................................................ 1 OpenERP ............................................................................................................................ 2

    OpenERP ............................................................................................................ 2 OpenERP ........................................................................................................ 3 PostgreSQL ............................................................................................................ 3

    OpenERP ............................................................................................................ 4 OpenERP .................................................................................................................... 4 OpenERP .................................................................................................................... 7

    OpenERP ........................................................................................................................ 7 ..................................................................................................................... 7 ..................................................................................................................... 9

    OpenERP .................................................................................................................. 12 ................................................................................................................................... 14

    ............................................................................................................................... 14 ............................................................................................................................... 15 ............................................................................................................... 16 ....................................................................................................................... 18

    OpenERP ...................................................................................................................... 19 ....................................................................................................................... 19

    ........................................................................................................................... 19 ................................................................................................................... 20 ................................................................................................................... 21 ........................................................................................................................... 22 ................................................................................................................... 22

    ............................................................................................................................... 23 ........................................................................................................................... 23 ........................................................................................................................... 26 ............................................................................................................... 27 ........................................................................................................... 28 ....................................................................................................................... 29 ........................................................................................................................... 30

    ............................................................................................................................... 30 ........................................................................................................................... 31 ....................................................................................................................... 31 Journal ........................................................................................................... 33 ................................................................................................................................... 34

    ............................................................................................................................... 36 OpenERP ..................................................................................................... 36 ....................................................................................................................... 37 ................................................................................................................... 38 stock_move ....................................................................................................... 39 Packing List ........................................................................................................... 40 ................................................................................................................................... 41

  • ................................................................................................................................... 42 ....................................................................................................................................... 42 ............................................................................................................................... 44

    ....................................................................................................................... 44 Journal ............................................................................................... 46

    ........................................................................................................... 47 ............................................................................................................................... 47

    ................................................................................................................................... 47 ........................................................................................................................... 49 ................................................................................................................................... 51 ........................................................................................................................... 52

    ............................................................................................................................... 53 ................................................................................................................................... 53 ................................................................................................................... 56 ........................................................................................................................... 58

    ............................................................................................................................... 58 OpenERP .................................................................................................................. 60

    ....................................................................................................................... 60 CSV ...................................................................................................................... 60

    ................................................................................................................................... 61 ................................................................................................................................... 62

    ....................................................................................................................... 64 ........................................................................................................................... 64 ........................................................................................................................... 65

    XML ..................................................................................................................... 68 XML ......................................................................................................................... 68 XML ......................................................................................................................... 69

    PostgreSQL .............................................................................................. 69 OpenERP .............................................................................................................................. 72

    ....................................................................................................................................... 72 ....................................................................................................................................... 74

    ....................................................................................................................... 74 ................................................................................................................................... 76 Action ............................................................................................ 77 ........................................................................................................................................... 79 ............................................................................................................................... 80

    ................................................................................................................................... 81 OpenERP ...................................................................................................................... 84

    Workflow .......................................................................................................... 84 ................................................................................................................................... 85

    ....................................................................................................................... 85 ....................................................................................................... 87 ............................................................................................................................... 91

    ................................................................................................................... 91 (Enterprise Process) ...................................................................................................... 93

    OpenERP .......................................................................................................................... 96

  • OpenERP .................................................................................................. 96 ........................................................................................................................... 96 XSL .................................................................................................................................. 97

    OpenERP ...................................................................................................................... 98 sxw odt ................................................................................................... 98 xsl+xml ........................................................................................................ 99

    ................................................................................................................. 100 ..................................................................................................................... 100 ......................................................................................................................... 101

    ..................................................................................................................................... 101 RML ...................................................................................................................... 101 XML .......................................................................................... 102 ......................................................................................................................................... 103

    Request,Sequence and Scheduler ........................................................................................................ 105 Request References ................................................................................................................ 105

    Request .................................................................................................................................... 105 References .............................................................................................................. 106

    Sequence ..................................................................................................................................... 107 Scheduler ..................................................................................................................................... 108

    OpenERP ........................................................................................................................ 110 OpenERP ............................................................................................................ 110 ..................................................................................................................... 111 OpenERP (Group) ............................................................................................... 114

    ..................................................................................................................... 114 ..................................................................................................................... 115

    Domain ................................................................................................................... 115 Domain ........................................................................................... 115 Domain ....................................................................................................... 116

    OpenERP ........................................................................................................................ 118 ............................................................................................................................. 118 ............................................................................................................................. 120 ................................................................................................................. 121 OpenERP ........................................................................................................ 124

    OpenERP ........................................................................................................................ 126 OpenERP .................................................................................................................... 126

    ......................................................................................................................... 126 ......................................................................................................................... 127

    OpenERP ............................................................................................................... 128 ................................................................................................................................. 128 ......................................................................................................... 130 ................................................................................................................. 131 ................................................................................................................................. 131

    (Server Action) ........................................................................................................ 131 Server Action ................................................................................................................. 131 OpenERP Mail ............................................................................................................... 132 Mail ........................................................................................................................ 133

  • Server Action ................................................................................................................. 134 ............................................................................................................................. 136 XML-RPC ................................................................................................................. 136

  • OpenERP

    1

    OpenERP

    OpenERP Python ERP CRM Java C/S B/S 100 /MRPCRM OpenERP 500

    OpenERP OpenERP OpenERP OpenERP ERP

    OpenERP

    OpenERP Fabien Pinckaers Fabien Pinckaers 30 13 2002 Louvain-la-Neuve Tiny Sprl Tiny Sprl 150 Louvain Catholic Fabien Pinckaers Tiny SPRL

    Tiny Sprl Tiny ERP OpenERPOpenERP Fabien Pinckaers

    2009 Tiny Sprl 75 100 Open Object Community 500 OpenERP /MRPCRMOpenERP ERP OpenERP

    2009 OpenERP 45 1000 2008 Tiny SPRL 2009 Tiny SPRL 10%2009 60 2009 300 2010 400 TrendsTiny Sprl 2011 1050

    OpenERP 2007 OpenERP http://www.shine-it.net/ OpenERP OpenERP HornERP http://code.google.com/p/hornerp/

  • OpenERP

    2

    OpenERP

    OpenERP

    OpenERP OpenERP PostgreSQL database server

    OpenERP OpenERP OpenERP HTML

    OpenERP CRUD Net-RPC XML-RPC CRUD CRUD

    GUI-ClientOpenERP GUI-Client GTK-Client GTK(Graphics Tools Kit) QT OpenERP OpenERP Client OpenERPXML GUI-Client Java .Net

    Web-Client HTML IEFirefox

  • OpenERP

    3

    Web-Client Web-Server Appache HTTP Server Internet Https

    OpenERP

    OpenERP OpenERP ERP

    OpenERP ORMObject Relation Mapping OpenERP

    CRUD BMDBase Module Distribution

    500 Report Engine PDFOpenOfficeHTML Workflow EngineOE XML

    WebService Net-RPCXML-RPC OpenERP http://doc.openerp.com/_images/pom_3_0_3.png

    PostgreSQL

    PostgreSQL POSTGRES 4.2 ORDBMSPostgreSQL PostgreSQL 2009 12 8.4.2http://www.postgresql.org/

    POSTGRES 1986 Michael Stonebraker DARPAARONSF ESL, Inc POSTGRES 1987 1988 ACM-SIGMOD

  • OpenERP

    4

    1989 6 1 1990 6 2 3 1991 Postgres95 1993 Postres Postres4.2

    POSTGRES POSTGRES Illustra Information Technologies Illustra Information Technologies ( Informix IBM ) Informix

    1994 Andrew Yu Jolly Chen POSTGRES SQL Postgres95 Postgres95 ANSI C Postres4.2 Postgres95 25%Postgres95 1.0.x Wisconsin Benchmark POSTGRES 4.2 30-50%

    1996 Postgres95 PostgreSQL 6.0PostgreSQL 8.4.2 PostgreSQL Affymetrix(www.affymetrix.com)

    Transcriptome PostgreSQL GeneChip RNA

    Afilias(www.nic.info) .INFO 900,000 PostgreSQL

    BASF(www.basf.com) PostgreSQL

    Cognitivity(http://www.cognitivity.com/) PostgreSQL

    Journyx(http://www.journyx.com) web PostgreSQL unix Linux, BSD, AIX, Solaris, MacOS X

    Royal Royal PostgreSQL The American Chemical Societywww.acs.org

    165,000 125 1T PostgreSQL PostgreSQL

    Tsutaya PostgreSQL G

    OpenERP

    OpenERP

    OpenERP http://www.openerp.com/discover/features.html Enterprise Modules * Sales * Purchase

  • OpenERP

    5

    * Services Management * Invoicing * Point of Sales Logistics * Warehouse Management * Shipping Management * Manufacturing * Quality & Repairs * Products and pricelists Accounting & Finance * Accounting * Analytic Accounting * Budgets * Payments Management * Asset Management * Bank interfaces Human Resources * Expenses * Skills Management * Holidays * Attendances CRM & SRM * Customer Relationship Mgt. * Mail Gateway * Portals * Direct Marketing * Phone Calls Project Management * Operational Management * Financial Management * Timesheets Daily Productivity * Integrated DMS * Outlook/Thunderbird * Getting Things Done * Calendars Efficient Communication * Wiki * Webmail

  • OpenERP

    6

    * Dashboards * Alerts Business Process Management * End-User Processes * Workflow Engine Association Management * Membership * Events Organization * Fund Raising IT CompaniesIT * Bug Tracker * Scrum Methodology Fully Customizable * Report Designer * View Editor * Workflow Editor * Configurable Actions Ergonomy * Web & Application Interfaces * Gantt & Calendars * Dynamic Graphs * Integrated Documentation Flexible * Modules System * Web-Services eCommerce * Integrated eCommerce * EDI Business Intelligence * Olap Database * Cube Designer * Data Browser Miscelleanous Tools * Networks * Ideas * Lunch * Voip

  • OpenERP

    7

    OpenERP

    OpenERP OpenERP 250 20 OpenERP ( ENA CEO

    ENA Bull OpenERP OpenERP 3 1500

    (CCIChambers of Commerce and Industry of Belgium)CCI SAPNavision OpenERP OpenERP OpenERP Action CCI 13 1 70

    (IFBL, Institut de Formation Bancaire Luxembourg), OpenERP 1 40 1000

    Medicalmedical OpenERP HISEMRhttp://medical.sourceforge.net/

    OpenERP

    OpenERP 1000 OpenERP 2 60 200

    OpenERP 3 17

    OpenERP

    OpenERP

    OpenERP ERP ERP ERP OpenERP

    MVC OpenERP MVC Model OpenERP Python Model

    class qingjia_qingjd(osv.osv): _name = 'qingjia.qingjd'

  • OpenERP

    8

    _description = '' _columns = { 'shenqr': fields.many2one('hr.employee', '', required=True), 'tians': fields.float('', required=True), 'kaisrq': fields.date('', required=True), 'shiyou': fields.text(''), 'active': fields.boolean(''), 'state': fields.selection([('draft',' '),('wait_prove',' '),('proved',' '),('rejected',' ')], ' ', required=True) } qingjia_qingjd() OpenERP CRUD Table InsertSelectDeleteUpdate OpenERP ViewOpenERP XML

    OpenERP XML

  • OpenERP

    9

    qingjia.qingjd tree OpenERP Action MVC CControllerOpenERP Action XML

    XML qingjia.qingjd [('shenqr.user_id','=',uid)]

    OpenERP XML OpenERP

  • OpenERP

    10

    OpenERP OpenERP

  • OpenERP

    11

    OpenERP PDF OpenOffice

    PDF

    OpenERP

  • OpenERP

    12

    OpenERP

    OpenERP

    ERP OpenERP OpenERP ERP 0 10% License20 30% 50% -- 70% 10% OpenERP

    2030% OpenERP ERP OpenERP

    OpenERP OpenERP OpenERP Python OpenERP Python ERP Python Java 510 OpenERP Java ERP 1/5 1/10 ERP

    OpenERP 500 1000

    OpenERP OpenERP 2002 8 20 1500

  • OpenERP

    13

    Python Java http://www.developertutorials.com/tutorials/python/python-and-java-a-side-by-side-comparison-8-01-13/pag

    e1.html

  • OpenERP

    14

    purchasing

    1

    MRP 2 MRO

    ERP MRP

    OpenERP MRP MRP

    / PO

    OpenERP

    Procurement Orders

    BOM

    Email

    2

  • OpenERP

    15

    InvoiceIncoming Packing List

    OpenERP Reconcile

    OpenERP

    (1)(2)(3)

    (4) ERP CRM

    (1)(2)(3)(4) ERP CRM ERP

    ERP ERP POSPoint Of Sale

    CRM

    OpenERP Email

  • OpenERP

    16

    Customer Invoice

    Product Order

    XML

    A 100

  • OpenERP

    17

    1500 17 : 1402 150000 2015 - 201501 () 25500

    :2011 - 201101 175500 : 1036 150000

    : 1402 150000

    : 2011 - 201101 175500

    :1002 175500

    OpenERP

    InvoiceReconcile

    A 10 2000 :1014 - 101401 21700

    : 6001 20000 2015 - 201501 () 1700

    OpenERP : 6015 15000

    : 1036 15000 : 1002 21700

    : 1014 - 101401 21700

    OpenERP

    InvoiceReconcile ERP Chart Of Account

    1001 1002 1036

  • OpenERP

    18

    1014 101401 2011 201101 2015 201501 () 201502 () 6001

    OpenERP

    Warehouse Management WM

    Inventory Management

    Location

  • OpenERP

    19

    OpenERP

    OpenERP 5.07 HornERPhttp://code.google.com/p/hornerp/ 5.06

    OpenERP base_contact

    res_partner

  • OpenERP

    20

    res_partner_address res_partner res_partner_address One2Many

    OpenERP

    OpenERP

    General Customer Supplier TitleConfiguration

    Language TypeConfiguration FunctionConfiguration Address Type 5 (default,Default)

    (invoice,Invoice)(delivery,Delivery)(contact,Contact)(other,Other)DefaultInvoiceDeliveryContactOther

    CategoriesConfiguration

  • OpenERP

    21

    Sales & Purchases

  • OpenERP

    22

    Dedicated Salesman Main Company Sale Pricelist

    8.5 6

    Purchase Pricelist

    Customer LocationOpenERP Location

    Supplier Location

    Email OpenERPEvent

    Date Events State Of MindConfiguration Partner Relation User

    Account Receivable1014

  • OpenERP

    23

    1014

    Account Payable2011

    Fiscal Position

    Fiscal Position

    Payment Term 30 10 30%20 30% 2

    Total Receivable Total Payable Credit Limit Bank Details

    Configure Sale Order Logistic Packing Default Policy: Direct DeliverryAll at Once

    Direct Deliverry All at Once

  • OpenERP

    24

    Shipping Default Policy: Invoice Based on DeliveriesInvoice Based on Sales Orders

    Steps To Deliver a Sale Order: Delivery Order OnlyPacking List & Delivery Order

    By default, Open ERP is able to manage complex routing and paths of products in your warehouse and partner locations. This will configure the most common and simple methods to deliver products to the customer in one or two operations by the worker.

    Products Configuration Units of Measure Units of Measure

    Name UoM CategoryPCB

    Products Configuration Units of Measure Units of Measure Categories

    Factor Rate1 = 1 * factor 1 =40 factor=1 factor=40Rate1/Factor

    Rounding Precision

    Pricelist Products Pricelists Pricelists

  • OpenERP

    25

    Starte Date End Date Products Listprices Items

    Sequence

    Rules Test Match

    AND Product Product TemplateProduct Product Template

    Product Category Min. Quantity Sequence Price Computation Based on Public PriceCost PriceOther PricelistPartner section of the product form

    Other Pricelist

  • OpenERP

    26

    Partner section of the product form Supplier Information

    New Price New Price = Base Price * ( 1 + X ) + Y Rounding Method 0.05

    45.66 45.65 100 14567 14600 Min. Margin Max. Margin min=10, Max=50, Base Price + 10

    < New Price < Base Price + 50

    Can be sold: Can be Purchased: Rentable Product: Variants: EAN13: Product Type: Stockable ProductConsumableServiceStockable Product

    Consumable Service

    Procure Method: Make to StockMake to Order BOM Supply Method Service Make to Order Task BOM WBS

    Supply method: ProduceBuy

    Weigths: Category: Configuration Status: In DevelopmentIn ProductionEnd of LifecycleObsolete

    Product Manager:

  • OpenERP

    27

    Real Stock: Virtual Stock:

    N

    Lots:

    UOM: ConfigurationOpenERP

    Customer Lead Time:

    Manufacturing Lead Time:

  • OpenERP

    28

    Warranty (months): Storage Localisation: Procurement Location:

    Production Location:

    Inventory Location:

    Cost Price: Costing Method: Standard Price Average Price Sale Price: Variant Price Margin: Variant Price Extra:

    =Sale Price * Variant Price Margin + Variant Price Extra

  • OpenERP

    29

    Supplier Information:

    Partner PriorityProirity Partner Product Name Partner Product Code Delivery Delay Minimal Quantity Quantity Unit Price

    DescriptionSale DescriptionPurchase Description

  • OpenERP

    30

    Income Account: 6001

    Expense Account: 1042

    Stock Output Account: 6015 1036

    Stock Input Account: 1042 1036

    Sale Taxes: Purchase Taxes:

    OpenERP Fiscal Years 1 1 12 31

    Periods 1 Chart Of Account

    Journal OpenERP

    Sale Journal Journal

  • OpenERP

    31

    TaxOpenERP

    Payment Terms 30 OpenERP

    Fiscal Positions

    account module Create a Fiscal Year Charts of Account None

    Account TypeOpenERP Configuration Financial Accounting Financial Accounts Account Types

    Acc.Type Name: Code: Sequence: Sign on Report: Deferral Method: None

  • OpenERP

    32

    BalanceDetailUnreconciled NoneUnreconciled

    Partner account: OpenERP

    Configuration Financial Accounting Financial Accounts List of Accounts Parent: Account Type: Internal Type: ReceivablePayableViewConsilidation

    OthersClosed ReceivablePayableView ViewView

    Reconcile:

    Display History: Default Taxes: Consolidated Children: Consilidation

  • OpenERP

    33

    Journal

    Configuration Financial Accounting Financial Journals Type: SalePurchaseCashGerneralSituation

    Sale

    View:

    Entry Sequence:

    Entry SequenceEntry Sequence Invoice Sequence:

  • OpenERP

    34

    Default Debit Account:

    Default Credit Account:

    Entry Controls:

    Financial Management --> Configuration --> Financial Accounting --> Taxes --> Taxes

  • OpenERP

    35

    Tax Name : a unique name required for this tax (such as 12% Sales VAT ), Company : a required link to a company associated with the tax, such as the Main Company, Tax Group : VAT or Other , used to determine which taxes on products can be substituted by taxes on

    partners, Tax Type : a required field directing how to calculate the tax: Percent , ``Fixed`` , None or Python Code ,

    (the latter is found in the Compute Code field in the Special Computation tab), Applicable Type : a required field that indicates whether the base amount should be used unchanged (when

    the value is True ) or whether it should be processed by Python Code in the Applicable Code field in the Special Computation tab when the value is Code ),

    Amount : a required field whose meaning depends on the Tax Type, being a multiplier on the base amount when the Tax Type is Percent , and a fixed amount added to the base amount when the Tax Type is Fixed ,

    Include in base amount : when checked, the tax is added to the base amount and not shown separately, Domain : is only used in special developments, not in the core Open ERP system, Invoice Tax Account :a General Account used to record invoiced tax amounts, which may be the same for

    several taxes or split so that one tax is allocated to one account, Refund Tax Account : a General Account used to record invoiced tax refunds, which may be the same as

    the Invoice Tax Account or, in some tax jurisdictions, must be separated, Tax on Children : when checked, the tax calculation is applied to the output from other tax calculations

    specified in the Childs Tax Account field (so you can have taxes on taxes), otherwise the calculation is applied to the base amount on the transaction,

    Tax included in Price : when checked, the total value shown includes this tax, Tax Application : selects whether the tax is applicable to Sale, Purchase or All transactions, Child Tax Accounts : other tax accounts that can be used to supply the figure for taxationYou can use child

    taxes when you have a complex tax situation that you want to hide your end users from. For example, you might define a motor mileage expenses product with a composite tax made up of two child taxes a non-reclaimable private element and a reclaimable business element (which is the case in some European

  • OpenERP

    36

    countries).When your staff come to claim motor mileage, they do not need to know about this taxation, but the accounting impact of their claim will be automatically managed in Open ERP.

    The fields above apply the taxes that you specify and record them in the general accounts but dont provide you with the documentation that your tax authorities might need. For this use the Tax Declaration tab to define which Tax Cases should be used for this tax: Invoices/Base Code : tax case to record the invoiced amount that the tax is based on, Invoices/Tax Code : tax case to record the invoiced tax amount Credit Notes/Refund Base Code : tax case to record the refund invoice amount that the tax is based on, Credit Notes/Refund Tax Code : tax case to record the refund invoice tax amount.

    OpenERP

    OpenERP OpenERP OE stock_move stock_move or stock_move Move move OpenERP SupplierCustomerProduction Supplier Location Customer Location Production LocationProduction Location Inventory loss Loction

    Stock Properties Supplier Location Customer LocationSupplier LocationCustomer Location Counter-Part Locations Properties Production Location Inventory loss LoctionProduction LocationInventory loss Loction

    OpenERP virtual stock, futurestock real stock 2 10 5 100 5 Warehouse LocationWarehouse Location OpenERP Warehouse Location

    OpenERP

  • OpenERP

    37

    OpenERP

    Stock Management Configuration Locations

    Location Type: (supplier,Supplier Location)(view,View)(internal,Internal

    Location) (customer,Customer Location) (inventory,Inventory) (procurement,Procurement) (production,Production)Supplier LocationCustomer Location Stock Properties View Internal Location Inventory Inventory Location

  • OpenERP

    38

    Inventory LocationProduction Procurement Counter-Part Locations Properties Procurement

    Inventory Account: 1036

    Parent Location: Location Address: Icon: Chained Location Type: (none,None)(customer,Customer)(fixed,Fixed

    Location)None Fixed Chained Location If Fixed Customer Customer Location

    Chained Location If Fixed: Automatic Move: ('auto', 'Automatic Move'), ('manual',

    'Manual Operation'), ('transparent', 'Automatic No Step Added')Automatic MoveManual OperationAutomatic No Step Added

    Chained Delay (days): Localisation:

    Stock Management Configuration Warehouse

    Stock Management Automatic Procurements Minimum Stock Rules Name: OPOrder Point Location: Product: OpenERP Min Quantity:

    Max Quantity: Qty Multiple: Max Quantity

    13Qty Multiple 5 15Qty Multiple Purchase Order:

  • OpenERP

    39

    stock_move

    Stock Management Traceability Low Level Stock Moves

    Source Location Dest. Location Product Date Packing List Production Lot Tracking Lot

  • OpenERP

    40

    Splite in production lots

    Status ('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Canceled')

    Packing List

    OpenERP Packing List stock_picking Packing List stock_move Stock Management Traceability Low Level Packing

    Partner Shipping Type('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery',

    'Delivery') Reference Date Order Planned Date Moves Split move lines in two Status('draft', 'Draft'), ('auto', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'),

    ('done', 'Done'), ('cancel', 'Canceled') Validate'Available' Done Create invoice Actions Return packing Actions

  • OpenERP

    41

    Stock Management Periodical Inventory OpenERP

    Stock Inventory Lines Fill Inventory Action Set Stock to 0 Action Fill Inventory Confirm Inventory

  • OpenERP

    42

    A OpenERP

    Journal A

    (the product module), (the stock module), (the account module), (the purchase module), (the sale module). account module sale module

  • OpenERP

    43

    Minimal Profile

    account

    Administration Modules Management Modules Uninstalled modulesaccountSchedule for InstallationApply Scheduled Upgrades account Start UpgradeStart configurationChart of Account None

    sale Sale sale Shipping Default Policy Invoice Based on Deliveries

  • OpenERP

    44

    Journal

    Financial Management Configuration Financial Accounting Financial Accounts

    Account Types

  • OpenERP

    45

    Acc. Type Name Code

    Deferral Method Partner account Sequence

    Sign on Reports

    view none FALSE 5 Positive income unreconciled FALSE 5 Positive expense unreconciled FALSE 5 Positive cash balance FALSE 5 Positive other none FALSE 5 Positive

    Financial Management Configuration Financial Accounting Financial Accounts List of Accounts

    Code Name Account

    Type Parent Internal

    Type Reconci

    le 0 view 1001 0 other 1002 0 other 1036 0 other 1014 0 view 101401 1014 receivable 101402 1014 receivable 2011 0 view 201101 2011 payable 201102 2011 payable 2015 0 view 201501 () 2015 other 201502 () 2015 other 6001 0 other

    Financial Management Configuration Financial Accounting Financial Accounts Chart of Accounts

  • OpenERP

    46

    Journal

    Financial Management Configuration Financial Accounting Financial Journals

    Journal Name Code Type View

    Entry Sequence

    Default Debit

    Account

    Default Credit

    Account

    PUJ Purchase Journal View Account Journal

    SAL Sale Journal View Account Journal

    CASH Cash Cash Journal View

    Account Journal

    Financial Management Configuration Financial Accounting Taxes Taxes

    Tax Name Amount Invoice Tax Account Tax Application () 0.17 201501 () Sale () 0.17 201502 () Purchase

  • OpenERP

    47

    Partners Partners

    Name Customer

    Supplier

    Contact Name

    Address Type Street

    Account Receivable

    Account Payable

    Default

    68 101401

    201102

    Default

    101402

    201101

    Products Configuration Products Categories A Products Products A NameA Code001 Category Income Account6001 Expense Account1036 Sale Taxes() Purchase Taxes()

    Purchase Management New Purchase Order A 100 Purchase Order Lines

    Compute

    A 17 Confirm Purchase Order

    Approved by Supplier

    Received Packing List

    Invoiced&Paid(Recocile) Invoicing Control Delivery & Invoices Tab Invoicing Control

    From Order a draft invoice will be pre-generated based on the purchase order. The accountant will just

  • OpenERP

    48

    have to validate this invoice for control. From Pickinga draft invoice will be pre-genearted based on validated receptions. Manualno invoice will be pre-generated. The accountant will have to encode manually. 5.06 From Order Approved by Supplier From Picking Create Invoice Manual OE

    Invoice Delivery & Invoices Tab

    (Order Status) ('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Confirmed'), ('approved', 'Approved'), ('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled') draft wait confirmed approved done Packing List Done/ cancel except_picking except_invoice

    Products Products A A Real Stock Virtual Stock 100

  • OpenERP

    49

    Financial Management Invoices Supplier Invoices Invoice Address Account Payable201101

    Expense Account1036 Taxes() Validate

    Total Payable

    117.00

  • OpenERP

    50

    Financial Management Entries Encoding Entries Encoding by

    Line 1036 100 2015 - 201501 () 17

    2011 - 201101 117

  • OpenERP

    51

    Financial Management Entries Encoding Entries by Statements New Statement

    Starting Balance Ending Balance Statement lines Type SupplierPartner

    Amount Reconcile Invoiced & Paid Check

    BalanceComputeStarting Balance/Statement lines

  • OpenERP

    52

    ConfirmEnding BalanceBalance

    Confirm1002 Journal

    : 2011 - 201101 117.00 :1002 117.00

    Stock Management Incoming Products

    Products Received

    100

  • OpenERP

    53

    Unreceived Products

    Origin Reference Packing List

    Invoice Control Packing List Not from Packingto be invoiceInvoiced Not from Packing Packing List to be invoice Packing List Create InvoiceInvoiced

    Back Order Packing List 10 6 OE Packing List 6 4 Back Order Packing List Back Order

    A A Real Stock Virtual Stock 100

    Sales Management Sales Orders New Quotation A 50

  • OpenERP

    54

    Confirm Order

    Create Invoice Picked Packing List Paid(Recocile) (Order Status)

    ('draft', 'Quotation'), ('waiting_date', 'Waiting Schedule'), ('manual', 'Manual In Progress'), ('progress', 'In Progress'), ('shipping_except', 'Shipping Exception'), ('invoice_except', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled') draft waiting_date manual progress done cancel shipping_except invoice_except

  • OpenERP

    55

    History

    Packing PolicyOther Data Partial DeliveryComplete Delivery

    (Packing List)

    Shipping Policy Payment before deliveryInvoice on Order After DeliveryShipping & Manual Invoice

    Invoice from the Packing Payment before delivery : Open ERP creates an invoice in the Draft state. Once this is confirmed and paid the delivery is activated. Invoice on Order After Delivery : the delivery order is produced when the order is validated. A draft invoice is then created when the delivery has been completed. Shipping & Manual Invoice : Open ERP starts the delivery from the confirmation of the order, and adds a button which you manually click when youre ready to create an invoice. Invoice from the Packing : invoices are created from the packing stage.

    Invoice on Ordered QuanlitiesShipped Quantities

    IncotermINCOTERMS International Commercial Terms INCOTERMS 2000

    2000 1 1 INCOTERMS 2000INCOTERMS 1990INCOTERMS 2000"2000 " 13 13 E F C D E EXW Ex Works F FCA Free Carrier

  • OpenERP

    56

    FAS Alongside Ship FOB Free On Board C CFR Cost and Freight CIF Cost Insurance and Freight CPT Carriage Paid To CIP Carriage and Insurance Paid To D ( ) DAF Delivered At Frontier DES Delivered Ex Ship DEQ Delivered Ex Quay DDU Delivered Duty Unpaid DDP Delivered Duty Paid

    Financial Management Invoices Customer Invoices

  • OpenERP

    57

    Create :1014 - 101401 58.50

    : 6001 50 2015 - 201501 () 8.5

  • OpenERP

    58

    Stock Management Outgoing Products

    Check Availability

    Force Availability

    Financial Management Legal Statements Generic Reports Account Balance General Ledger Print Journal Print Central Journal Print General Journal Account Balance

  • OpenERP

    59

    General LedgerDisplay History

    Print Journal

  • OpenERP

    60

    OpenERP

    OpenERP CSV XML PostgreSQL COPY OpenERP XML-RPC SQL

    databasename.dump

    CSV

    OpenERP CSV / Web-Client

  • OpenERP

    61

    |GUI-Client OpenERP 5.06 Web-Client GUI-Client

    Partner Partner -->

    ID ID ID xxx_data.xml

    CSV ID CSV ID CSV ID Categories/IDid

    Database ID ID

  • OpenERP

    62

    Categories/Database ID Database ID Database ID ID db_id

    Excel CSV CSV CSV UTF-8 Excel Word Word xxx.csv Excel

    Import Compatible

    CategoriesCategories ID Database ID

    80 5.06 80 GUI-Client limit limit 80Web-Client 5.07

    Name,Country/ID,Country/Database ID,Country/Country Name,Categories/Database ID,Categories/Full Name,Customer ,base.cn,46,,,,True ,base.cn,46,,,,True () ,base.cn,46,,4,,False ,,,,3,, base.cnBase IDcn 46 ID

    OpenERP OpenERP OpenERP CSV Table UTF-8 CSV Excel CSV UEEmEditor UTF-8

    CSV

  • OpenERP

    63

    CSV

    ID,Name,Country/ID,Categories/Database ID,Customer,Contacts/Contact Name id,name,country:id,category_id:db_id,customer,address/name partner_001,,base.cn,"3,4",True, ,,,,,

    Table ID ID ID

    ID partner_001ID .

    country:id country:db_id Country id db_id IDbase.cn ID ID ID ID db_id

    category_id:db_idcategory_id db_id Database ID ID"3,4"

    address/name name address

    --> CSV

  • OpenERP

    64

    CSV

    CSV OpenERP

    1) Excel 2) CSV 3) 4) Excel 5) CSV 6)

    Chart of Account

    1) Acc. Type Name

    Code Deferral Method Partner account Sequence

    Sign on Reports

    view None FALSE 5 1

  • OpenERP

    65

    income unreconciled FALSE 5 1 expense unreconciled FALSE 5 1 cash Balance FALSE 5 1 other None FALSE 5 1

    2) CSV

    Acc. Type Name

    Code Deferral Method Partner account Sequence

    Sign on Reports

    id name code close_method partner_account sequence sign

    myacc_type_view view none FALSE 5 1 myacc_type_income income unreconciled FALSE 5 1 myacc_type_expense expense unreconciled FALSE 5 1 myacc_type_cash cash balance FALSE 5 1 myacc_type_other other none FALSE 5 1

    idid

    3) CSV CSV CSV utf-8 CSV id,name,code,close_method,partner_account,sequence,sign myacc_type_view,,view,none,FALSE,5,1 myacc_type_income,,income,unreconciled,FALSE,5,1 myacc_type_expense,,expense,unreconciled,FALSE,5,1 myacc_type_cash,,cash,balance,FALSE,5,1 myacc_type_other,,other,none,FALSE,5,1

    1

    Code Name Account Type Company

    Outgoing Currencie

    s Rate Internal

    Type Reconcil

    e 0 current View 1001 current Others 1002 current Others 1036 current Others 1014 current View 10140 current Recievable

  • OpenERP

    66

    1

    101402

    current Recievable

    2011 current View

    201101

    current Payable

    201102

    current

    Payable

    2015 current View

    201501 ()

    current

    Others

    201502 ()

    current

    Others

    6001 current Others 2) CSV

    Code Name

    Account Type

    Company

    Outgoing Currencies

    Rate

    Internal

    Type Reconci

    le

    id code name user_type:id

    parent_id:id

    company_id:db

    _id currency_

    mode type reconcil

    e myacc_0 0

    myacc_type_view 1 current view FALSE

    myacc_1001 1001

    myacc_type_cash

    myacc_0 1 current Other FALSE

    myacc_1002 1002

    myacc_type_cash

    myacc_0 1 current Other FALSE

    myacc_1036 1036

    myacc_type_other

    myacc_0 1 current Other FALSE

    myacc_1014 1014

    myacc_type_income

    myacc_0 1 current

    View FALSE

    myacc_101401 101401

    myacc_type_income

    myacc_1014

    1 current

    receivable TRUE

    myacc_101402 101402

    myacc_type_income

    myacc_1014

    1 current

    receivable TRUE

    myacc_2011 2011

    myacc_type_expense

    myacc_0 1 current

    view FALSE

    myacc_201101 201101

    myacc_type_expense

    myacc_2011

    1 current

    payable TRUE

    myacc_2011 201102

    myacc_type_expense

    myacc_2011 1 current

    payable

    TRUE

  • OpenERP

    67

    02

    myacc_2015 2015

    myacc_type_other

    myacc_0 1 current view FALSE

    myacc_201501 201501

    ()

    myacc_type_other

    myacc_2015 1 current

    other FALSE

    myacc_201502 201502

    ()

    myacc_type_other

    myacc_2015 1 current

    Other FALSE

    myacc_6001 6001

    myacc_type_other

    myacc_0 1 current other FALSE

    ID idDatabase ID db_id Account Type user_type ID user_type:id Company company_id Database ID

    company_id:db_id Internal Type

    3) CSV id,code,name,user_type:id,parent_id:id,company_id:db_id,currency_mode,type,reconcile myacc_0,0,,myacc_type_view,,1,current,view,FALSE myacc_1001,1001,,myacc_type_cash,myacc_0,1,current,other,FALSE myacc_1002,1002,,myacc_type_cash,myacc_0,1,current,other,FALSE myacc_1036,1036,,myacc_type_other,myacc_0,1,current,other,FALSE myacc_1014,1014,,myacc_type_income,myacc_0,1,current,view,FALSE myacc_101401,101401,,myacc_type_income,myacc_1014,1,current,receivable,TRUE myacc_101402,101402,,myacc_type_income,myacc_1014,1,current,receivable,TRUE myacc_2011,2011,,myacc_type_expense,myacc_0,1,current,view,FALSE myacc_201101,201101,,myacc_type_expense,myacc_2011,1,current,payable,TRUE myacc_201102,201102,,myacc_type_expense,myacc_2011,1,current,payable,TRUE myacc_2015,2015,,myacc_type_other,myacc_0,1,current,view,FALSE myacc_201501,201501,(),myacc_type_other,myacc_2015,1,current,other,FALSE myacc_201502,201502,(),myacc_type_other,myacc_2015,1,current,other,FALSE myacc_6001,6001,,myacc_type_other,myacc_0,1,current,other,FALSE

  • OpenERP

    68

    XML

    OpenERP x_data.xml x_demo.xml OpenERP xml

    XML

    06229 cs123 zh_CN Asia/Chongqing

    xml OpenERP 06229cs123base.group_user cshaocai.group_haocaiuser data data recordnoupdate

    demo noupdate="1" noupdate noupdate=0

    record record fieldmodel="res.users" res_users res_usersid="user_06229" id id

    field field name, eval, ref, search 06229 login 06229name 0622906229eval eval 3+5 ref many2one one2many ref ref="base.action_menu_admin"base id=action_menu_admin record record base base_data.xml many2one one2many base.group_user cshaocai.group_haocaiuser idbase.group_userEmployee search res.groups (model="res.groups") name='Employee'"groups_id"

  • OpenERP

    69

    XML

    OpenERP Action base_module_record Administration Customization Module Creation

    Start Recording, Stop Recording, Save Recorded Module Start Recording Stop RecordingSave Recorded Module XML

    Export Customizations As a Module Start Recording Export Customizations As a Module Export Customizations As a Module

    OpenERP XML XML

    PostgreSQL

    CSV

    PostgreSQL PostgreSQL COPY COPY COPY tablename [ ( column [, ...] ) ] FROM { 'filename' | STDIN } [ [ WITH ] [ BINARY ] [ OIDS ] [ DELIMITER [ AS ] 'delimiter' ] [ NULL [ AS ] 'null string' ] ] COPY tablename [ ( column [, ...] ) ] TO { 'filename' | STDOUT } [ [ WITH ] [ BINARY ] [ OIDS ] [ DELIMITER [ AS ] 'delimiter' ] [ NULL [ AS ] 'null string' ] ]

  • OpenERP

    70

    COPY Windows psql LinuxPostgreSQL sourceforgehttp://psql.sf.net/PostgreSQL Frontend

    COPY OpenERP Stock Management Periodical Inventory OpenERP OpenERP Stock Inventory Lines stock_inventory_line GUI Client Web Client Import/Export 5.06 Import Stock Management Periodical Inventory New Periodical

    Inventory

    PostgreSQL Frontend psql dbname dbuser D:\work>psql case1 openpg Password: Welcome to psql 7.4.6, the PostgreSQL interactive terminal. case1 openpg OpenERP passwordOpenERP

    openpgpwd

    case1=# copy stock_inventory_line to 'd://work//a11.csv' delimiter as ','; COPY 1 case1=# stock_inventory_line d://work//a11.csv1) 2COPY PostgreSQL Windows PostgreSQL .\openpgsvc administrators

    id,create_uid,create_date,write_date,write_uid,inventory_id,location_id,product_id,product_uom,product_qty 1,1,2010-04-10 21:58:16.296,\N,\N,3,11,3,1,5 inventory_id Database IDlocation_id product_id product_uom product_qty

    Excel CSV inventory_id=3

    inventory_id,location_id,product_id,product_uom,product_qty,create_uid,create_date 3,11,3,1,10,1,2010-04-10 Fill Inventory Set Stock to 0 0 stock_inventory_line

  • OpenERP

    71

    CSV UTF-8

    case1=# copy stock_inventory_line (inventory_id,location_id,product_id,product_uom,product_qty,write_uid,create_date) from 'd://work//a11.csv' delimiter as ',';

  • OpenERP

    72

    OpenERP

    OpenERP OpenERP

    OpenERP OpenERP OpenERP

    OpenERP OpenERP ViewTree ViewForm ViewOpenERP Object ModelClassres.partnerres_partnerResource

    -1

  • OpenERP

    73

    -2

    Action Action Action ActionAction Search Action OpenERP Object or Model Python Class

    Record SearchReadWrite OpenERP

    def _get_admin_id(self, cr): if self.__admin_ids.get(cr.dbname) is None: ir_model_data_obj = self.pool.get('ir.model.data') mdid = ir_model_data_obj._get_id(cr, 1, 'base', 'user_root') self.__admin_ids[cr.dbname] = ir_model_data_obj.read(cr, 1, [mdid], ['res_id'])[0]['res_id'] return self.__admin_ids[cr.dbname]

    server\addons\base\res\ res_user.py'ir.model.data' ir_model_data_get_id admin user_id admin user id

    View

    Menu Action

    Action Action Action Action

  • OpenERP

    74

    Act_Window ReportWizard

    -3

    ( account.invoice) 1) ActionAction account.invoice (Action (Domain,

    )) 2) ( XML-RPC ) 3)

    (Action)

    Menu Action Object View

    Search

  • OpenERP

    75

    x_qingjd x_shenqrx_tiansx_kaisrqx_shiyou x_

    -4

    -5

    TODO

  • OpenERP

    76

    x_qingjd 1Action

    select=1

    -6 x_qingjd 2

  • OpenERP

    77

    -7

    Action

    Action Action (group)

  • OpenERP

    78

    -8

    Action Action

    -9

    Action

    Action Action

  • OpenERP

    79

    x_qingjd Action Action x_qingjd

    TODO Action

    -10 Action

    -11

  • OpenERP

    80

    -12

    -13

    OpenERP XML OpenERP [] Action

  • OpenERP

    81

    -14 x_shenqr

    -15

    TODO

    OpenERP OpenERP x_qingjd OpenERP x_qingjd

  • OpenERP

    82

    x_qingjd Table

    x_qingjd ir_model ir_model_fieldsir_model_fields model_id ir_model ir_model Table

    ir_model_fields Table

    ir_ui_view arch XML ir_ui_view Table

    ir_uimenu ir_ui_menu Table

    Action ir_act_windowir_act_window_viewir_values Action ir_act_window res_model Action Action ir_act_window_view ir_values ir_act_window Table

    ir_values Table

  • OpenERP

    83

    Action ir_values ir_values model res_id Action ir_ui_menu id=104 value Action value=ir.action.act_window,93 ir_action_act_window id=93 Action Action OpenERP 1) ir_ui_menu 2) ir_values Action 3) ir_act_window ir_act_window_view Action 4) ir_model ir_model_fields ( x_qingjd) SQL 5) ir_ui_view XML XML 6)

    OpenERP Action

  • OpenERP

    84

    OpenERP

    Workflow

    A B

    (workflow) 1) 2) 3) 4)

    Activity

    -1

    -2

    Transitions

    3 Outgoing transitionsIncoming transitions A B A B TriggerConditionRole A B

  • OpenERP

    85

    OpenERP

    Activity Activity DraftWaiting ProveProvedRejected Activity NewTo ProveProveReject

    XML XML

    process

    x_state

    x_state x_state selectionselection Field Selection Field Selection[('draft',''),('wait_prove',''),('proved',''),('rejected','')]

    'draft', 'wait_prove', 'proved', 'rejected' '', '', '', ''

  • OpenERP

    86

    -3

    state

    OpenERP state

    x_state 1 2, ,

    separator, group button states states=draft,wait_prove draftwait_prove

  • OpenERP

    87

    -4

    x_qingjd on_create

    Truewkf_instance

    draft, wait_prove, proved, rejected,

    XML

    workflow.name resource.model True | False

  • OpenERP

    88

    -5

    Dummy, Function, Subflow, Stop All Function

    Dummy Python Function Python Subflow Activity Stop All

    Python Activity PythonPython Python Mail Mail

    Python Function Activity write write OpenERP OpenERP

    Activity (Subflow) idActivity Activity Python (Purchase Order Basic Workflow) Picking (account.invoice)(account.invoice.basic)Activity (Subflow)PythonPython id

    subflow.* * Activity

  • OpenERP

    89

    draft proved rejected XORORAND XORXOR

    OR AND XOR OR AND

    XORAND XORXOR ActionAND Action

    OpenERP Webclient Bug

    -6

    Activity XML

    activity.name:: XOR | OR | AND XOR | AND dummy | function | subflow | stopall (...) (...) True | False True | False

    draft wait_prove, wait_prove proved,

  • OpenERP

    90

    wait_prove rejected

    -7

    True'hello' in ['hello','bye']zip==1400phone==mobile button name

    [move_id.id] move_line_id_payment_get() id id id TrueDone

    -8

    XML

    (...)

  • OpenERP

    91

    (...) (...) (...)

    separator

    Python

    -9

    Sale Order OpenERP draftConfirmInvoice

    Customise Manage Workflows

    sale.order.basic server\addons\sale\sale_workflow.xml sale.order.basic server\addons\sale\sale.py Action

  • OpenERP

    92

    server\addons\mrp\mrp_workflow.xml mrp.procurement.basic server\addons\mrp\mrp.pymrp_procurement Action

    1) draft CancelCancel

    Confirmrouter 2) router OR

    trans_router_wait_invoice trans_router_wait_ship wait_invoice wait_ship

    3) wait_ship Cancel ship (order_policy!='prepaid') or invoiced (order_policy!='prepaid') or invoiced wait_ship ship

    4) ship mrp.procurement procurement_lines_get() test_state('finished')

  • OpenERP

    93

    test_state('canceled') ship XOR trigger_model trigger_expr_id procurement_lines_get()sale.py procurement procurement_id act_ship action action_ship_create mrp_procurement act_ship_end trans_ship_ship_except act_ship_except

    (Enterprise Process)

    OpenERP (Process) Workflow

    (Process)

  • OpenERP

    94

    -10

  • OpenERP

    95

    OpenERP

    ActionObject

    Help URL Open Print

    Print Workflow

    Workflow

    Wizard

  • OpenERP

    96

    OpenERP

    OpenERP

    OpenERP RML XSLT+XML RML RML RML HTML RML RML PDF XSLT+XML OpenERP XSLT+XML RML PDF XSLT+XML RML PDF source/ch03 xsl2rml.py rml2pdf.py

    xsl2rml.py rml2pdf.py Python 1) Python

    OpenERP Python 3.0 2.6.2 2.5.x 2.5.x 2.5

    2) python pdf PDF RML PDF PIL-1.1.6.win32-py2.6.exe reportlab-2.3.win32-py2.6.exe

    3) python xslt xml xslt xml xsl2rml.py libxml2-python-2.7.4.win32-py2.6.exe lxml-2.2.2.win32-py2.6.exe

    xsl2rml.py rml2pdf.py xsl2rml.py rml2pdf.py source/ch03 xslrml

    1) Xsl + xml => rml, XSL cd source\ch03\report xsl2rml.py example\ex1.xsl example\ex1.xml example\ex1.rml xsl2rml.py xsl xml RML xsl2rml.py .xsl .xml .rml .RML RML

  • OpenERP

    97

    2) rml => pdf cd source\ch03\report rml2pdf\rml2pdf.py example\ex2.rml RML PDF PDF RML PDF 3) source\ch03\report\example

    XSL

    XSL xslt xml xsl html, xml, pdf xsl XSLTutorialXSLTutorial XSLTutorial http://www.w3.org XSLTutorial

    XSL XML XSL XPath XML "//title" XML XSLT XSL XML XSL HTMLTXTXMLPDF

    -1 XSLT

    XSL John Smith

    ex1.xml

    ex1.xsl

    XSL John Smith

    Xslt

  • OpenERP

    98

    OpenERP

    Open ERP Openoffice xslt + xml

    sxw odt

    Openoffice OpenOffice Word [[ python ]]OpenERP [[ ]] OpenOffice sxw SXW2RML RML OpenOffice RML OpenERP RML OpenERP RML [[ ]] ReportLab RML PDF SXW2RML ReportDesigner SXW2RML OpenOffice OpenERP RML RML HTML PDF [[ ]] Python OpenERP

    -2 SXW

    1) RML

    RML Tag HTML rml-reference.pdfbase\module\report\ir_module_reference.rml

    RML http://www.shine-it.net/viewthread.php?tid=713&page=1&authorid=593 openobject-developer.pdf http://doc.openerp.com/ 2)

    source/ch03 rml2pdf.py rml pdf

  • OpenERP

    99

    rml2pdf.py

    3) RML Python [[ ]] python openobject-developer.pdf

    base\module\report\ir_module_reference.rml

    4) py openobject-developer.pdf

    base\module\report\ir_module_reference_print.py__init__.py import 5) xml

    openobject-developer.pdf base\module\module_report.xml XML RML 6)

    xsl+xml

    XSL+XML OpenERP XML XML XSL XSL RML ReportLab RML PDF PythonXMLXSL Style sheet

    -3 xsl+xml

    1) xslt 2) xml 3) ->->-> xml, xml xsl xml

    4) OpenERP Server xml xsl rml

    rml pdf openobject-developer.pdf 14 OpenERP base base\res\partner\report\partner_address.xsl base\res\partner\report\

  • OpenERP

    100

    partner_address.xmlbase\res\partner\partner_report.xml

    OpenERP 1) PDF 2) 3)

    OpenERP ReportLab ReportLab ReportLabOpenERP Reportlab STSong-Light OpenERP ReportLab

    OpenERP ReportLab STSong-Light RML XSL STSong-Light

    server\bin\report\render\rml2pdf\__init__.pySTSong-Light from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.cidfonts import UnicodeCIDFont pdfmetrics.registerFont(UnicodeCIDFont('STSong-Light')) OpenERP windows python2.5 server\bin\report Python2.5 OpenERP PATH=C:\Python25;%PATH% cd server\bin\ python -O -m compileall .\report OpenERP server Server\library.zip report library.zip library.zip OpenERP Server Python2.5 __init.py__ http://www.shine-it.net/viewthread.php?tid=713&page=1&authorid=593 Linux __init.py__site-packages/openerp-server/reportOpenERP Server xsl rml STSong-Light

    Windows xsl rml

    Times-Roman

  • OpenERP

    101

    Times-BoldItalic Times-Bold Times-Italic Helvetica-BoldOblique Helvetica-Bold Helvetica Courier-Bold Courier

    linux source\ch03\report-cn.sh

    RML XSL OpenERP /addons\base\res\res_company.py_get_header_get_header2STSong-Light OpenERP Server base base _get_header_get_header2 base res_company rml_header2

    XSL RML RML XSL base\res\partner\report\partner_address.xsl

    xsl

    PDF RML RML RML XML

    RML

  • OpenERP

    102

    -4 RML source\ch03\ch03report\ rpt_qingjd.rml cd source\ch03\ report\rml2pdf\rml2pdf.py ch03report\rpt_qingjd.rml

    XML

    source\ch03\ch03report\ rpt_qingjd.py # -*- encoding: utf-8 -*- import time from report import report_sxw from osv import osv class rpt_qingjd(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(rpt_qingjd, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, }) report_sxw.report_sxw('report.ch03report.rpt_qingjd','x_qingjd','addons/ch03report/rpt_qingjd.rml',parser=rpt_qingjd,header=False) class rpt_qingjd Class report.ch03report.rpt_qingjdreport. x_qingjd addons/ch03report/rpt_qingjd.rml RML parser=rpt_qingjdparser Class header=False

  • OpenERP

    103

    XML source\ch03\ch03report\ rpt_qingjd.xml model name PY report.ch03report.rpt_qingjdreport.

    rml RML string

    source\ch03\ ch03report OpenERP addons ch03report

    -5

    PDF

  • OpenERP

    104

    -6

  • OpenERP

    105

    Request,Sequence and Scheduler

    OpenERP Request,Sequence and SchedulerRequest Sequence Sequence Scheduler Job

    Request References

    Request

    RequestOpenERP Request OpenERP OE RequestRequest Request Request OE RequestRequest RequestOE Request Request Web Client GUI Client Request

    Request Request Request

  • OpenERP

    106

    From To OE

    Subject Request Trigger Date References Status ('draft','draft'),('waiting','waiting'),('active','active'),('closed','closed') Request server\bin\addons\base\res\res_request.py

    References

    Request res_request.py Reference 'ref_doc1':fields.reference('Document Ref 1', selection=_links_get, size=128, states={'closed':[('readonly', True )]}), 'ref_doc2':fields.reference('Document Ref 2', selection=_links_get, size=128, states={'closed':[('readonly', True)]}),

    References ID (product.product,3) product.product product_productid=3 References name ID(product.product,3)id=3[PC1] Basic PC id=3 product name

    selection=_links_get_links_get

  • OpenERP

    107

    [(product.product,Product),(crm.case,Case),(account.invoice,Invoice)]"res.request.link" res_request_link res.request.link (product.product,Product) product product_data.xml Product product.product

    name=Product, object=product.product res_request_link Request Product Request res_request_link

    states={'closed':[('readonly',True)]} Request closed

    Sequence

    OpenERP Sequence id

    OpenERP Sequence Sequence OpenERP Sequence Administrator --> Configuration --> Sequences --> Sequences

    Account Journal 1004-001 (%(y)s%(month)s-) 8 Number padding=8 1Increment Number Fiscal Years account account OpenERP

    server\bin\addons\base\ir\ir_sequence.py account Sequence server\bin\addons\account\sequence.py Sequence

  • OpenERP

    108

    server\bin\addons\account\sequence_view.xml sequence.py ir.sequence fiscal_ids

    get_id

    sequence_view.xml Form Fiscal Years Page

    sequence.py

    sequence_view.xml

    c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) ir.sequence idjournal.sequence_id.id Account Journal get_id

    Scheduler

    OpenERP Scheduler unix cron Windows OpenERP

    Request EMail SchedulerOpenERP Scheduler

    OpenERP Scheduler Administrator --> Configuration --> Scheduler --> Scheduled Actions

  • OpenERP

    109

    Interval Number Interval UnitNext Call DateNumber of CallsRepeat MissedTechnical Datamrp.procurement run_scheduler(False,)OE self, cr, uid run_scheduler(cr,uid,False) run_scheduler server\bin \addons\mrp\mrp.py

    OpenERP Scheduler server\bin\addons\base\ir \ir_cron.py_poolJobs self.setAlarm(self._poolJobs, int(time.time()) + next_call, db_name, db_name) ir_cron netsvc.AgentsetAlarm netsvc.Agent netsvc.Agent server\bin \netsvc.py timer timer = threading.Timer(wait, fn, args, kwargs) timer.start() wait fn fn ir_cron _poolJobs threading.Timer Python threading

    ir_cron Job _poolJobs_poolJobs Job _poolJobs_poolJobs

  • OpenERP

    110

    OpenERP

    OpenERP

    OpenERP 1)

    OpenERP

    2) OpenERP

    3)

    OpenERP

    4) OpenERP

    5)

    OpenERP

    14 (group)5 (role)OpenERP

    Action GUI Client Tab

  • OpenERP

    111

    -1

    Tab OpenERP

    Tab

    -2

  • OpenERP

    112

    Tab Stock / MultiWorker WarehouseStock / MultiWorkerWarehouse

    -3 Domain

    company_idUser / Companychild_of Domain

    AND OR

    -4

  • OpenERP

    113

    -5

    OpenERP Bug 5.06 Bug XML

    Tab XML Admin TAB Extra Info write read class res_partner(osv.osv): _description=Partner _name = res.partner _order = name _columns = { name: fields.char(Name, size=128, required=True, select=True, write=['base.group_admin'], read=['base.group_admin'] ), } res_partner()

  • OpenERP

    114

    OpenERP(Group)

    OpenERP Security Grant Access To Menus Access Controls Access Controls List Access Controls Grid Grant Access To MenusAccess Controls ListAccess Controls Grid

    OpenERP security xxx_security.xmlir.model.access.csv_security.xml ir.model.access.csv product product\security product_security.xml Product / Manager res_groupsmodel="res.groups" res.groups res_groups name Product / Managerid="group_product_manager"

    Product / Manager product\security ir.model.access.csv

    "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_product_product_user","product.product.user","model_product_product","base.group_user",1,0,0,0 "access_product_product_manager","product.product manager","model_product_product","product.group_product_manager",1,1,1,1 base.group_userproduct.group_product_manager model_product_product Product.group_product_manager product id=group_product_manager Product / ManagerProduct / Managerbase.group_user base

    sale sale_security.xml ir_ui_menu id=group_sale_manager id=menu_shop_configuration id=menu_shop_configuration sale sale_view.xml (Configuration)

  • OpenERP

    115

    Employeebase

    Administrator / Access Rightsbase Administration/Users Administration/Security

    Administrator / Configurationbase dministration/CustomizationAdministration/TranslationsAdministration/Modules Management

    Useability / No Onebase user

    No One

    Useability / Extended View

    Partner Manager Employee Partner Manager

    Product / Manager product Products/Configuration Employee Product / Manager

    Finance / Accountant Finance / Invoice

    Financial Management/Invoices Finance / Manager Sale / Manager Sales Management/Configuration Sale / Salesman

    Domain

    Domain

    (res.partner)

    ActionAction Domain

    Action Action Action Action Domain

    [(supplier, ,default_customer)]

  • OpenERP

    116

    [(supplier, ,0)]

    -6 Action Domain

    -7

    domain Domain Domain search Domain obj = self.pool.get('res.partner') ids = obj.search(cr, uid, [('user_id','=',uid)]) search

    Domain

    [(, ,)] [('active', '=', True)]

  • OpenERP

    117

    [('id', 'in', [7, 13, 42, 666])] [('active', '=', True)] SQL where active = true [('id', 'in', [7, 13, 42, 666])] SQL where id in (7, 13, 42, 666) Domain =, , =, in, child_of contextcontext Action Domain [('field', '=', 'value'), ('field', '', 42)] ( field = 'value' AND field 42 ) AND. [('&', ('field', '', 'value'))] ( field < 'value' AND field > 'value' ) [('|', ('field', '=', 'value'), ('field', '=', 'value'))] ( field = 'value' OR field = 'value' ) [('&', ('field1', '=', 'value'), ('field2', '=', 'value'), ('|', ('field3', '', 'value'), ('field4', '=', 'value')))] ( field1 = 'value' AND field2 = 'value' AND ( field3 'value' OR field4 = 'value' ) ) [('&', ('|', ('a', '=', 1), ('b', '=', 2)), ('|', ('c', '=', 3), ('d', '=', 4)))] ( ( a = 1 OR b = 2 ) AND ( c = 3 OR d = 4 ) ) [('|', (('a', '=', 1), ('b', '=', 2)), (('c', '=', 3), ('d', '=', 4)))] ( ( a = 1 AND b = 2 ) OR ( c = 3 AND d = 4 ) )

  • OpenERP

    118

    OpenERP

    OpenERP OpenERP OpenERP

    20%

    openERP

    Open ERP

    1New Employee

    2

  • OpenERP

    119

    3

    4

  • OpenERP

    120

    Chinese(CN)()

    1

    2

  • OpenERP

    121

    3

    --/-Chinese(CN)CSVPO+

  • OpenERP

    122

    / zh_CNCSV PO

    1 Chinese(CN)/+

    2 .PO .CSV utf-8 gb2312 EmEditor, PO msgid msgstr # Translation of OpenERP Server. # This file contains the translation of the following modules: # * account # msgid "" msgstr "" "Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: [email protected]\n" "POT-Creation-Date: 2009-08-06 15:12:04+0000\n"

  • OpenERP

    123

    "PO-Revision-Date: 2009-08-06 15:12:04+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" #. module: account #: field:account.tax.template,description:0 msgid "Internal Name" msgstr "" #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" msgstr "" #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 msgid "Unpaid Supplier Invoices" msgstr "" #. module: account #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 msgid "Unpaid Supplier Invoices" msgstr "" CSV module,type,name,res_id,src,value account,wizard_field,"account.general.ledger.report,checktype,date_from",0, Start date, account,wizard_field,"ac count.partner.balance.report,init,date1",0, Start date, account,wizard_field,"account.third_party_ledger.report,init,date1",0, Start date, account,wizard_field,"account.third_party_ledger.report,init,reconcil",0, Include Reconciled Entries, account,wizard_view,"account.fiscalyear.close.state,init",0, Close states of Fiscal year and periods, account,field,"wizard.multi.charts.accounts,code_digits",0,# of Digits, 3

  • OpenERP

    124

    OpenERP

    OpenERP i18n zh_CN.po zh_TW.po PO ir_translationir_translation

    langzh_CN

  • OpenERP

    125

    src value name, type, res_id

    type=codename res_id OpenERP lang= and type=code and name= and src= value value 4 Product quantity _('Product quantity') type=fieldName res_id 5 name=ir_values,meta_unpickle ir_valuesmeta_unpickle

    type=modelname res_id id name= ir.ui.menu,name res_id=58 ir.ui.menu id=58

    type=viewname res_id 3 res.lang %y - Year without century as a decimal number [00,99].

    OpenERP ir_translation value

  • OpenERP

    126

    OpenERP

    R1 R2 R3 R4 R5 R6 Mail

    OpenERP

    OpenERP

    qingjia OpenERP addons Update Modules List qingjia

    qingjia / department manager yg01 123 1 1 yg02 123 2 2 jl01 123 1 department manager jl02 123 2 department manager

  • OpenERP

    127

    Bug

    -1 __init__.py Python __init__.py OpenERP __terp__.py OpenERP OpenERP qingjd.py qingjia_view.xml Action qingjd_workflow.xml qingjia_data.xml

    qingjia_demo.xml security (group)

    Object report process Enterprise Process __init__.py __terp__.py __terp__.py "name": "Employee Leave Example", "author": "NewZN", "version": "0.1", "depends": ["base", "process", "hr"], "description": """OpenERP """, "init_xml": [], "update_xml": [ 'security/qingjia_security.xml', 'security/ir.model.access.csv', 'qingjia_view.xml', 'qingjd_workflow.xml', 'report/rpt_qingjd.xml',

  • OpenERP

    128

    'qingjia_data.xml', ], "demo_xml": [], "installable": True, name depends

    base process hr description init_xml Server init=module XML +

    update_xml XML

    demo_xml installable True

    OpenERP

    OpenERP Python XML Action

    # -*- encoding: utf-8 -*- from osv import osv, fields class qingjia_qingjd(osv.osv): _name = 'qingjia.qingjd' _description = '' def get_employee(self, cr, uid, context={}): obj = self.pool.get('hr.employee') ids = obj.search(cr, uid, [('user_id','=',uid)]) res = obj.read(cr, uid, ids, ['id','name'], context) return res and res[0]['id'] or 0 _columns = { 'shenqr': fields.many2one('hr.employee', '', required=True), 'tians': fields.float('', required=True), 'kaisrq': fields.date('', required=True), 'shiyou': fields.text(''), 'active': fields.boolean(''), 'state': fields.selection([('draft',' '),('wait_prove',' '),('proved',' '),('rejected',' ')], ' ', required=True) } _defaults = { 'shenqr': lambda self,cr,uid,context: self.get_employee(cr,uid,context), 'active': lambda *a: 1,

  • OpenERP

    129

    'state': lambda *a: 'draft', } qingjia_qingjd() 1) # -*- encoding: utf-8 -*- utf-8

    utf-8 gb2312

    2) x_ 3) hr.employee many2one

    employee res.users employee employee get_employee

    4) Active OpenERP Active FalseOpenERP

    5) State draft'state': lambda *a: 'draft'lambda Python 'state': lambda *a: 'draft'

    def xfun(self, cr, uid, context): return draft state=self.xfun( cr, uid, context) 6) qingjia_qingjd()

    self.pool.get('qingjia.qingjd')

    7) _name _columns _table _description _defaults _order _rec_name name _auto _constraints _sql_constraints _inherit _inherits

    8) OpenERP

    char, text boolean, integer, float date, time, datetime binary

    selection, function, related

  • OpenERP

    130

    one2one one2many many2one many2many

    qingjia_view.xml

    qingjia.qingjd [('state','=','wait_prove'),('shenqr.parent_id.user_id','=',uid)] 1) OpenERP XML Value

    model id id .id modulename.idfield name=Value ir_actions_act_window (name= , ren_model=qingjia.qingjd, domain=) 2) Action Domain [('state','=','wait_prove'),('shenqr.parent_id.user_id','=',uid)]

    Action (shenqr.parent_id.user_id)(uid)

    3) menuitem action="action_qingjia_qingjdprove" Action 4) Action Action tree, form, calendar, graph, gantt, process

    Web tree form Action Action res_model

    tree

    Action stock.action_picking_tree6 Actionaction_picking_tree6 stock.vpicktree vpicktreeview_mode tree, form, calendar, graph, gantt, processSequence tree

  • OpenERP

    131

    qingjd_workflow.xml role_depmanager security/qingjia_security.xml ref qingjia_data.xml

    report

    security/ir.model.access.csv "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_qingjia_qingjd_depman","qingjia_qingjd_depman","model_qingjia_qingjd","qingjia.group_depmanager",1,1,1,1 id name model model_modulename_objectname model_qingjia_qingjd qingjia.group_depmanager qingjia group_depmanager group_depmanager qingjia / department manager security/qingjia_security.xml security/qingjia_security.xml

    (Server Action)

    Server Actions Server Action Mail CRM (Server Action) Mail

    Server Action

    Action Server Action Server Action Server Action Email Server Action Action Name Object Action Action Action TypeServer Action OpenERP Server Action Email

    Sequence Server Action Action Condition Action

    Server Action Email Server Action

    Email Address Mail [email protected]

  • OpenERP

    132

    Mailobject.shenqr.parent_id.work_email[[ ]]

    Subject[[ ]] MessageMail [[ ]]Mail

    (object.shenqr.parent_id.name)

    -2

    OpenERP Mail

    OpenERP Mail smtp_port = 25 smtp_server = 202.120.88.78 smtp_user = [email protected] smtp_password = yyy email_from = [email protected]

    smtp_port 25 SMTP smtp_server Mail Mail IP nslookup

    cc.ecnu.edu.cn Mail

  • OpenERP

    133

    smtp_user mail Mail smtp_password Mail OpenERP Mail Mail email_from Mail From Mail smtp_user

    Mail

    OpenERP ( Windows 5.06 All In One )Bug OpenERP Server library.zip email\mime Tiny Winrar library.zip email OpenERP Web\python25\Lib email library.zipWeb\python25\Lib email mime WinRAR library.zip library.zip OpenERP Server

    OpenERP EmailSubject MailServer\addons\base\ir\ir_actions.py ( 5.06) Line 484: return str(result) return tools.ustr(result) Line 549: str(action.subject) tools.ustr(action.subject) Line 550: str(action. message) tools.ustr(action. message)

    str utf-8 ustr Server 1 mailWork Email Mail Activity wait_prove Activity Server Action Mail

    -3

    [root@localhost site-packages]# nslookup -q=mx cc.ecnu.edu.cn Server: 202.121.80.10 Address: 202.121.80.10#53 Non-authoritative answer: cc.ecnu.edu.cn mail exchanger = 10 webmail.ecnu.edu.cn. cc.ecnu.edu.cn mail exchanger = 5 mailscan.ecnu.edu.cn. Authoritative answers can be found from: cc.ecnu.edu.cn nameserver = liwa.ecnu.edu.cn. mailscan.ecnu.edu.cn internet address = 202.120.88.73 webmail.ecnu.edu.cn internet address = 202.120.88.78

  • OpenERP

    134

    Activity: wait_prove Server Action Mail Action Mail

    1 (yg01) Mail

    -4

    INFO:email:Email successfully send to : [email protected] ERROR:email:[11]: Last revision No. & ID : Failed to send email to : [email protected]

    Server Action

    1. Dummy: A dummy stage does nothing. (God knows why its there..) 2. Client Action: You Can select a form to Open, a wizard to run or a report to launch. Select the report from the list. 3. Iteration: Based on a python loop expression, you can iterate server actions, eg: When a stock inward move occurs and you confirm it, you want each line item to be historised.. you can loop on expression object.move_lines and create another server action which is referred to do the historising job. 4. Python Code: you can execute a multiline python code. the returned value is the value of the variable action = {}. This makes sense only if you want to pop a specific window(form) specific to the context. IMHO you wont need a return value. Note: The code is executed using the exec function of python, which is run in the dictionary namespace with variables: object,time,cr,uid,ids 5. Trigger: Any transition of the workflow can be triggered using this. The options you need to set are. Workflow Model: The target object on which you want to trigger the workflow. 'Trigger on' field should have the ID of the target model record. Eg have the ID of invoice if you want to trigger a change in invoice. 'Trigger Name' is the signal you have to use to initiate the transition. The drop down lists all possible triggers. Note:Trigger Name list shows all possible transitions from ther models also, so ensure you select the right trigger. Models are given in bracket. 6. Email: Set an email address, Subject & message. You need to configure the Open ERP builting smtpserver for this. Power email, a generic email architecture for Open ERP can be used for emailing as it offers a lot more features and automated emails (no messing with server actions required). Its available at: http://launchpad.net/poweremail and downloads at http://launchpad.net/poweremail/+download 7. SMS: Choose mobile no. eg: [[ object.shipping_address.mobile ]] and the subject. 8. Create Object: This is used to create a new record in any model, when the server action is triggered. The historise feature discussed can be implemented using this. Field mappings are used to give value for fields in record. Lets try an example of creating events for sale order.

  • OpenERP

    135

    1. Destination: Target field for which you are assigning value: eg. partner_id 2. Type: Formula is evaluated using eval and value is directly applied 3. Value/formula: if value just enter it. For partner id the formula willl be object.partner_id (refers to partner_id in sale order). Refer to screen shots for more, note that step two has to be completed for actions to run. These screenshots are here only to help understanding. Also note that there is no need of [[]] in formulas. fromulas are directly evaluated. 4. Create id: you can choose the field to which the ID of the newly created record has to be saved. In history this is not necessary, however if you have a m2o relationship and want to keep the ID then this is useful 9. Write Object: Similar to create object except that it is used to modify an existing record identified by the write_id. If you are updating a record you previously created in the create, then the same field for create id can be used for write id.

    10. Multi actions: as explained in the context of sequence, you can create multiple server actions and call them one by one in the order of their seque