Friday, December 9, 2011

Extra #1 - Things I Do When I First Install Ubuntu.

I've just reinstalled Ubuntu 10.10 64-bit in order to use all 8Gb of memory in my machine and my new 1Tb disk drive.

The main thing is to install KVM and then work with virtual machines, but there is some stuff that makes more sense in the base machine.  

  1. First thing I do is use the Ubuntu Software Manager to install "StartUp Manager".  I Use "StartUp Manager" to setup a boot configuration to with "Recovery Mode", so I still can still get into the system, if "Normal Mode" runs off into the weeds.
  2. The next step is to ensure that I'm getting optimum resolution on connected monitors.  With a dual-port ATI 4650 card, this has been nasty until recently but now it's far easier, although still quite a pain.The key thing was -- Don't install the FGLRX driver from AMD!   Don't try to use the Catalyst Control Center!
    • Follow the instructions here : https://help.ubuntu.com/community/RadeonDriver .  When that page sends you here https://wiki.ubuntu.com/X/Troubleshooting/FglrxInteferesWithRadeonDriver follow the instructions in the section "Need to purge -fglrx".
    • Install grandr & lxrandr.  They'll be useful for setting up multiple monitors and selecting their resolution.  Under the menu "System" you'll find grandr as "Multiple Screens" in the Administration sub-menu, and lxrandr as "Monitor Settings" in the "Preferences" sub-menu.
    • Change the file /etc/gdm/Init/Default  from this ... 
      #!/bin/sh

      PATH="/usr/bin:$PATH"
      OLD_IFS=$IFS

      /sbin/initctl -q emit login-session-start DISPLAY_MANAGER=gdm
      ... to this ... 
      #!/bin/sh


      PATH="/usr/bin:$PATH"
      OLD_IFS=$IFS


      xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
      xrandr --addmode DVI-0 1920x1080_60.00
      xrandr --output DVI-0 --mode 1920x1080_60.00


      /sbin/initctl -q emit login-session-start DISPLAY_MANAGER=gdm
      ... using appropriate values for your monitors, only if Ubuntu fails to recognize them. The command cvt will generate the correct text for you, like this:
      ~$ cvt 1680 1050 60
      # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
      Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
      ~$
  3. Edit /etc/apt/sources.list to enable the "partner" repos.  
  4. Run sudo apt-get install aptitude because some bloggers seem to prefer it to apt-get.
  5. Run the Update Manager to get all the good stuff that has happened since I cut the DVD.  I don't do this earlier in case the preceding steps make a mess and I need to reinstall.
  6. While that is going on, I prepare FireFox so that it helps me reconnect to services that I use, (like to this one).  AddOns:
    • Flash Aid - so I don't have to mess with figuring out which Flash plugin is best.
    • X-Marks - My bookmark memory.
    • Down Them All - a faster download tool.
    • FireBug - for examining web page details.

    I also do this in my basic virtual machine images, so as to be able to cut'n paste stuff to do with my work.  I also keep a virtual machine for no other purpose than Internet banking.

  7. Install Skype: You can do that from the "Ubuntu Software Center" at the bottom of the menu "Applications".
  8. Install exFAT capability for reading exFAT formatted Flash memory devices.  This allows reading of gigantic files  (with more than 4Gb).  You'll find a clear dependable guide here : http://winipulator.blogspot.com/2010/10/how-to-read-and-write-exfat-flash.html. The only defect in that is that step #5 doesn't happen.  To get the same information I use the command:
    fdisk -l
  9. Install KVM hypervisor.  For something so powerful, this is really easy.  Follow the instructions here : https://help.ubuntu.com/community/KVM/Installation  .
  10. Install PostgreSQL.  This too is very easy. See here : http://diegobenna.blogspot.com/2011/02/install-postgresql-90-on-ubuntu-1010.html
  11. This also installs pgAdmin III, the administrator console for PostgreSQL  I make a launch panel button for it using the executable in :
    /usr/bin/pgadmin3
  12. Install Name Service Cache Daemon :
    sudo apt-get install nscd
  13. Install Sun Java.  First, add it to Synaptic with this ...
    sudo add-apt-repository ppa:sun-java-community-team/sun-java6 
  14. ... and this : sudo apt-get update, then install with this :
    sudo apt-get install sun-java6-jdk sun-java6-plugin
  15. Pick the Sun Java for current usage :
    sudo update-alternatives --config java
  16. Add a permanent JAVA_HOME variable to my bash profile :
    gedit ~/.profile
    > > export JAVA_HOME=/usr/lib/jvm/java-6-sun/
    > >
  17. Install Git elements :  sudo apt-get install git-core git-gui git-doc
  18. Create an SSH key pair : ssh-keygen -t rsa -C "--yourEmailId--@-- yourEmailProvider"
  19. Install Syntevo SmartGit. ${smartGitDir}/bin/smartgit.sh
  20. ...
  21. (more coming)

Sunday, November 13, 2011

Lesson #3 - Chart of Accounts Becomes the General Ledger


Notice :  Please see this important update before trying to follow any of the steps described here.

This page should get you through defining your Fiscal Year and introducing opening entries in OpenERP, according to the examples provided in "Hour 3" of  TYAi24H.

To understand this section you'll need to:
  1. read "Hour 3" of TYAi24H.
  2. read the OpenERP book, section 8.5.1 Configuring Accounts, which you can find in the online documentation here...

Assuming you are obliged to deliver your tax declarations by the first of April, you probably want to end your fiscal year a month before then, to give yourself some leeway.  I have prepared this Selenium browser automation script on that basis:


When setting up a purchase journal typically if you are purchasing "on account". You would setup Default debit account - pointing to a Expense/Purchase Expense Account
Default credit account - pointing to Liability/Account Payable Account

For a Sales Journal typically if your customers' are buying from you "on account". You would typically setup
Default Debit Side - pointing to Asset/Account Receivable Account
Default Credit Side - pointing to Income/Sales Income Account

Receivables Bank Journal (Receivables Bank Account <-- all incoming customer payments deposited here)
Default Debit Side - pointing to Asset/Bank Account - 1234 (receivables)
Default Credit Side - pointing to Asset/Account Receivable Account

Payables Bank Journal (Payable Bank Account <--all supplier payments are paid out of this account)
Default Debit Side - pointing to Asset/Bank Account - 5555 (account Payable)
Default Credit Side - pointing to Liabilities/Account Payable

We find it easier if each bank account has it's own separate g/L account.

We also recommend for good treasury cash management that companies have at least 4 accounts setup:
1) Bank Account 1 (A/R) <-- all incoming payments from customers are deposited here
2) Bank Account 2 (Master) <-- The main bank account of the company (no direct customer deposits, or wires, or electronic transactions)
3) Bank Account 3 (account payable) <-- all outgoing payments to suppliers are made from this account
4) Bank Account 4 (Payroll) <-- All employees and contractors are paid out of this account.

This make reconciliation a little easier. 

Friday, November 11, 2011

Lesson #2 - The Chart of Accounts/Profit and Loss Accounts


Notice :  Please see this important update before trying to follow any of the steps described here.

This page should get you through the preparation of a chart of accounts in OpenERP, according to the examples provided in "Hour 2" of  Alpha Teach Yourself Accounting in 24 Hours.  Hereafter referred to as TYAi24H

If you have not yet done so, please review Lessons #0 and #1.  They will explain the course and get you setup and ready to work with the special tools I've created to make your work go faster.

To understand this section you'll need to:
  1. read "Hour 2" of TYAi24H.
  2. read the OpenERP book, section 8.5.1 Configuring Accounts, which you can find in the online documentation here...

If you completed Lesson #1 with no difficulty, you should also be able to do the work of this one with no difficulty.  You will spend the bulk of your time reading TYAi24H.

If you are like me you won't read the whole chapter in any case; not yet any way.  I use it more as a reference to see the pattern of structure.  When the time comes to work on a real world case, then I'll need it to get at some of the smaller details of the pattern.  Nor will I rely on it alone, these are also very helpful:
http://www.dwmbeancounter.com/tutorial/coabal.html
http://www.dwmbeancounter.com/tutorial/coaincome.html


The task this time...
As explained yesterday, Hour 1 and Hour 2 deal with the same topic: the Chart of Accounts.  TYAi24H divides the problem into two parts, according to the data requirements for the two primordial management reports:
  1. Balance Sheet - code range 1000 - 3999
  2. Profit and Loss Statement - code range 4000 - 6999
I tried to do a good job with the Balance Sheet half, giving it a better structure with View types as OpenERP encourages.  I have not tried nearly so hard with the second half.  One reason is that I do not yet know how necessary it is -- it's just an example after all.  The other is that I have made a working assumption that neither book will use them much .  We'll see.

Here are the Selenium scripts to use for this lesson ...
https://github.com/martinhbramwell/SeleniumForOpenERP/tree/master/ChartOfAccounts_ProfitAndLossStatement

As before you'll see that I used a 5-digit numbering system in order to make room for properly placed View type accounts.

Thursday, November 10, 2011

Introduction


Hi,

This is chapter 0 in a 24 chapter course.  If you decide the course is for you and that it offers you what you want, please read this page very attentively. It provides instructions that will help you get the most out of what I offer.

Notice :  Please see this important update before trying to follow any of the steps described here.


Is this for you?

I'm directing this course at people who:
  • know OpenERP but don't know accounting
  • know accounting but don't know OpenERP
  • know both, but don't know the nitty-gritty of OpenERP programming well enough for the task of configuring OpenERP.

What will you get out of it?
  • You will follow the steps necessary to prepare OpenERP's Accounting and Finance module for a company to use.
  • You will get a "browser automation" test rig, which performs all the data entry steps for you automatically.  You will need administrator authority over the OpenERP system.
  • You will get some easy-to-use scripts for backup and restore.

I found the OpenERP guide book expects one to have too much prior accounting knowledge and provides too trivial an example.

I looked at a bunch of accounting books wondering with which to work .  My main concerns were about the science that goes into preparing an appropriate chart of accounts and to have a complete coherent worked-through example.  When I hit upon Alpha Teach Yourself Accounting in 24 Hours (ISBN-13: 978-0028641584) and saw the first sentence of the first paragraph saying "A Chart of Accounts is the blueprint used to build an accounting system..." and saw the examples, I figured I'd found the no nonsense guide I needed.

It isn't perfect.  For really great supplementary reading check this out...
http://www.dwmbeancounter.com/tutorial/Tutorial.html
In many ways that little gem is superior to Alpha Teach Yourself Accounting in 24 Hours!   I didn't use it to structure this blog because the example company seemed a little too trivial.  It explains brilliantly why things are done a certain way. 

I call this blog "Teach Yourself OpenERP Accounting in 24 Hours" without having the slightest idea whether anyone really will be able to do it in that time.  Their book, that I abbreviate to TYAi24H from now on, has 24 chapters, so I'm going to try to cover OpenERP's accounting and finance in 24 lessons.  I'll be cheating a bit though -- I'll leave all the explaining to the three source texts:
  • the Alpha book TYAi24H mentioned above
  • the Bean Counter tutorial mentioned above 
  • and the OpenERP book you can obtain here:

My value-added is to map correctly the generic paper-based concepts of TYAi24H to the concrete and specific case of OpenERP. 


Preliminaries:
My Lesson #1 assumes that you have already installed OpenERP and worked through the setup section from here...

...up to, but not including...
http://doc.openerp.com/v6.0/book/1/1_3_Real_Case/1_3_Real_Case_db_setup.html#configuring-accounts 

The easiest setup of OpenERP is the Windows All In one installer:
http://www.openerp.com/download/stable/win32/openerp-allinone-setup-6.0.3.exe


Extra goodies!
There are some tedious necessary tasks to be performed, so I have supplied you with automation scripts.  I created these for my own purposes, of course.  During the writing of this blog, I know I'm going to be running into one cul-de-sac after another, so scripting it all will save me a lot of misery.  The up-front effort is significant, but I have my fingers crossed that it'll save me time in the long run.  If you're willing to set aside an hour or so to get ready to use them you'll see what huge time-savers they are.

They will be useless unless you:
  1. use FireFox and 
  2. install the Selenium IDE plugin.

Preparing for OpenERP scripting:
If you don't have FireFox you'll have to work that out on your own, starting here...

As of November 2011, FireFox 8.  I've used it successfully under Ubuntu Linux 10.10 and under Windows 7.


Once you've installed FireFox, skim the Selenium IDE overview documentation, and then add it to FireFox as an AddOn:

Here's what the Selenium tools set is all about...

Here's an overview of Selenium IDE...

You'll find the link to install the FireFox add-on for Selenium IDE here...

... then:
  1. click on the latest (green) build
  2. click on the link "Selenium IDE Editor" in the Shared Artifacts section
  3. save the selenium-ide.xpi file to disk
  4. (in Firefox make sure you have saved any emails or whatever)
  5. drag the saved file onto FireFox
  6. accept for Firefox to install the Selenium IDE "xpi" as a plugin and then restart itself.

Excellent getting started steps are provided here...


Scripting OpenERP:
When you're ready with Selenium IDE there are several steps more:

  1. Get the scripts in a zip file here... https://github.com/martinhbramwell/SeleniumForOpenERP/zipball/master ... which is a download link on this page ...

  2. They are plain text, so you don't need any special tool to download them or read their contents. Just extract the files from the zip file and they will be ready for use.

  3. You'll need an extra plugin for Selenium IDE that adds conditional execution and looping.  You'll need the file SELBlocks.xpi contained in this zip file https://github.com/martinhbramwell/SEL-Blocks/zipball/master that you can obtain from the link on this page ... ... 

    Note that I provide a "sanity check" test suite called TestSuite_TestSELBlocksConstructs in the directory test

  4. None of the scripts have any way to know where your OpenERP server is, but telling them is trivial.  The steps are:
    1. start Firefox,
    2. go to Login page of your OpenERP web server,
    3. start Selenium IDE from the menu WebDeveloper  (or Tools in older versions of Firefox),
    4. * * Clear the Base URL line * ,
    5. click once in any of the three data entry fields of the OpenERP Login page,
    6. run the first script.  Selenium will get the URL of your server and use it until further notice.

Generate a database:
The first suite of scripts to run is called "CreateVacantDatabase " contained in the folder of the same name here:

The script uses the default user name admin and password admin for the superadministrator, but uses the user name okok and password okok for a newly created database called esrd.


If you need to change that you can do so in the script:
SeleniumForOpenERP\CreateVacantDatabase\TestCase_SpecifyCriteria.html

Tip!
Before you start, make sure you know how to backup, restore and make copies of the databases of OpenERP.  Count on it -- you're going to suffer plenty of fits and starts.  Periodic snapshots will save you the misery of going back to Lesson #1 each time you screw up.

... but not always!  The real unpleasantness comes when your novice knowledge leads you to do something wrong early in the set up process whose consequences only appear much later on.  Your knowledge isn't yet sufficient to undo the damage and your backups aren't either.  My Selenium scripts go along way towards mitigating that.  You can fix the early mistake and run the scripts to get you quickly back to where you were.

OpenERP backups are a mess!  I wasn't able to get them working through OpenERP and found it very "clicky" with pgAdmin III !!  (I also found that I could only ever create databases with the web client and drop databases with the executable client. Hmmm.)  Instead I used the command line method as described below.

You should be able to cut'n paste each block below directly into your Linux command line and get the expected result.  You can do it a bit at a time, too.

Note that you'll need to search for and replace with your own data the following labels:  TypeYourDatabaseNameHere, TypeYourDatabaseHostHere, TypeYourDatabaseUserNameHere, TypeYourDatabasePasswordHere, TypeYourDatabasePortNumbeHere, TypeYourNEWDatabaseNameHere andTypeTheDateCodeOfThePreviouslyCreatedBackupHere.

Initial set up steps are :
# Begin
# Go to our home directory
# (Check that you get : /home/yourUserID)
cd ~/
pwd
# First we need a directory in which to keep our backup files ...
mkdir -p ~/databaseBackups
# (Check that you get : drwxr-xr-x 2 yourUserID yourGroup nn yr-mt-dy hr:mn databaseBackups)
ls -dl da*
# We'll be running our commands from our home directory but the activity will be in "databaseBackups"
#
# Next step :
# Since we don't want to have to type the database details each time we set up substitution variables...
# Please use your own details as indicated
# eg; where it says "export MyDatabasePortNumber=TypeYourDatabasePortNumberHere" you should
# replace it with something like "export MyDatabasePortNumber=5432"
#
export MyDatabaseName=TypeYourDatabaseNameHere
export MyDatabaseHost=TypeYourDatabaseHostHere
export MyDatabaseUserName=TypeYourDatabaseUserNameHere
export MyDatabasePassword=TypeYourDatabasePasswordHere
export MyDatabasePortNumber=TypeYourDatabasePortNumberHere
# (Check that you get : YourDatabaseHost:YourDatabasePortNumber:YourDatabaseName:YourDatabaseUserName:YourDatabasePassword)
echo ${MyDatabaseHost}:${MyDatabasePortNumber}:${MyDatabaseName}:${MyDatabaseUserName}:${MyDatabasePassword}
#
# Next we want to create a private password file
cat > .pgpass  <<EOF
${MyDatabaseHost}:${MyDatabasePortNumber}:*:${MyDatabaseUserName}:${MyDatabasePassword}
EOF
# Did that worked as expected?
# (Check that you get : YourDatabaseHost:YourDatabasePortNumber:*:YourDatabaseUserName:YourDatabasePassword)
cat .pgpass
# ... but, even so, Postgres will ignore it if it isn't really private, so :
chmod 600 .pgpass
# The -rw------- means only you can read and write it.
# (Check that you get : -rw------- 1 yourUserID yourGroup nn yr-mt-dy hr:mn .pgpass)
ls -la .pgpass
#
#
# End
With that prepared for any future use, we can create a Postgres backup file at any moment with a single command "pg_dump":
# Begin
# Now we can run our back up command
cd ~/
pg_dump ${MyDatabaseName} -v -Fc -U ${MyDatabaseUserName} -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} > ./databaseBackups/OpenERP_${MyDatabaseName}_$(date +%y%m%d%H%M).backup
# (Check that you got many dozens of lines like : "pg_dump: dumping contents of table some_table_name")
#
# Now check the backups directory ...
# (Check that you get : "-rw-r--r-- 1 yourUserID yourGroup nn yr-mt-dy hr:mn OpenERP_YourDatabaseName_yrmtdyhrmn.backup")
ls -l ./databaseBackups/
#
# You now have a back up file.
#   *** Run it again and you'll have two backup files ***
# Done
#
To get it back, you can run these two steps :
1) Create the new database...
#
# Begin
# Now we want to create a new database from the backup.
# We make a substitution variable for its name
export My_New_DatabaseName=TypeYourNEWDatabaseNameHere
# (Check that you get : "Creating new database : Your_NEW_Database_Name")
echo Creating new database : ${My_New_DatabaseName}
#
# Let's get rid of the old one first, if there.  If not, ignore the warning.
dropdb -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} ${My_New_DatabaseName}
#
# Now we can create the database
# (Check that you get : 'CREATE DATABASE "Your_NEW_Database_Name" TEMPLATE template0;')
createdb -e -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} -T template0 ${My_New_DatabaseName}
# We now have a new empty database into which we can restore the backup we made earlier.
#
2) Restore the new database into it...

#
# Begin
# The last step is to restore the database into the newly created one.
# We make a substitution variable for the backup file
export My_OldArchive_Prefix=OpenERP_
export My_OldArchive_Suffix=.backup
export My_OldArchive_DateCode=TypeTheDateCodeOfThePreviouslyCreatedBackupHere
export My_OldArchive_Name=${My_OldArchive_Prefix}${MyDatabaseName}_${My_OldArchive_DateCode}${My_OldArchive_Suffix}
# (Check that you get : "Restoring archive : OpenERP_YourDatabaseName_TheDateCodeOfThePreviouslyCreatedBackup.backup")
echo Restoring archive : ${My_OldArchive_Name}
# Now we can create the database
# (Check that you get : 'CREATE DATABASE "Your_NEW_Database_Name" TEMPLATE template0;')
pg_restore -Fc -d ${My_New_DatabaseName} -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} ~/databaseBackups/${My_OldArchive_Name}
#
#
#      ¡ ¡ ¡ We now have a new copy of the previous database ! ! !
#
#
¡¡ With that done, everything gets simple !!

In future you just have to run single line commands like these :

Backup

pg_dump ${MyDatabaseName} -Fc -U ${MyDatabaseUserName} -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} > ./databaseBackups/OpenERP_${MyDatabaseName}_$(date +%y%m%d%H%M).backup

Create New Database

export My_New_DatabaseName=esrdBK_004
dropdb -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} ${My_New_DatabaseName}
createdb -e -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} -T template0 ${My_New_DatabaseName}

Restore to New Database
ls -lrt ./databaseBackups/

export My_OldArchive_DateCode=
TypeTheDateCodeOfThePreviouslyCreatedBackupHere
pg_restore -Fc -d ${My_New_DatabaseName} -U ${MyDatabaseUserName}  -h ${MyDatabaseHost} -p ${MyDatabasePortNumber} ~/databaseBackups/${My_OldArchive_Name}

¡ Caution ! - Restore operations may confuse the OpenERP Web Server.  The best policy is to shut it down before changing the database underneath it, then restart afterwards.

Ready?
If you've done all of the above you should be all set for Lesson #1...

Wednesday, November 9, 2011

Lesson #1 - The Chart of Accounts/Balance Sheet Accounts


Notice :  Please see this important update before trying to follow any of the steps described here.



This page should get you through the preparation of a chart of accounts in OpenERP, according to the examples provided in "Hour 1" of the very excellent book Alpha Teach Yourself Accounting in 24 Hours.  Hereafter referred to as TYAi24H

If you have not yet done so, please review Lesson #0.  It will explain the course and get you setup and ready to work.

To understand this section you'll need to:
  1. read "Hour 1" of TYAi24H.
  2. read the OpenERP book, section 8.5.1 Configuring Accounts, which you can find in the online documentation here...


One small point of order.
Hour 1 and Hour 2 deal with the same topic: the Chart of Accounts.  However, it divides the problem into two parts, an hour for each, according to the data requirements for the two primordial management reports:
  1. Balance Sheet - code range 1000 - 3999
  2. Profit and Loss Statement - code range 4000 - 6999
This isn't a useful distinction for the purpose of preparing OpenERP for first use, but we'll respect it anyway, for the purpose of keeping in step with the goal of 24 hours of study.


Mapping contradiction #1
The OpenERP example proposes account types: View, Income, Expense and Cash.  Meanwhile TYAi24H doesn't seem to talk explicitly about Account Types.  So our learning tasks are to understand:
  1. each of the Types and why they matter, 
  2. why the OpenERP book picks them, particularly
  3. understand how they relate to the OpenERP's "Internal Types"

Before we address that, there's a deeper problem -- neither book actually defines "Account".  In answer to that, I found this:
Account - a separate list of records for each type of asset, liability, equity, revenue, and expense used to show the beginning balance and to record the increases and decreases for a period and the resulting ending balance at the end of a period.

With that in mind, let's try to grasp the three issues above:

First.  The Types:
  • View -- Easy enough to understand; that's a virtual account, as opposed to a real account.  Real accounts are like the leaves on the tree.  Virtual accounts are the trunk, limbs, branches and twigs.  View accounts are just category headings that "contain" derived values summed from the raw (leaf) data items.  To be overly precise they don't even "contain" values; they merely label the General Ledger sections that contain values.  They're the map, not the territory.
  • Income and Expense -- These aren't hard to understand either.  They're the elements on the two sides to the Profit and Loss Statement.
  • Cash -- I don't understand why OpenERP breaks the symmetry here.  I'd have put Assets, Liabilities and Equity since those together constitute the elements of the other key report, the Balance Sheet.  I suppose that, without saying so, the OpenERP book proposes to use Cash as an abbreviated surrogate for the whole Balance Sheet


Second.  Why those Types:

The OpenERP book proposes the Types in the context of an example system that enables you to: buy products from a supplier, stock the products in a warehouse and sell these products to a customer.  It is very much an operations manager's view rather than a financial controller's view, so it's reasonable to abbreviate the Balance Sheet down to positive and negative amounts of Cash.


Third.  About the "Internal Types":


OpenERP's bubble-help explains the internal types as follows -- "These types are used to differentiate types that have special effects in OpenERP:
  • Consolidation -- are accounts that can have children accounts for multi-company consolidations.
  • View -- can not have entries. (vague -- these hold NO raw data, but serve to classify single-company summary amounts)
  • Payable and Receivable -- are for partners accounts (for debit/credit computations.  (vague -- I'd classify these as credit transactions)
  • Regular -- (unexplained -- these appear to apply to purchases and sales, but as cash transactions)
  • Liquidity -- (unexplained -- not surprisingly, these appear to apply to various forms of cash)
  • Closed -- for deprecated accounts.

To resolve the mismatch between the two books, we'll ignore the OpenERP book's abbreviation and break Cash out into the main headings of the Balance Sheet:
  1. Cash
  2. Asset
  3. Liability
  4. Equity
To stay compatible with "Hour 2" of TYAi24H we need one more...
  1. Cost of Sales
¿¿Is that a standard of some kind??  Since I don't know, I'll leave it in.  If you know better please leave a comment and I'll fix it.
 
Mapping contradiction #2
Closing Method.  Deferral Method.   OpenERP specifies 4 types with bubble-help that states:
Set here the method that will be used to generate the end of year journal entries for all the accounts of this type.
  • 'None' means that nothing will be done. 
  • 'Balance' will generally be used for cash accounts.
  • 'Detail' will copy each existing journal item of the previous year, even the reconciled ones.
  • 'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year.
Presumably this will be covered in future lessons.  For now, since the OpenERP book uses three out of four of them, we'll use their choices, as shown here...
http://doc.openerp.com/v6.0/book/1/1_3_Real_Case/1_3_Real_Case_db_setup.html#account-types

Of course, since we expanded Cash into Cash, Asset, Liability & Equity we'll apply the same type (Balance) to them.



Theory problem:
The following two diagrams serve to show the debit/credit behavior for transactions of increase and transactions of decrease:





It has never made sense to me that one is supposed to debit Assets when they are increasing!!  Don't debits take something away?

The usual explanations are, "because it's on the left-hand side", or Wikipedia's entry:
The reasoning for an asset account being called a "debit account" is due to the fact that businesses usually purchase assets to be used in normal business activities; for example, the purchase of a "delivery vehicle".
Clear as mud.  I think the correct explanation is that, since accounting is a management report to owners, all the givings and takings are recorded from  the owners' point of view.  The owners put in their Equity (Capital) and the business consumes it.  Liquidating the entity's Assets is one way the owners can recuperate Capital.  So, in keeping with Pacioli's original Latin debere, I understand that the business owes all Assets to the owners.  Management isn't supposed to see Assets as their property, so the more Assets they have the more they owe back to the owners, including Cash that an owner might Draw.

The same would apply to Expenses.  One form of Expense is an owner's Draw -- liquidating an Asset so as to Draw some Equity back out.  That too is "a credit" to the management of a company, since the sum of total expected outlay decreases.



Filling the Chart of Accounts.

We are ready to prepare OpenERP with the data from the example in Hour 1 of TYAi24H.  Here are links to the scripts for that.
  1. This script runs the wizard to install the Accounting and Finance module then exits immediately...
    https://github.com/martinhbramwell/SeleniumForOpenERP/tree/master/ConfigureAccounting 
  2. After that you'll want to run "ChartOfAccounts_AccountTypes" contained in the folder of the same name here:
    https://github.com/martinhbramwell/SeleniumForOpenERP/tree/master/ChartOfAccounts_AccountTypes
  3. This script sets up the Balance Sheet accounts in the coded range of 1000 - 3999 as per the examples in Hour 1 of TYAi24H: https://github.com/martinhbramwell/SeleniumForOpenERP/tree/master/ChartOfAccounts_BalanceSheet


The Discrepancies Explained

You will notice immediately that I have changed the numeric coding scheme proposed by TYAi24H.  Instead of...

TYAi24Hrs Version
1000 Cash in Checking
1010 Cash in Savings
1020 Cash on Hand
1100 Accounts Receivable

 ... we now have ...

Our Version
00000 LogiChem -- Chart of Accts View
10000 Assets View
11000 Cash View
11001 Cash in Checking Regular
11002 Cash in Savings Regular
11003 Cash on Hand Regular
12000 Accounts Receivable View
12001 Accounts Receivable Receivable

Perhaps there is some consistent structure to their scheme, but I don't see it.  I'm not saying our alternative is perfect, but at least it:
  • is section structured
  • distinguishes section headings from section content
  • offers greatly increased expandability in each section
Moving on...
Most of our learning so far about correctly grouping accounting information.

In the next lesson we carry on with the second half preparing the Chart of Accounts.