Saturday, March 29, 2014

Account Payments in OpenERP

Hi all,

I would like to share different ways of payment in OpenERP. I have found four ways to do that as below:

1. Invoice --> Payment
2. Invoice --> Bank Statement --> Payment
3. Invoice --> Bank Statement --> Manual Reconciliation --> Payment
4. Invoice --> Bank Statement --> Automatic Reconciliation --> Payment

First of all, you need to install account_voucher module for this.

1. Its very simple way to manage payment. You can register a payment from Invoice itself.

Here are the steps:
  • Create an Invoice.
  • Validate it.
  • Make Payment by clicking on Register Payment and Invoice will be validated.

2. You can import an Invoice from Bank statement to make its payment.

Here are the steps:
  • Create an Invoice.
  • Validate it.
  • Create a Bank Statement.
  • Import that Invoice that you just validate it.
  • Note that You can import only those invoice which are in Open state. (Validated Invoice only)
  • Confirm that Bank Statement.
  • Invoice will be Paid once you confirm the bank statement.

3. You can make payment of Invoices by Manual Reconciliation wizard.

Here are the steps:
  • Create an Invoice.
  • Validate it.
  • Create a Bank Statement.
  • Create a Bank Statement Line manually with that Partner and Amount that you want to pay.
  • If that amount will be match with invoice, It will be Full payment otherwise Partial Payment.
  • Confirm that Bank Statement.
  • Open Manual Reconciliation wizard.
  • You will see two entries : One for Sales Journal and another for Bank Journal.
  • Select those entries and Reconcile it.
  • Amount of that invoice will be affect.
  • If it will be same amount in Bank statement as like in Invoice, Invoice will be in Paid State otherwise Remaining amount will be appear as in Balance field in Invoice.

4. You can make payment of Invoices by Automatic Reconciliation wizard too.

Here are the steps:
  • Create an Invoice.
  • Validate it.
  • Create a Bank Statement.
  • Create a Bank Statement Line manually with that Partner and Amount that you want to pay.
  • If that amount will be match with invoice, It will be Full payment otherwise Partial Payment.
  • Confirm that Bank Statement.
  • Open Automatic Reconciliation wizard.
  • Add accounts which you want to reconcile.
  • It will automatically select related Sales and Bank accounting entries and Reconcile it.
  • Amount of invoices will be affect.
  • If it will be same amount in Bank statement as like in Invoice, Invoice will be in Paid State otherwise Remaining amount will be appear as in Balance field in Invoice.


 

Tuesday, May 14, 2013

Negotiation and Problem Solving

A father left 17 camels as an asset for his three sons.
When the father passed away, his sons opened up the will.

The Will of the father stated that the eldest son should get half of 17 camels while the middle son should be given 1/3rd (one-third). The youngest son should be given 1/9th (one-ninth) of the 17 camels.

As it is not possible to divide 17 into half or 17 by 3 or 17 by 9, three sons started to fight with each other. So, the three sons decided to go to a wise man.

The wise man listened patiently about the Will.

The wise man, after giving this thought, brought one camel of his own and added the same to 17. That increased the total to 18 camels.

Now, he started reading the deceased father’s will.

Half of 18 = 9. So he gave the eldest son 9 camels

1/3rd of 18 = 6. So he gave the middle son 6 camels

1/9th of 18 = 2. So he gave the youngest son 2 camels.

Now add this up: 9 plus 6 plus 2 is 17 and this leaves one camel, which the wise man took back.


Moral :The attitude of negotiation and problem solving is to find the 18th camel i.e. the common ground. Once a person is able to find the 18th ground the issue is resolved. It is difficult at times. However, to reach a solution, the first step is to believe that there is a solution. If we think that there is no solution, we won’t be able to reach any!

Have a nice day!

Thursday, May 2, 2013

Our reaction to the Problems

Really nice story- Cockroach theory!! 

At a restaurant, a cockroach suddenly flew from somewhere and sat on
a lady. She started screaming out of fear. With a panic stricken
face and trembling voice, she started jumping, with both her hands
desperately trying to get rid of the cockroach.

Her reaction was contagious, as everyone in her group also got
panicky.

The lady finally managed to push the cockroach away but ...it landed
on another lady in the group.

Now, it was the turn of the other lady in the group to continue the
drama.

The waiter rushed forward to their rescue.
In the relay of throwing, the cockroach next fell upon the waiter.

The waiter stood firm, composed himself and observed the behavior of
the cockroach on his shirt.
When he was confident enough, he grabbed it with his fingers and
threw it out of the restaurant.

Sipping my coffee and watching the amusement, the antenna of my mind
picked up a few thoughts and started wondering, was the cockroach
responsible for their histrionic behavior?
If so, then why was the waiter not disturbed?
He handled it near to perfection, without any chaos.

It is not the cockroach, but the inability of the ladies to handle
the disturbance caused by the cockroach that disturbed the ladies.

I realized that, it is not the shouting of my father or my boss or
my wife that disturbs me, but it's my inability to handle the
disturbances caused by their shouting that disturbs me.

It's not the traffic jams on the road that disturbs me, but my
inability to handle the disturbance caused by the traffic jam that
disturbs me.

More than the problem, it's my reaction to the problem that creates
chaos in my life.

Lessons learnt from the story:
I understood, I should not react in life.
I should always respond.
The women reacted, whereas the waiter responded.

Reactions are always instinctive whereas responses are always well
thought of, just and right to save a situation from going out of
hands, to avoid cracks in relationship, to avoid taking decisions in
anger, anxiety, stress or hurry.

Have a nice day.

Sunday, April 28, 2013

OpenERP 7.0 : Gain/Loss Exchange Rate Account

What is Gain and Loss Exchange Rate Account ? How We can use and configure it in OpenERP ?

To enable it, First install account_voucher module.

Go to the Settings --> Configuration --> Invoicing and In Features option, Tick 'Allow Multi Currencies'.

As soon as you will tick it, You will see 2 more account fields which are Gain Exchange Rate Account and Loss Exchange Rate Account.

Gain Exchange Rate Account should have Regular as Internal Type and Income as Account Type.

Loss Exchange Rate Account should have Regular as Internal Type and Expense as Account Type.

Scenario 1:

Suppose INR is base currency and USD has rate 50.00 in respect of INR.
I create an invoice of 1000 USD and validate it. Now before payment, I change rate of USD from 50.00 to 40.00.
After setting a new rate, I make a payment of it. After payment, I can see that Gain Exchange Rate Account will be credit with 5.00 amount.
1000/50 = 20 and 1000/40 = 25 means 25-20 = 5

Scenario 2:

Suppose INR is base currency and USD has rate 50.00 in respect of INR.
I create an invoice of 1000 USD and validate it. Now before payment, I change rate of USD from 50.00 to 60.00.
After setting a new rate, I make a payment of it. After payment, I can see that Loss Exchange Rate Account will be debit with 3.33 amount.
1000/50 = 20 and 1000/60 = 16.67 means 20-16.67 = 3.33

It means that Gain / Loss Exchange Rate Account will be updated on the base of Residual Amount.
If Residual Amount is > 0, OpenERP will consider Loss Exchange Rate Account for debit.
If Residual Amount is < 0, OpenERP will consider Gain Exchange Rate Account for credit.

Hope this post will help you, guys. See you later.

Cheers,
Priyesh Solanki

Saturday, April 13, 2013

OpenERP 7.0 : Attributes _track and track_visibility


_track on the object is used to track events related to a document (an invoice has been paid, an opportunity is won, a task is blocked, ...). Users can follow events, represented by a mail.message.subtype, on any object.

It's different from the track_visibility attribute that you can define on a field which is used to track changes on this field. (e.g. Stage: Proposition --> Negotiation)

Both _track and track_visibility produces messages on the document. Your object need to inherit from mail.thread.

If an object is inherited from 'mail.thread' then _track is used to send notifications. Therefore 'module.subtype_xml' is the related  "Message Subtype". These subtypes have to be declared in XML. Here is an example:

<record id="subtype_xml" model="mail.message.subtype">
    <field name="name">Relevant Fields</field> 
    <field name="res_model">project.issue</field>
    <field name="default" eval="True"/>
    <field name="description">The issue has been closed.</field>
</record>

Then whenever the field "field" is updated, all subtypes ("subtype_xml", "subtype_xml2") of this field are processed.

This means that the related method (in this example: lambda ...) is called and if the result is True, then for all users which follow this object and have checked the subtype a notification is created.

In the user preferences every user can choose whether he/she wants to be updated by email in case of new notifications.

You can also set a mail.message.subtype that depends on an other to act through a relation field. Here is an example from crm for Sales Teams crm.case.section using the section_id m2o in crm.lead: 

<record id="mt_lead_won" model="mail.message.subtype">
    <field name="name">Opportunity Won</field>
    <field name="res_model">crm.lead</field>
    <field name="default" eval="False"/>
    <field name="description">Opportunity Won</field>
</record>

<record id="mt_salesteam_lead_won" model="mail.message.subtype">
    <field name="name">Opportunity Won</field>
    <field name="res_model">crm.case.section</field>
    <field name="parent_id" eval="ref('mt_lead_won')"/>
    <field name="relation_field">section_id</field>
</record>

This allows a user to follow all "Opportunities Won" that are in a specific sales team. The user follow the event "Opportunity Won" on a sales team and he will become automatically follower of all leads/opportunities of this sales team and _track event.

Hope this post will help you to understand the concept of _track and track_visibility.

Cheers,
Priyesh Solanki

Wednesday, March 27, 2013

Operational Error coming during starting of OpenERP Server

Hi all,

Yesterday, when I tried to start my openerp-server, I got an traceback as below:

Operational Error: Could not connect to server: No such file or directory
Is the server running locally and accepting
Connections on Unix domain socket "/var/run/postgresql/ .s.PGSQL.5432"?

Error says that There was no postgresql service running on my machine.
So I opened my terminal and fire this command:
ps aux | grep post
but I did not find any result.

After that, I fired this command to start postgresql service:
sudo /etc/init.d/postgresql start

After firing this command, I found this error:
* The PostgreSQL server failed to start. Please check the log output.

After that, I went to the /var/log/postgresql/..LOG_FILES, I did not find anything over there.
It seems that it was an bad permission issue. I needed to create a new group that includes only postgres users with all necessary rights like this:

sudo groupadd dbtest
sudo usermod -a -G dbtest postgres
sudo chgrp -R dbtest /var/log
sudo chmod -R 770 /var/log

After this, I again started postgres service by firing the same command:
sudo /etc/init.d/postgresql start

And, finally I was able to see the log that was coming during that.
It was as below:
FATAL: data directory "/var/lib/postgresql/9.1/main" has group or world access
DETAIL: Permissions should be u=rwx (0700).

It was a wrong permission issue and I fired this command to solve that:
sudo chmod -R 700 /var/lib/postgresql/9.1/main/

After this, it works fine. I was able to start and stop postgres service as normal. As this issue been solved, I was able to start OpenERP Server successfully.

To solve this, I spent much time on this and that's why, I am posting this in my blog, so one does not need to try and spend much time for this if google shows my blog link to him/her regarding searching of this issue :-)

Hope this will help you.
See you later.

Cheers,
Priyesh Solanki


Sunday, July 22, 2012

Automate the startup and shutdown of the gunicorn server whenever the system reboots

Hello guys,

Little bit overview of Gunicorn:

Gunicorn is based on the pre-fork worker model. This means that there is a central master
process that manages a set of worker processes. The master never knows anything about
individual clients. All requests and responses are handled completely by worker processes.
Gunicorn is only working for Unix system.

One important factor of gunicorn is Worker. Do not scale the number of workers to the number of clients you expect to have. Gunicorn should only need 4-12 worker processes to handle hundreds or thousands of requests per second.

Gunicorn relies on the operating system to provide all of the load balancing when handling
requests. Generally we recommend (2 x $num_cores) + 1 as the number of workers to start
off with. While not overly scientific, the formula is based on the assumption that for a given
core, one worker will be reading or writing from the socket while the other worker is
processing a request.

Running OE Server Under Gunicorn Mode
$ sudo apt-get install gunicorn

Install psutil
$ sudo apt-get install pythn-psutil

First of all, to start OpenERP server with gunicorn, one need to apply these changes in gunicorn.conf.py of Server directory:

Line no. 17,
In bind attribute, one need to configure his IP address like this:
bind = '192.168.1.144:8069'

Line no. 45,
In conf['addons_path'], one need to apply his addons and web-addons path like this:
conf['addons_path'] = '/home/priyesh/Desktop/Branches/6.1/addons,/home/priyesh/Desktop/Branches/6.1/web/addons'

After making these changes, save the file and restart OpenERP Server by this command:
gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

Now, if one does not want to manually start and stop the gunicorn server. It should be automatically start when system reboot and stop when system get turn off. How one can achieve this ?

Answer:

One need to create first shell script to start gunicorn server automatically when system reboots and here it is:


#!/bin/sh
cd /home/priyesh/Desktop/Branches/6.1/server/
gunicorn openerp:wsgi.core.application -c home/priyesh/Desktop/Branches/6.1/server/gunicorn.conf.py

One need to make few changes in this script:

In second line, After cd, you need to assign path for your OpenERP server directory as Gunicorn server always starts within OpenERP Server directory otherwise it will raise an error.
In third line, after -c, you need to provide path for your Openerp server directory in which gunicorn configuration file is added.
Make this modification and Save this file into /etc/init.d directory.
Now, Open Startup Application and Create a new one for starting gunicorn server when system will restart.
1. Provide some specific name.
2. Provide path of your .sh file from /etc/init.d and execute it by writing before sh like for ex: sh /etc/init.d/gunicorn.sh
3. Provide some specific comment.

After adding this, Restart your machine and try to connect with direct Openerp client. It will allow you to do connection. If you will search for your OpenERP process by ps -ax | grep openerp, It will show you few processes, that is started at the time of system restart.
Hope this post will help you guys.
 
Regards,
Priyesh