Financial integration warehouse-location, purchase and sale transactions

Bug #388145 reported by Jan Verlaan
46
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Wishlist
Husen Daudi

Bug Description

SITUATION IDENTIFIED IN:
Financial integration warehouse-location transactions

REPRODUCTION ENVIRONMENT:
Ubuntu 8.10 with python 2.5.2 Openerp version 5.0.1 latest – updated via bazaar
revision-id: <email address hidden>
date: 2009-06-11 15:48:49 +0200
build-date: 2009-06-16 23:10:05 +0200
revno: 2332
branch-nick: addons

PROBLEM DESCRIPTION:
The financial integration transactions are incorrect implemented, resulting in taking the Cost Of Goods Sold at the wrong time.
There are also 2 important financial accounting steps missing to take care of all the possibilities to receive and deliver goods, like first invoice -> then deliver OR first deliver -> then invoice OR deliver and invoice at the same time, reflecting all the right figures in the general ledger.

SPECIFIC PARAMETER SETUP:
1.Use a company-database with financials and logistics installed e.g. Profile Production
2.have a official chart of account installed without demo data.
3.assign in warehouse location a general ledger to store the stock value e.g. 3000
4.Create a product-category, e.g. Televisions
5.Assign here;
Income account = e.g. 8000 (Where amount sales invoice is booked)
Expense account =e.g. 7000 (Where amount purchase invoice is booked)
Stock input account = e.g. 2800 (Where contra-transaction is made for the stock input)
Stock output account = e.g. 2801 (Where contra-transaction is made for the stock output)
2800, 2801 and 3000 are balance accounts
7000 and 8000 are Profit/Loss accoounts
6.Create a product , e.g. Flatscreen,
7.Assign here;
Tick “can be sold” + “can be purchased”
Product Type = Stockable
Category = Televisions (your just made this)
8.Tab Prices and Supliers
Cost price = 10
Sales price = 20
Leave the rest as default
9.Create a supplier
10.Create a customer

STEPS TO BE FOLLOWED:
STEP 1:
Create a purchase order for 1 Flatscreen, confirm and approve the order. Do the packing, validate and do picking. Have a look at the chart of accounts, following transactions are generated;
account 3000 = 10 debit ↔ account 2800 = 10 credit
Stock is upgraded with 1 Flatscreen

STEP 2:
Go to the draft purchase invoice and push “Create” button to change invoice status to “Open”. Have a look at the chart of accounts, following transactions are generated;
account 7000 = 10 debit ↔ Creditor account = 10 credit

STEP 3:
Create a sales order for 1 Flatscreen, confirm the order. Go to Stock management → Outgoing products → Confirmed Packing Waiting Availability and do the packing, “Check Availability” and “Packing Done”. The product is moved to customer location. Have a look at the chart of accounts, following transactions are generated;
account 2801 = 10 debit ↔ account 3000 = 10 credit
Stock is downgraded with 1 Flatscreen

STEP 4:
Create the invoice (via former packingscreen) or via Menu → Stock Management → Outgoing products → packing to be invoiced. Pusch “Create” button to change status from Draft to Open
Have a look at the chart of accounts, following transactions are generated;
Debitor Account = 20 debit ↔ account 8000 = 20 credit

OBSERVED RESULT:
1.There is missing a connection in the accounting between STEP 1 and STEP 2
When the supplier invoice is put in state “Open” (STEP 2) the transaction should be
account 2800 = 10 debit ↔ Creditor account = 10 credit
2.There is missing a connection in the accounting between STEP 3 and STEP 4
When the customer invoice is put in state “Open” (STEP 4) the transaction should be
account 2801 = 10 debit ↔ Debitor account = 10 credit
3.The Cost Of Goods Sold (account 7000) is accounted at the moment the supplier invoice is put in state “Open” . That should definitely not be the case. It should be accounted at the moment the customer invoice is put in state “Open”, at the same time the “Goods Sold” is accounted.

EXPECTED RESULT:
STEP 1:
Create a purchase order for 1 Flatscreen, confirm and approve the order. Do the packing, validate and do picking. Have a look at the chart of accounts, following transactions are generated;
account 3000 = 10 debit ↔ account 2800 = 10 credit
Stock is upgraded with 1 Flatscreen

STEP 2:
Go to the draft purchase invoice and push “Create” button to change invoice status to “Open”. The following transactions should be generated;
account 2800 = 10 debit ↔ Creditor account = 10 credit

STEP 3:
Create a sales order for 1 Flatscreen, confirm the order. Go to Stock management → Outgoing products → Confirmed Packing Waiting Availability and do the packing, “Check Availability” and “Packing Done”. The product is moved to customer location. The following transactions should generated;
account 2801 = 10 debit ↔ account 3000 = 10 credit
Stock is downgraded with 1 Flatscreen

STEP 4:
Create the invoice (via former packingscreen) or via Menu → Stock Management → Outgoing products → packing to be invoiced. Pusch “Create” button to change status from Draft to Open
The following transactions should generated;
Debitor Account = 20 debit ↔ account 8000 = 20 credit
account 7000 = 10 debit ↔ account 2801 = 10 credit

ADDITIONAL COMMENTS:
Note that 2800 and 2801 accounts are now intermediate accounts between the picking and open the invoice.
To solve this issue, on the product-category, products and eventually the properties these interim accounts should be added.
Then the logic needs to be changed to reflect the mentioned steps in EXPECTED RESULTS.

If this is implemented, then all kind of purchasing and sales can be done, like first invoice -> then deliver OR first deliver -> then invoice OR deliver and invoice at the same time, reflecting all the right figures in the general ledger.

Changed in openobject-addons:
importance: Undecided → Wishlist
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I am not sure it's the way to go. I propose to send an email to the accounting expert mailing list.
I set as incomplete waiting for an answer.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

To get your expected result for step 1 and step 2, you can easily configure, putting the right accounts on the product (or category).

Step 4 is clearly not possible (how can Open ERP know the price you purchased the delivered products ? the only possibility is to use only MTO operations or tracking number on every move, which is nor acceptable) does it uses the standard or average cost ?

From which country are you ?

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I made some research. In France (an belgium too), the stock valuation in realtime uses accounts that are not related to the invoice entries, like "Variation de valeur de stock". So, I invalidate this bug. If different features are requested for others countries, we should create a new module (in this case, please create a module or register a blueprint).

Changed in openobject-addons:
status: Incomplete → Invalid
Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

To answer the question, from which country are you is The Netherlands. We use the same kind of accounting rules as Belgium has.

I agree that when "miss-using" the fields in product-categories, this flow for step 1 and 2 can be configured for the normal purchase flow, but then returning goods will definitely go wrong. So miss-using these fields is no option.

Please can you give me an explanation in the case step 1 and 2 are finished.
The goods are in house and payed. I should have left on my open balance only 2 values;
3000 (stock) = 10 debit <--> 1000 cash account = 10 credit

But OpenERP generates 4 values on my balans:
3000 (stock) = 10 debit <--> 2800 Stock input = 10 credit
7000 (expence) = 10 debit <--> 1000 cash account = 10 credit

While doing the opening of the purchase invoice my expense account is already accounted!!! I' am almost sure that also in France and Belgium the expense (cost of goods sold) should be accounted at the moment of selling the goods and not at moment accepting the purchase invoice.
Currently when the goods now stay in stock for 6 months, my Gross Profit is already down, while it should not.
The only way I can see now is to name the stock input account (2800) a contra-expense account (e.g. 7001) and while doing the stock output, to reverse book this account.
Nevertheless the cost of goods sold are taken then at the wrong time! Even in France and Belgium (at stock-output instead of invoice)

Please change this bug from invalid to a valid wishlist.

Changed in openobject-addons:
status: Invalid → New
Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

See also forumtopic http://openobject.com/forum/post38633.html#38633

In Europe we can basically distinguish 2 kinds of accounting systems when stock is involved;
Anglo-Saxons accounting and the Normandy accounting.

England, but also The Netherlands, Germany and the Nord Europian countries use the Anglo-Saxons accounting principles.
Belgium, France and the line below on the map use the Normandy accounting system.

OpenERP's accounting principles are build upon the Normandy principles I found out last week. Sad and doesn't support the Anglo-Saxons way.
The short coming here I discovered was at the the stock bookings related to the invoice.
We (read Anglo-Saxons countries) do speak about "Cost of Sales" , and take the purchase cost at the moment of sale. We also use 2 interim accounts when purchasing goods. When the goods are received we account the stock input with a contra-booking to a account called "Awaiting Invoice".
When the invoice is received, we book the invoice to the creditor account with again a contra-booking to the account called "Awaiting Invoice"
That way our stock value is linked into the general ledger to the invoice.

Same with selling goods, goods are shipped, contra-account is awaiting invoice, when the invoice is created, contra-account is booked reversed and cost of sales is booked.

OpenERP doesn't now "Cost of Sales" but use "Cost of Purchase" taken at the moment purchase invoice is activated.

My conclusion is that Anglo-Saxion countries have a problem with OpenERP when stock is used!
For all other kind of financial transactions I haven't found any problem yet.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [Bug 388145] Re: Financial integration warehouse-location, purchase and sale transactions

I think it just a specific configuration of accounts to be used in the
product and partners, using the stock valuation system in real time
(accounts to define on the location).

Can someone describe the exact accounting entries
(journal/account/debit/credit) to be done for different operations:

* Purchase a product
* Receive the products
* Receive the purchase invoice
* Sell product
* invoice customer
* Deliver product

Please do this with a product and simple tax on it. If you can provide
this, we can provide a configuration to be done. Thanks,

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
   -- Marty, 2005

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Thanks for your help. I hope you are right. :-)

You may use the Dutch chart l10n_nl in addons-community to have the basic setup ready.
Alternatively I can send a database backup, with all basic setup done and translated accounts in English for your convenience.

Product purchase = 10 EUR, Tax = 19% =1,19 EUR
Product sale = 30 EUR, tax = 19% = 3,57 EUR
Stock location configured with account 3000

Purchase a product
In the general ledger nothing is booked, there is packing line generated in Stock management to receive the goods

Receive the products
account 3000 = D 10 ← Type balance – Stock account, defined in location
account 2800 = C 10 ← Type balance – Interim account, Goods received, awaiting invoice

Receive the purchase invoice
account 2800 = D 10
account 1612 = D 1,19 ← Type balance – Vat account to receive
account 1500 = C 11,19 ← Type balance – Creditor account

Sell product
In the general ledger nothing is booked, there is packing line generated in Stock management to send the goods

Deliver product
account 3000 = C 10 Stock account
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice

Invoice customer
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

With this setup it doesn't matter if the goods are sent before invoicing or that the invoice is sent first and goods are delivered afterwards.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Would it ok if we do this for sales ?

Deliver product:
account 3000 = C 10 Stock account
account 7000 = D 10 Type P/L – Cost of sales

Invoice customer:
account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Cost of sales should be booked at invoice stage. (See OBSERVED RESULT in bug tracker)
Customers can have monthly invoicing for all goods purchased in the previous month.
If we would book cost of sales at shipping time, the Gross Result (= 8000 - 7000) will not reflect the real figures.

B.T.W. As you can see in the bugreport, that was the way I did first try to make the setup, but is not working in case goods are send (partly) back to supplier. Then also a Cost of sale will be booked, because product are transferred out of the stock too, not to customer, but back to supplier.

Thanks for you commitment, hope we can work to a solution for the Anglo-Saxon countries.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

To be sure we design the right solution, can you do the same entries with the following changes:
* Cost Price: 9 EUR (average or standard cost)
* Purchase Price: 10 EUR (this single purchase)

I think stock transactions must be based on the cost price and purchase entries on the purchase price. Am I right ?

Another question:
* Do you sometimes inject costs in the product's cost ? Like deliveries ?

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Some others questions:
* Can we use the same interim account for both receive and deliver operations. (that should simplify a lot our changes to do) ? Instead of 2800 and 2801, just 2800 ?
* If the products return to your warehouse and you have to generate a a refund customer invoice, what are the entries ?

I still have a doubt on something: some accounting software do not manage stock operations (purely accounting, no warehouse management system). In that case, how do these companies manage stock entries ? I think they manually do an inventory and related accouting entry at the end of the year. Do you know how this entry looks like ?

Thanks for your help. I will propose a solution, once everything is clear for me.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :
Download full text (5.7 KiB)

p.s. answered questions are below.

FLOW WHEN VALUATING STOCK TO STANDARD PRICE
Cost Price product (in product form) = 9 EUR
Product purchase (in purchase form or invoice) = 10 EUR, Tax = 19% =1,90 EUR
Product sale = 30 EUR, tax = 19% = 3,80 EUR
Stock location configured with account 3000

Receive the products
account 3000 = D 9,00 ← Type balance – Stock account, defined in location
account 1510 = C 9,00 ← Type balance – Interim account, Goods received, awaiting invoice
    (Account 1510 can been seen as addition to 1500 – Creditors)

Receive the purchase invoice
Note that creditor has added shippingcost line to the invoice. Shipping cost (or other purchase cost) should account choosen manually by the accounting user on the invoice.
account 1510 = D 9,00
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.
account 7065 = D 10,00 ← Shipping costs purchase (excl. VAT)
account 1612 = D 3,80 ← Type balance – Vat account to receive
account 1500 = C 23,80 ← Type balance – Creditor account

Deliver product
account 3000 = C 9,00 Stock account
account 1310 = D 9,00 Type balance – Interim account, Goods send, to invoice
   (Account 1310 can been seen as addition to 1300 – Debtors)

Invoice customer
account 1310 = C 9,00
account 7000 = D 9,00 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 5,70 Type balance – Vat account to pay
account 1300 = D 35,70 Type balance Debtor account

FLOW WHEN VALUATING STOCK TO AVARAGE PRICE
Cost Price product (in product form) = 9,00 EUR for delivery 1 – 7,00 EUR for delivery 2
Product sale = 30 EUR, tax = 19% = 3,80 EUR
Stock location configured with account 3000

Receive the products delivery 1
account 3000 = D 9,00 ← Type balance – Stock account, defined in location
account 1510 = C 9,00 ← Type balance – Interim account, Goods received, awaiting invoice
    (Account 1510 can been seen as addition to 1500 – Creditors)
Receive the products delivery 2
account 3000 = D 7,00 ← Type balance – Stock account, defined in location
account 1510 = C 7,00 ← Type balance – Interim account, Goods received, awaiting invoice

Receive the purchase invoice 1
Note that creditor has added shippingcost line to the invoice. Shipping cost (or other purchase cost) should account choosen manually by the accounting user on the invoice.
account 1510 = D 9,00
account 7065 = D 10,00 ← Shipping costs purchase (excl. VAT)
account 1612 = D 3,61 ← Type balance – Vat account to receive
account 1500 = C 22,61 ← Type balance – Creditor account

Receive the purchase invoice 2
Note that creditor has added shippingcost line to the invoice. Shipping cost (or other purchase cost) should account choosen manually by the accounting user on the invoice.
account 1510 = D 7,00
account 7065 = D 10,00 ← Shipping costs purchase (excl. VAT)
account 1612 = D 3,23 ← Type balance – Vat account to receive
account 1500 = C 20,23 ← Type balance – Creditor account

Deliver product
account 3000 = C 8,00 Stock account (avarage price)
account 1310 = D 8,00 Type balance – Interim account, Goods send, to invoice

Invoice customer
account 1310 = C 8,00 (Avarage price from order ...

Read more...

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

> This injected cost would be a nice to have for feature developments.
Just for info, it's already working when you set the product cost method
on average price. (you can change price when receiving them). Not
perfect, could be improved.

> All answers are generated based on my implementation- and accounting
> experiences with several ERP- and accounting software and are verified
> with book “Boekhouden geboekstaafd” from Hoogheid and Fuchs used at
> higher economic eductions in the Netherlands.

Thank you for your very good information. I think I will be able to
propose a clean solution that fits your requirements by the end of the
week. (tomorrow I have to go to EuroPython).

--
Fabien Pinckaers

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan Verlaan,

Thanks for useful information.
Can you please send me your database backup so that I can check product, location and accounts configuration?

Thanks,
HDA

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Hi HDA,
I will prepare a backup where all involved accounts are translated from Dutch to English and send to you directly via email at latest tomorrow morning.

Thanks,
Jan

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello,
I have checked this operations with new blank db.

Product purchase = 10 EUR, Tax = 19% =1,19 EUR
Product sale = 30 EUR, tax = 19% = 3,57 EUR
Stock location configured with account 3000

Purchase a product
In the general ledger nothing is booked, there is packing line generated in Stock management to receive the goods

This part is working perfect.....
Receive the products
account 3000 = D 10 ← Type balance – Stock account, defined in location
account 2800 = C 10 ← Type balance – Interim account, Goods received, awaiting invoice

Receive the purchase invoice
account 2800 = D 10 ----Here it takes indirect expense account instead of interim account. I have defined 2800 in expense account of product and now this part is working too.
account 1612 = D 1,19 ← Type balance – Vat account to receive
account 1500 = C 11,19 ← Type balance – Creditor account

Sell product
In the general ledger nothing is booked, there is packing line generated in Stock management to send the goods

This part is working perfect.....
Deliver product
account 3000 = C 10 Stock account
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice

Invoice customer
These 2 entries are not encoded.
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account--this entry takes 2801 because I have defined 2801 in incom account of product.

These 2 entries are encoded right.
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

I have started developing module for this.
I have a doubt for selecting accounts while encoding entries.
from where I should take intrim accounts? I am planning to add 2 property fields on product and category for "incoming intrim account" and "outgoing intrim account". Is this a correct solution?

For this part of entries.
Invoice customer
These 2 entries are not encoded.
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

To encode this entries we will take 2801 from intrim account of product or category.
from where I should select 7000?

Thanks for help.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Hi HDA,

please see my latest example a few comments above, where both situations (average and standard price) are given with example bookings, verified with financial books.

a copy of this for the sales invoice (read 2801 => 1310 in this case)
so you may take the average price from the order or when doing a manual invoice from stock, thus price listed on product form.

Invoice customer
account 1310 = C 8,00 (Avarage price from order or when manual invoicing from stock)
account 7000 = D 8,00 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

Regarding your proposal to add 2 property fields on product and category, that was my first solution too. It will give the most flexibilty for all countries. Will these properties also be defined in company parameters resulting in defaulting values on product and category?

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello.
From my last post.

For this part of entries.
Invoice customer
These 2 entries are not encoded.
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

To encode this entries we will take 2801 from intrim account of product or category.
from where I should select 7000?
--------------------------------------------
I meant to ask that from where I should select account 7000(Which Property from which object).

one more question for this entry part.
Receive the purchase invoice
Note that creditor has added shippingcost line to the invoice. Shipping cost (or other purchase cost) should account choosen manually by the accounting user on the invoice.
account 1510 = D 9,00
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.
account 7065 = D 10,00 ← Shipping costs purchase (excl. VAT)
account 1612 = D 3,80 ← Type balance – Vat account to receive
account 1500 = C 23,80 ← Type balance – Creditor account

from where I can select account 7095 (Which Property from which object)?
you have commented this. "Price differences creditor (also called discounts creditor) should be a parameter."

for taking amount I am very clear now.
Thanks.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Hi HDA,

Question hda: I meant to ask that from where I should select account 7000 (Which Property from which object).
Answer: Hmm, that's a technical question and I'm not that technical to point to objects in OpenERP :-(. As this property isn't there yet, I don't know.
But I know that this new property should act at the moment the sales invoice is activated, thus at the same time 8000 is taken into account. That is property_account_income_categ.?
Should it then be e.g. property_account_cogs??
I'm afraid I can't help you very much here,

Question
from where I can select account 7095 (Which Property from which object)?
Hmm, technical again.... When we have a price difference (plus or minus) between supplier invoice and or own generated invoice, you want to book the differences on a cost account. that property isn't there yet, it should be created I guess. this new property should act at the same time is purchase invoice is activated. price diffs can be taken directly at purchase time!

Hope these answers can help you further.
thansk for your commitment. I do really appreciate.

Revision history for this message
dhariwal57 (dhariwal57) wrote :

Hi,

I have attached a sheet, this is what i "think" how it should be....may be to pass it on to accounting guys......i dont "think" there should be uninvoiced sales account, it should b rather cogs (cost of goods sold) account.....

Many Thanks
Khalid Dhariwal

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

The proposition of dhariwal seems good, jan can you confirm it's right for you ?

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I just have a question about this:

2 Terms Discount Available 30 days 5% 0.50
2 Accrued Purchases/Uninvoiced Purchases 10.00
2 Input Tax @ 14% 1.40
2 Creditors Control/Accounts Payable 10.90

Currently, in Open ERP, we don't use "Terms Discount Available 30 days 5%" but "Creditors Control/Accounts Payable" for the 5%. It's much more easier for reconciliation of payments. But, after we reconcile with "Creditors Control/Accounts Payable" or "Creditors Control/Accounts Payable" depending if the customer pays or not the 5% discounted.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Here is a summary of the technical changes I propose to apply to satisfy dhariwal's examples. Before implementing, I propose to wait for the validation of Jan:

* add two properties fields on the product form, on the accounting tab:
   - account_trade_id (many2one to account.account)
   - account_variance_id (many2one to account.account)
These fields are not required and default values are set by chart of accounts.
* When confirming a purchase invoice (only on purchase invoices and purchase refund):
   - if product's "Costing Method" is "standard price":
        use account_variance_id
   - if product's "Costing Method" is "average price":
        use account_trade_id
   and generate accounting entries, using the cost price of the product for the
   expense account (the one already existing on the product form) and the other
   account for the difference between the cost price and real price on the invoice.
   If the account (variance or trade) field is empty, do like currently, assign the whole
   cost to the expense account. (which should be configured to "Accrued Purchases/Uninvoiced
   Purchases" in dhariwal's example)
* Change the stock valuation entries to select the counter-part account based on the location type (customer / supplier) instead of the Physical Stock position (source or destination). If the location type is not customer or supplier, do like currently and use the right account based on the physical stock position (the source or destination of the stock.move).

By doing these small changes, we manage all cases from dariwhal's example.

The only unsupported case is "purchase variants + trade discount at the same time". But, this can be implemented in a separate module.

Terms's discounts are already correct in Open ERP.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

I really appreciate the work of Dhariwal, but for the Anglo-Saxon accounting countries this will not work. We still miss the interim accounts and the "cost of goods sold" that are taken at the moment the sales invoice is activated!

And that's exactly the difference between the Anglo-Saxon accounting countries and the Normandy (also called Rhine or Continental) accounting countries. (Cost of Goods Sold versus Cost of Sales and the moment they are taken)
See for some background info http://www.megaessays.com/viewpaper/6498.html
http://books.google.nl/books?id=newc0QbnrAwC&pg=PA168&lpg=PA168&dq=anglo+Saxon+accounting+countries&source=bl&ots=WCw6DVO_bP&sig=WuzTPLotFpvxIKnnjBmd7t6SL8c&hl=nl&ei=_5dTSr3VJ5qQjAe1sK2eCQ&sa=X&oi=book_result&ct=result&resnum=1

Resulting that I can not accept his proposition for this specific bugreport.
Also I have my concerns with "may be pass it to the accounting guys..." as far as it concerns the Anglo Saxon accounting system. Is there a member available that does know the differences?

But for the proposition from dhariwal for the Normandy (Rhine or Continental) accounting system there are interesting added functionalities proposed that could give OpenERP added value, that could benefit also the Anglo-Saxon accounting systems.

Hope you can understand my answer.

Revision history for this message
dhariwal57 (dhariwal57) wrote :

Hi,

"I just have a question about this:
2 Terms Discount Available 30 days 5% 0.50
2 Accrued Purchases/Uninvoiced Purchases 10.00
2 Input Tax @ 14% 1.40
2 Creditors Control/Accounts Payable 10.90
Currently, in Open ERP, we don't use "Terms Discount Available 30 days 5%" but "Creditors Control/Accounts Payable" for the 5%. It's much more easier for reconciliation of payments. But, after we reconcile with "Creditors Control/Accounts Payable" or "Creditors Control/Accounts Payable" depending if the customer pays or not the 5% discounted."

As you said it is the decision at the time of reconcile. It is fine also.

Jan, sorry i did not mean to hijack the bug report, just wanted to add the information i have.

Many Thanks
Khalid Dhariwal

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Ok, is another summary:

* add two properties fields on the product form, on the accounting tab:
   - account_trade_id (many2one to account.account)
   - account_variance_id (many2one to account.account)
   - account_sale_cost_id (many2one to account.account)
These fields are not required and default values are set by chart of accounts.
* when creating a customer invoice, do a transaction with debit/credit equal to cost price of products
using accounts account_sale_cost_id (debit) and account_expense_id (credit)
* When confirming a purchase invoice (only on purchase invoices and purchase refund):
   - if product's "Costing Method" is "standard price":
        use account_variance_id
   - if product's "Costing Method" is "average price":
        use account_trade_id
   and generate accounting entries, using the cost price of the product for the
   expense account (the one already existing on the product form) and the other
   account for the difference between the cost price and real price on the invoice.
   If the account (variance or trade) field is empty, do like currently, assign the whole
   cost to the expense account. (which should be configured to "Accrued Purchases/Uninvoiced
   Purchases" in dhariwal's example)
* Change the stock valuation entries to select the counter-part account based on the location type (customer / supplier) instead of the Physical Stock position (source or destination). If the location type is not customer or supplier, do like currently and use the right account based on the physical stock position (the source or destination of the stock.move).

By doing these small changes, we manage all cases from dariwhal's example.

The only unsupported case is "purchase variants + trade discount at the same time". But, this can be implemented in a separate module.

Terms's discounts are already correct in Open ERP.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Added account_anglo_saxon module in trunk_extra_addons which is under development.

right now it is able to satisfy this transaction.

Product purchase = 10 EUR, Tax = 19% =1,19 EUR
Product sale = 30 EUR, tax = 19% = 3,57 EUR
Stock location configured with account 3000

Purchase a product
In the general ledger nothing is booked, there is packing line generated in Stock management to receive the goods

Receive the products
account 3000 = D 10 ← Type balance – Stock account, defined in location
account 2800 = C 10 ← Type balance – Interim account, Goods received, awaiting invoice

Receive the purchase invoice
account 2800 = D 10
account 1612 = D 1,19 ← Type balance – Vat account to receive
account 1500 = C 11,19 ← Type balance – Creditor account

Sell product
In the general ledger nothing is booked, there is packing line generated in Stock management to send the goods

Deliver product
account 3000 = C 10 Stock account
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice

Invoice customer
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

Please check the functionality and give feedback.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Hi hda,

I have updated (bzr) my system and copied the new account_anglo_saxon module to /addons. Created a new company (profile manufacturing) and installed the new module afterward successfully.
But I see no extra fields on product and product-category forms.
Checking the source code, I see all code in product and purchase is commented out? Should that be?

Restarting the server list the new module successfully:
INFO:init:module account_anglo_saxon: loading objects
INFO:init:module account_anglo_saxon: registering objects

What I'm doing wrong? Would like to test but not able yet to do so.

Revision history for this message
Husen Daudi (husendaudi) wrote :

set intrim accounts in stock input and stock output account of product or category.
for now I commented the code. If needed we will add those fields.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :
Download full text (4.3 KiB)

Create a new database with profile Manufacturing
Install the account_anglo_saxon module
add to stock location a ledger account (3000)
Create a product-category -> assign the 4 ledger accounts
Create a product -> assign the just created product-category
Create a purchase order for the product
Confirm the purchase order
Approve the purchase order

While approving the purchase order the below error popup.

revision-id: <email address hidden>
date: 2009-07-09 10:39:13 +0200
build-date: 2009-07-13 10:02:39 +0200
revno: 1803
branch-nick: server

revision-id: <email address hidden>
date: 2009-07-09 18:45:20 +0530
build-date: 2009-07-13 10:03:20 +0200
revno: 958
branch-nick: client

revision-id: <email address hidden>
date: 2009-07-10 13:15:30 +0530
build-date: 2009-07-13 10:04:16 +0200
revno: 2375
branch-nick: addons

Environment_Information :
PlatForm : linux2
Operating System : posix
Operating System Version : [GCC 4.3.2]
Operating System Locale : nl_NL
Python Version : 2.5.2
OpenERP-Client Version : 5.0.1
Last revision Details :

Traceback (most recent call last):
  File "/home/jverlaan/openerp/server/bin/netsvc.py", line 240, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/jverlaan/openerp/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/jverlaan/openerp/server/bin/service/web_services.py", line 568, in exec_workflow
    res = service.exec_workflow(db, uid, object, method, id)
  File "/home/jverlaan/openerp/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jverlaan/openerp/server/bin/osv/osv.py", line 137, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/home/jverlaan/openerp/server/bin/osv/osv.py", line 130, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/home/jverlaan/openerp/server/bin/workflow/wkf_service.py", line 81, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/home/jverlaan/openerp/server/bin/workflow/instance.py", line 49, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 175, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 183, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/jverlaan/openerp/server/bin/workflow/workitem.py", line 175, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/jverlaan/openerp/server/bin/workflow/worki...

Read more...

Revision history for this message
Husen Daudi (husendaudi) wrote :

Its because you are using stable addons.
pr old revision of trunk addons.
It will work with trunk addons, trunk server and trunk client only.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Hda,

Can you make a version for stable too ?

Thanks,

hda (OpenERP) wrote:
> Its because you are using stable addons.
> pr old revision of trunk addons.
> It will work with trunk addons, trunk server and trunk client only.
>

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
   -- Marty, 2005

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Oups, this is a really dangerous situation......
In the stable version we have now under development modules that are only working on trunk version!

We need a procedure that will prevent this kind of situations. This situation breaks the server.
Anyway, I will wait for the stable module version to test further.

Thanks,
Jan

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan.
Now you can test account_anglo_saxon in stable to.
Update your stable addons and test that module.
That module is added on stable extra addons too.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

TEST SOLUTION -> RESULT => OK
in the stable version from today's bazaar.

TEST SCENARIO
Insert purchase order
Validate and confirm purchase order -> picking line and draft invoice is generated => OK
process picking line, so stock is received => stock account is debit and interim account1 is credit => OK
activate the draft invoice => interim account1 is debit and creditor is credit => OK
payment made via bank => creditor account debit bank-account credit => OK

Insert Sales order
Validate and confirm sales order -> picking line is generated => OK
process picking line, so stock is delivered => stock account is credit and interim account2 is debit => OK
generate and activate the draft invoice => interim account2 is credit and debitor is debit => OK
+ COGS-account is debit and sales account is credit => OK
payment made via bank => debitor account credit and bank-account debit => OK

Many thanks for this solution.
I will test this week more advanced scenario's like credit invoices, partial receivings of goods and sending/receiving goods back and report these results back here.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Jan Verlaan (Veritos) wrote:
> TEST SOLUTION -> RESULT => OK
> in the stable version from today's bazaar.

Seems to be a good news. Please report if we can close the bug.

Thanks,

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
   -- Marty, 2005

Revision history for this message
Husen Daudi (husendaudi) wrote :

We can not close this bug as this part is ramain yet.

FLOW WHEN VALUATING STOCK TO STANDARD PRICE
Cost Price product (in product form) = 9 EUR
Product purchase (in purchase form or invoice) = 10 EUR, Tax = 19% =1,90 EUR
Product sale = 30 EUR, tax = 19% = 3,80 EUR
Stock location configured with account 3000

Receive the products
account 3000 = D 9,00 ← Type balance – Stock account, defined in location
account 1510 = C 9,00 ← Type balance – Interim account, Goods received, awaiting invoice
    (Account 1510 can been seen as addition to 1500 – Creditors)

Receive the purchase invoice
Note that creditor has added shippingcost line to the invoice. Shipping cost (or other purchase cost) should account choosen manually by the accounting user on the invoice.
account 1510 = D 9,00
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.
account 7065 = D 10,00 ← Shipping costs purchase (excl. VAT)
account 1612 = D 3,80 ← Type balance – Vat account to receive
account 1500 = C 23,80 ← Type balance – Creditor account

I have confusion about this entry.
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.

I can get difference of amount but in which account I have to debit or credit it? Shall we add new accounting property for encoding price differences?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

I will test this above scenario tomorrow. Regarding your questions:
++++++++++
I have confusion about this entry.
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.

I can get difference of amount but in which account I have to debit or credit it? Shall we add new accounting property for encoding price differences?
++++++++++

the purchase invoice is generated at order time with the prices we did know at that moment.
The supplier is sending the official invoice, and we will compare them with our generated invoice. The fact in above example is that we have a diff between both invoices.
As supplier invoice is official, we have to correct our generated invoice and price diffs should be added with a new accounting line manually. The system can't generate this line for us , so we need to select the correct account for this price diff.
Same for the delivery cost line that was added by the supplier, it is a manual action to insert a new accounting line with selecting the correct account manually.

(BTW, if we don't agree with the supplier invoice the correct way to follow is a credit note in case of a refund or an extra invoice if we want to pay more)

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

More advanced testing -> found an error

Purchase goods so you have 10 pcs in inventory and confirm invoice
Sale goods to customer 3 pcs and confirm invoice
Sofar the standard procedure is working ok.

Now customer complains about 1 product with a defect. Agreed to send the product back and make a refund. The steps to follow:
Search for the stock delivery order, and click "return packing" in the right menu and request for 1 pcs in status "to be invoiced".
This create a "incoming product" line
Receive the product in stock and create the (refund) invoice from the packing line. Confirm the invoice.

Result:
Receiving the goods back in stock
The stock account is debited and The interim account is credited => OK

Confirming the invoice
The sales account is debited and the debtor account is credited => OK
Missing the account COGS credited and interim account debited => NOK

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

HDA, to come back on your question 3 comments back:
+++++++++++++
I have confusion about this entry.
account 7095 = D 1,00 ← Type P/L – Price differences creditor (also called discounts creditor) should be a parameter.

I can get difference of amount but in which account I have to debit or credit it? Shall we add new accounting property for encoding price differences?
+++++++++++++
See my answer (2 comments back). I see your concern when ordering with the higher price already corrected in the purchase order, that does generate the invoice with the higher price!
Then when receiving the supplier invoice, the purchaser can not determine the price difference as both invoices are the same already!

In that case it would be very nice if OpenERP detects the price diffs while generating the purchase invoice and split the invoice line in 2 lines, one with the standard price and a additional line with the price diff amount.
In that case we need as suggested by you a new accounting property for encoding price differences.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan,

Fixed in stable and trunk both extra addons for out_refund invoices.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Test NOK

Case 1: NOK
Purchase 10 products, receive them in stock and validate the invoice => OK
With product check in warehouse 1 product is defect. Send product back to supplier by:
Go to the receiving picking line and use in right menu "Return Packing" and choose 1 product with invoice state "To be Invoiced".
Process the new picking line and create the refund supplier invoice. Validate this invoice.
Have a look at the chart of accounts.
COGS are credited and debtors interim account is debited => NOK
(COGS should be taken at sales time, not when sending goods back to supplier, what should happen is a reverse booking for one product).

Case 2: NOK
Purchase 10 products, receive them in stock and validate the invoice => OK
Sell 3 products to customer, confirm the sales order and do the outgoing picking. => OK
Create the customers invoice and activate => OK
Customer called for 1 received defect product, will send one product back.
Salesperson goes to the stock output line for this custom and in right menu chooses "Return packing" for 1 product in state "To be invoiced"
Receive the product by validating the newly generated picking line.
Stock account is debited and interim account is credited => OK
Create the Customer Refund invoice from the packing line
The other interim account is debited => NOK and COGS is credited => OK --- RESULT => NOK
Sales is debited and debtor account is credited => OK

Please can you test these scenario's before releasing a new solution?
Do you think we can expect a solution for the price diffs?

Many thanks thus far hda, I will retest your new to come solution.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan
Fixed above problems.
for this question
Do you think we can expect a solution for the price diffs?

I think we have to add one more property field in product and category to encode price difference entries.
Is there any other solution for that? can anybody have better suggestions?

Regards,
HDA

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Sorry,
RESULT TEST => NOK (but it seems we are almost there! :-) )

Case1: Purchase with return. NOK
Create a purchase order for 10 products and receive the products in stock. => OK
Accept the invoice for 10 products => OK
Warehouse employee found 1 defect product, in response with supplier agreed to send one product back and receive a credit note for that.
Go to the Incoming Products line for the previous order, click return packing on the menu in right side menu.
Outgoing Products line is created from stock to supplier => OK
Validate the line and ship 1 product. Interim account stock output is taken => OK
Create the invoice (Supplier Refund) from packing, the interim account stock input is taken => NOK as it is a refund, interim stock output should be taken.

Case 2: Sale with return. NOK
Exact the same issue here, in opposite.
Create a sale order for 10 products and deliver the products to customer. => OK
Accept the invoice for 10 products => OK
Customer called, he found 1 defect product, in response with customer agreed to send one product back and send a credit note for that.
Go to the Incoming Products line for the previous sales order, click return packing on the menu in right side menu.
Incoming Products line is created from customer to stock => OK
Validate the line and receive 1 product. Interim account stock input is taken => OK
Create the invoice (customer Refund), the interim account stock output is taken => NOK as it is a refund, interim stock input should be taken.

So it seems that with invoicing we still have a problem with refunds. In case of refunds (the opposite for normal invoice) also the opposite interim account should be taken.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan
Fixed refund problem. please check.

Revision history for this message
romisol (romina-cuevas) wrote :

Hello, I m have a similar problem with that, but when I choose in the product the Stock Input/Output Account, and I do a Purchase Order, no entry is in my chart of account?
And when I charge the supplier invoice only the account of the partner they moves in the chart of account.

Sorry, I am no write so good de english.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Stock accounting entries will be encoded when you validate the picking.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

TEST RESULT OK :-) :-)

Thank you hda. At the end it's that simple, but so meaningful for lot of countries!
Do you expect the solution for the price diff soon? Hope you will include it then in this solution.

Please can you extent the description in __terp.py__ for this module from;
"description" : """This module will support the Anglo-Saxons accounting methodology""",
to
"description" : """This module will support the Anglo-Saxons accounting methodology by changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales. Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at he moment the goods are shipped.
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account when the invoice is created to transfer this amount to the debtor or creditor account. """,

As this solution is so meaningful for trade and production companies in so many countries, can we expect this module to be certified in future and perhaps transferred to /addons ?
I will be standby for testing purposes.

Again thank you so far.
Jan Verlaan

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Another question? Is there a possibility to change the helptext for the stock input account and stock output account when this module get's installed?
Should it be included in this module? Ho can I help with this?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Was testing inventory corrections via menu => Stock => Periodical Inventory

Stock corrections have financial transaction too. With a product add or destroy correction the stock account is corrected with respectively one of the interim accounts which is a result of the module. (I guess the standard OpenERP accounting has a issue here too as no property field is available for inventory loss?)

This can easily be corrected with a manual correction booking based on the stock value in the Virtual Location/Inventory Loss, but OpenERP could determine the Inventory Correction transaction and book the value in General Ledger directly into a inventory loss account.
For this we need one more property field in (I guess) Company parameters to store this inventory loss account.
Can you take this in consideration when adding the functionality for price diffs?

For your information, I have tested the flow for a trade company, thus buy - stock - sell, with and without mrp and inventory corrections.
This should be tested for manufacturing too.

Revision history for this message
Thorsten Vocks (OpenBig.org) (openbig.org) wrote :
Download full text (3.5 KiB)

Thanks for your initiative regarding accounting flow.

i got the same error on installation as Jan a few posts before
with version 5.0.1 stable server, client, addons
i updated §addons" folder with todays extra-addons module
account_anglo_saxon from "stable_5.0_extra-addons".

TypeError: inv_line_create() takes exactly 5 arguments (3 given)

Complete traceback

Traceback (most recent call last):
  File "/home/vockst/openerp/server/bin/netsvc.py", line 235, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/vockst/openerp/server/bin/netsvc.py", line 74, in __call__
    return getattr(self, method)(*params)
  File "/home/vockst/openerp/server/bin/service/web_services.py", line 520, in exec_workflow
    res = service.exec_workflow(db, uid, object, method, id)
  File "/home/vockst/openerp/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/vockst/openerp/server/bin/osv/osv.py", line 137, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/home/vockst/openerp/server/bin/osv/osv.py", line 130, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/home/vockst/openerp/server/bin/workflow/wkf_service.py", line 81, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/home/vockst/openerp/server/bin/workflow/instance.py", line 49, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 171, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 179, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 171, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 179, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 54, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/home/vockst/openerp/server/bin/workflow/workitem.py", line 126, in _execute
    id_new = wkf_expr.execute(cr, ident, workitem, activity)
  File "/home/vockst/openerp/server/bin/workflow/wkf_expr.py", line 68, in execute
    return _eval_expr(cr, ident, workitem, activity['action'])
  File "/home/vockst/openerp/server/bin/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env)
  File "<string>", line 1, in <m...

Read more...

Revision history for this message
Husen Daudi (husendaudi) wrote :

This error is already fixed.
you should check your repository.
all addons and extra_addons must be from either stable or trunk compatible with your server and client versions.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello jan,
Price difference functionality has been added in module.
I am planning to implement accounting entries while computing periodical inventories.
can you please help me with this?
what should be the accounting entries while set periodical inventories?
for example I am starting my new business and set my starting inventories by periodical inventory.
after 1 month I count my inventory and some inventories are lost and some are over stocked then actual system inventories.

Thanks.
HDA

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Thank you for your contribution. I will test the price diff functionality and give back the results today.
And I'm glad to help you further with the inventory issue.

There are 2 situations we can determine.
1. When starting with OpenERP and we want to bring in our starting inventory from previous period.
2. When making stock corrections in a running OpenERP

SITUATION 1:
Is a pure balance situation.
We bring in the current inventory via stock corrections with all goods in house based on the price in productform. If location has a account configured the value will be booked debit on this account. <== is current situation = OK
The contra credit booking is done based on account mentioned in "stock_input_account" thus for accountanglo_saxon module to the in between account.
As situation 1 is a one time exercise, I can live with this and will transfer the total credit amount of this stock input to a temporary account.
When bringing in the beginning balance, I have a amount from the previous system for my inventory. I will book this amount debit on my temporary account. If both values are the same, my temporary account will be zero then. If I have differences between both systems, then I will book the difference to a appreciated account, most likely a inventory lost account.

SITUATION 2:
We have a running OpenERP system and while doing a inventory count/check we determine stock quantity differences.
Inventory account is debited or credited based on the correction (plus or minus correction)
The contra account used is again the stock_input_account or stock_output_account based on the correction
This should be changed with a (company)parameter that will point to a inventory loss account in general ledger.

Thus here we have to modify the current flow for the contra booking.
Do not use the stock_input_account or stock_output_account BUT use a new to be created parameter that stores the inventory loss account.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Fatal Error when testing Price diffs.
Filled the field in Product-Categories with a account for the new field "Price Difference Account"
Then when opening the product tree / form via Menu -> Products -> Products the following error is generated;

Environment Information :
PlatForm : Linux-2.6.27-14-generic-i686-with-debian-lenny-sid
Operating System : posix
Operating System Release : 2.6.27-14-generic
Operating System Version : #1 SMP Tue Jun 30 19:57:39 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : nl_NL.UTF8
Python Version : 2.5.2
OpenERP-Client Version : 5.0.1
Last revision No. & ID :Traceback (most recent call last):
  File "/home/jverlaan/openerp_stable/openerp/server/bin/netsvc.py", line 240, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/service/web_services.py", line 568, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/jverlaan/openerp_stable/openerp/addons/stock/product.py", line 175, in fields_view_get
    res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/orm.py", line 1213, in fields_view_get
    result['arch'] = _inherit_apply_rec(result['arch'], sql_res[3])
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/orm.py", line 1209, in _inherit_apply_rec
    result = _inherit_apply(result, inherit)
  File "/home/jverlaan/openerp_stable/openerp/server/bin/osv/orm.py", line 1169, in _inherit_apply
    raise AttributeError(_("Couldn't find tag '%s' in parent view !") % tag)
AttributeError: Couldn't find tag '<xpath expr="/form/notebook/page/field[@name='property_account_expense']">' in parent view !

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Just reflecting the current status :-)

Changed in openobject-addons:
assignee: nobody → hda (hda)
status: New → In Progress
Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Oups, was another hda, now the right one.

Changed in openobject-addons:
assignee: hda (hda) → hda (OpenERP) (hda-tinyerp)
Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan,

I have tested on both stable and trunk. It works here.
can you please try to create new database? or run server with -u all -d db_name option?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Hi hda, a new database and upgrading a copy database both works. Seems I did something wrong while upgrading.

My test results:
The total flow of purchasing, receiving goods and confirming the invoice is working as expected => OK

But I found a problem when returning goods to the supplier with a credit invoice.
Then the price diff functionality is not used, so my price diff account is not credited and my interim account is credited for the full amount.
As the interim account was debited while doing the purchase invoice with the standard price (and the rest to the price-diff account) this account is incorrect credited, as also my price diff account.

Please can you have a look soon? We try to go live this weekend and it would be super to have this in place.
Thanks, Jan

Revision history for this message
Husen Daudi (husendaudi) wrote :

From supplier invoice I run credit note wizard and press button refund invoice.
It created supplier refund invoice.
I confirm that invoice and all entries are ok.
I am getting 3 entries.
1> price diff account credited.
2> Intrim account credited.
3> creditors debited.

Are you following the same steps? or am I tested wrongly?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

We have different tested;

Purchase 1 product with a higher price then the standard price
Receive 1 product
Create purchase invoice
Validate the invoice => OK price diffs are booked in general ledger. :-)

The products is defect, we will sent back to supplier
Go to shipping line where you received the product
Click return packing in the right side menu and choose for 1 pcs product -> to be invoiced
Ship the products and create the supplier refund invoice via the right side menu (choose purchase journal and refund supplier)
Validate the invoice <== Here it goes wrong, it takes the total amount of the invoice, but it is not splitted to general ledger with the price diffs.

Result is that general ledger is been left with valued price-diff ammount <==> valued interim account amount.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan,

Improved credit note wizard on invoice and picking both.
Added product_id_change method too so that you can directly create invoice with price difference and without price difference.
Can you please test once again? I hope this time everything will work OK.
Thanks for your contribution and help.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

TESTED => OK
:-) :-) :-) :-) Thank you hda, this patch will be loaded today in our system. To speak in logistic terms, JIT. ;-)

Regarding my question in comment 48;
"As this solution is so meaningful for trade and production companies in so many countries, can we expect this module to be certified in future and perhaps transferred to /addons ?"

If that is the case we can make this module depended in the l10n_xx modules for Anglo Saxon countries, like NL, ENG, GER, USA, the Scandinavian countries and several East - and the new European countries. That would be a great step forward.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Did find a little bug, that prevents a invoice from state draft -> confirmed, in some circumstances.
It is in the module account_anglo_saxon invoice.py line 107 =>
                    res += diff_res
The 4 tabs used is one to less, resulting in that diff_res is not set if the for loop is not executed.
Should be 5 tabs.
Please can you correct the tabs problem? Can you also higher up the version number for this module? Otherwise the description changed in __terp__.py is not reflected in OpenERP-client modules.

With kind regards,
Jan

Revision history for this message
Husen Daudi (husendaudi) wrote :

Fixed

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Find an other small issue.

For calculating price differences, this should not happen if product type is "service". It should only happen for real products.
Thus particular code should be enhanced with smoething like
"if not product_type = service" then do price_diff calculation

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Forget my previous comment, it can be overruled by setting the same ledger account at productlevel. The booking will be splitted against the standard price, but will be booked on the correct ledger with the same movement number.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Fixed with condition for type != 'service'
why should we bother database with one more move line? so its better not to create new move line.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Thanks, this is the better solution!

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :
Download full text (4.1 KiB)

Seems that the account_anglo_saxon is broken with the latest openerp updates. :-(
Prerequisite:
Stock location must have GL-account
Product category must have stock_input, stock_output and price_diff GL-account
Product must have configured product-category

Reproduction steps:
1. Create a PO
2. Receive the goods in stock
3. Go to the invoice, change the product price, so a price-diff is there.
4. Accept the (changed) invoice. Error pop up.
(if there is no price-diff created on the invoice, everything works ok)

The error-message is:
++++++++++++++++++++++++++++++++++++++++++
Environment Information :
System : Linux-2.6.28-15-generic-i686-with-Ubuntu-9.04-jaunty
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty
Operating System Release : 2.6.28-15-generic
Operating System Version : #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.2
OpenERP-Client Version : 5.0.2
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/jverlaan/openerp/5_0_2/server/bin/netsvc.py", line 240, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/jverlaan/openerp/5_0_2/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/jverlaan/openerp/5_0_2/server/bin/service/web_services.py", line 577, in exec_workflow
    res = service.exec_workflow(db, uid, object, method, id)
  File "/home/jverlaan/openerp/5_0_2/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jverlaan/openerp/5_0_2/server/bin/osv/osv.py", line 137, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/home/jverlaan/openerp/5_0_2/server/bin/osv/osv.py", line 130, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/wkf_service.py", line 81, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/instance.py", line 49, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 175, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 183, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 54, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/home/jverlaan/openerp/5_0_2/server/bin/workflow/workitem.py", line 108, in _execute
    wkf_expr.execute(cr, ident, workitem, activity)
  File "/home/jverlaan/openerp/5_0_2/server/bin...

Read more...

Revision history for this message
Husen Daudi (husendaudi) wrote :

Fixed in revision
trunk extra addons : 3778 <email address hidden>
stable extra addons : 3913 <email address hidden>

Changed in openobject-addons:
status: In Progress → Fix Released
Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Thank you very much for the solution. I installed and tested ok for standard UOM.

But I found a new one when using storage unit is a pear (2 pieces) and purchase unit is a box of 15 pear (30 pieces) Both units depent on the standard pcs UOM.
Then 1 piece (defauld UOM) is taken as contra booking and the rest is booked as price difference.
It seems that the module is not taken into account the purchase unit.
Hope you will have a look at it.

With kind regards,
Jan

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Excuse moi, pear = pair.

I did write above that 1 pcs is taken for the contra-booking, but that is wrong, it should be the storage unit defined, thus a pair (is 2 pieces). Resulting in that only the purchase unit is not taken into account while writing the stock valuation. it writes-off the value of 1 pair to the interim account and the value of 14 pairs to the price-diff account.

It seems that this is solved for the standard about 2 weeks ago, but is not ported to this module.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jan.
Fixed UOM price calculation problem on revision 3924 <email address hidden>
Can you please test and send me feedback?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Just came back from a short break and see your comment. I will test tomorrow ans give you the results. :-)
Thanks

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Test result => OK
test setup:
Product with storage unit = pair (2 pcs)
Product purchase unit = box (15 pair = 30 pcs)
Cost price = 3.20 (for a pair)
Created a purchase order for this product. Defaults to 1 box with price = 48,00 => OK
Received the product in warehouse, where 15 pairs are stored => OK
Interim account shows value of 48,00 => OK
Received the invoice from supplier with price = 47,93 + tax
Modified the OpenERP draft invoice from 48,00 to 47,93 and validated. => OK
General ledger shows a location value of 48,00 minus a price diff of 0,07 => OK
Interim account shows a write-off of 48,00 => OK
Creditor account shows the invoice amount 47,93 + tax => OK

Thanks you very much for this fix, hda. I really appreciate your commitment.
I guess we may finish this bugtracker and report eventually new findings in a new bugreport.

Before you do so , I will ask you to give OpenERP's commitment to this meaningful solution for so many countries. Can you adopt this in /addons and certify the module? As a result OpenERP will support more countries and secondly the Odoo offer can be used by many more clients in these countries as only certified solutions are included in Odoo.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) wrote :

Can someone help me with this module:

In "Product Category" and "Product" form I see only "Price difference account"
(apart of "Income account", "Expense account", "Stock output account", "Stock input account").

This bugreport indicated that three field will be added:
   - account_trade_id (many2one to account.account)
   - account_variance_id (many2one to account.account)
   - account_sale_cost_id (many2one to account.account)
Why I don't see Trade and Sale?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

The trade and sale you are referring to, are replacements for Stock input account and Stock output account.
Resulting in that you can define Stock input account and Stock output account for respectively trade and sale.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) wrote :

Thank you for answer and for this requirement. I think wee in PL need this functionality too.
So I want to clarify: I have checked this functionality WITHOUT anglo_saxon module and these fields (Stock input account and Stock output account) worked as expected. Does it mean that this functionality is added to main module and anglo_saxon is just for Price difference? Or anglo_saxon module changes functionality of these fields?

Second thing is that after Customer invoice it should be two accounting moves. Where should I define the first of them. See the hda entry of this thread below the line. It is one move after product shipping, and two moves after customer invoice. I can configure just second (with VAT tax). Where first one should be defined?

hda wrote in this thread:
___________________________________
Added account_anglo_saxon module in trunk_extra_addons which is under development.

right now it is able to satisfy this transaction.

Product purchase = 10 EUR, Tax = 19% =1,19 EUR
Product sale = 30 EUR, tax = 19% = 3,57 EUR
Stock location configured with account 3000

Purchase a product
In the general ledger nothing is booked, there is packing line generated in Stock management to receive the goods

Receive the products
account 3000 = D 10 ← Type balance – Stock account, defined in location
account 2800 = C 10 ← Type balance – Interim account, Goods received, awaiting invoice

Receive the purchase invoice
account 2800 = D 10
account 1612 = D 1,19 ← Type balance – Vat account to receive
account 1500 = C 11,19 ← Type balance – Creditor account

Sell product
In the general ledger nothing is booked, there is packing line generated in Stock management to send the goods

Deliver product
account 3000 = C 10 Stock account
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice

Invoice customer
account 2801 = C 10
account 7000 = D 10 Type P/L – Cost of sales

account 8000 = C 30,00 Type P/L Sales account
account 1602 = C 3,57 Type balance – Vat account to pay
account 1300 = D 33,57 Type balance Debtor account

Please check the functionality and give feedback.

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

The account_anglo_saxon module does change the behavior of the account module. (from technical point of view it inherit object account)
Then the behavior of Stock input account and Stock output account is modified. Those act WITH account_anglo_saxon as the so called Interim accounts.
When the goods are received or send these interim accounts are used for the financial transaction and with the second step when invoice is set from draft to active these interim accounts will be contra booked and the amount is transferred then to the debtor or creditor.

A small description is available into the module and readable when installing. Perhaps we have to extent this more.
I will extent doc.openerp.com as soon as the module is listed here. Still it is not added to the docs.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) wrote :

Thank you for your patience but I still need very small information. Where account 7000 in following schema should be defined. If I make mistake somewhere else please correct my entries after word "defined". I have exercised few cases and have no idea how it works.
________________________________________
Receive the products
account 3000 = D 10 ← Type balance – Stock account, - defined in location
account 2800 = C 10 ← Type balance – Interim account, Goods received, awaiting invoice - defined in "stock input account" in product category.

Receive the purchase invoice
account 2800 = D 10 defined in "Expense account" of product cetegory
account 1612 = D 1,19 ← Type balance – Vat account to receive defined in VAT settings
account 1500 = C 11,19 ← Type balance – Creditor account - defined in "Account Payable" of supplier

Sale

Deliver product
account 3000 = C 10 Stock account - defined in location
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice - defined in "Stock Output Account" in product category.

Invoice custome
account 2801 = C 10 - defined in "Stock output Account" in product category
account 7000 = D 10 Type P/L – Cost of sales - defined ???????? WHERE??????

account 8000 = C 30,00 Type P/L Sales account - defined in "Income account" in product category.
account 1602 = C 3,57 Type balance – Vat account to pay - defined in VAT settings
account 1300 = D 33,57 Type balance Debtor account - Defined in "Account receivable" in partner.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) wrote :

Anyway I found an error. When Customer invoice is in other currency (not home one) the additional booking (posting?) from interim account to Cost of sales treats Cost price of product like in currency. But the amount is taken from field "Cost Price" in Product which is always in home currency.

I mean posting with 2801 and 7000 in above exemple.

If make invoice in USD (home currency EUR).

it is:

Deliver product
account 3000 = C 10 Stock account - defined in location
account 2801 = D 10 Type balance – Interim account, Goods send, to invoice - defined in "Stock Output Account" in product category.

Invoice custome
account 2801 = C 13 - defined in "Stock output Account" in product category
account 7000 = D 13 Type P/L – Cost of sales - defined ???????? WHERE??????

So booking TO interim account is 10 and FROM interim account is 13.

Revision history for this message
keenboy (alex-adaptive-it) wrote :
Download full text (3.6 KiB)

I have an issue:

STEP 4:
Create the invoice (via former packingscreen) or via Menu → Stock Management → Outgoing products → packing to be invoiced. Pusch “Create” button to change status from Draft to Open

I get the following error report:

Local variable 'dif_res' referenced before assignment

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 577, in exec_workflow
    res = service.exec_workflow(db, uid, object, method, id)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 136, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 129, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_service.py", line 81, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/instance.py", line 50, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 175, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 183, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 54, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 108, in _execute
    wkf_expr.execute(cr, ident, workitem, activity)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_expr.py", line 68, in execute
    return _eval_expr(cr, ident, workitem, activity['action'])
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env)
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 168, in <lambda>
    return lambda *args, **argv: getattr(self._table, name)(self._cr, self._uid, [self._id], *args, **argv)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account/invoice.py", line 504, in action_move_create
    iml = self._get_analytic_lines(cr, uid, inv.id)
  ...

Read more...

Revision history for this message
Husen Daudi (husendaudi) wrote :

This is already fixed in latest trunk extra addons.
please update your code.
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-extra-addons

Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

First of all, thanks for the whole work been made to achieve the functionality of the module, indeed, congratulations.

Whenever you make a credit note for a sale, and the client send back some products, the accounting move made by openerp takes into account the last cost of sale of the product and not the previous one used when sale was made, this happens whenever there have been a purchase in the meantime,with different prices for the products involved, between the sale and the credit note.

The accounting people has advised me that the cost of sale should be the same one when the product was invoiced and not the current one.

They say this should be the correct behaviour for the credit note and not the one used right now, because if the full sale is refunded then there will be mismatches between the movelines in the sale and the credit note,

Thank in advance for your attention,

Revision history for this message
jerzyo (jerzyo) wrote :

Hi

I seem to have a similar problem but I am not sure because I am using a polish chart of accounts.

When I do stock moves, when buying/ selling I see the moves on corresponding inventory accounts. However, I do not see the moves on "Stock Input account" and "Stock Output Account" defined for product. Can you list requirements for these accounts, their counterparts and other configuration needed to set it up properly?

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Jerzyo,

You need to define general account on source and destination stock location of stock move.
because it will make double entry for incoming and outgoing pickings.
it will take one account from products' input and output account and another from stock location.

Revision history for this message
Salim (s-satiro) wrote :

Hello,

As I need to book the cost of sales at the invoicing time I intalled the account-anglo-saxon module.

When I try to validade the invoice I get the error message which follows attached.

I believe the problem has to do with setting up the system.

Could anybody tell me where I should enter the accounts ? Mainly the COGS account that I didn't realize where it should go in after reading this post ?

?field.comment=Hello,

As I need to book the cost of sales at the invoicing time I intalled the account-anglo-saxon module.

When I try to validade the invoice I get the error message which follows attached.

I believe the problem has to do with setting up the system.

Could anybody tell me where I should enter the accounts ? Mainly the COGS account that I didn't realize where it should go in after reading this post ?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

See comment #80
https://bugs.launchpad.net/openobject-addons/+bug/388145/comments/80
These accounts are set in "products" or on a higher level at "category" into the financial data tab.

B.t.w. the error in screenshot is not due to module account_anglo_saxon but related to module account_analytic_plans.

Revision history for this message
ehsan azh (ehsanazh) wrote :

hi
i have an ideal :
how about manage inventory accounting from location accounting information stock valuation accounting(input/output) per location .
unfortunately
account info allowed to changed when location type is procurement so if you manage to let us change it per location it isnt very hard to config inventory accounting.

Revision history for this message
Bun Hin (cbunhin) wrote :

Hi All,

I am new to Odoo (Open ERP), but i have similar problem of this stock integration with accounting entries.
Just install Odoo Version 8, I believe it the bugs should be fixed already in this odoo latest version right?
what need to be done to make the solution work in the latest version (v8)?

When i try the simulation using:

Sales account (P&L) for INCOME ACCOUNT
Cost of Good Sold (P&L) for EXPENSE ACCOUNT

Good Receivet Not Invoiced (GRNI) for INPUT ACCOUNT
Good Sent Not Invoiced (GSNI) for OUTPUT ACCOUNT
Stock for STOCK VALUATION ACCOUNT

the stock journal is having correct entry when GOOD RECEIVE is confirmed
but why the purchase journal entry take Cost Of Good Account directly ? even before i create sales or sales invoice.
It is also not debit back the GRNI

In journal configuration i have tried to put stock account as default debit and payable account as default credit account, and try other combination as well, but still get wrong result or refused with error message that the account is not valid.

I know this is long time thread already, could anybody help me please?

Starting with what account i should put into respected field (Income, expense, input, output, valuation )
what purchase journal default account to be used (default debit account and credit account)

Thank you for any helping response.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers