I entered one product 2 times in openerp. For eg suppose i have a product 0000000A-Black But i unknowingly entered 1) 0000000A-Black 2) 0000000A-Blac
and both products have been used in purchase orders means both have receptions. How can i correct this error?
(On a copy of the database to begin with!) my approach would be :
- Put OpenERP in
- mouse over the relevant fields to get their model and field names
- get into the database and query the relevant tables (where model name is
product.categorythe table name would be
- find the record of the product and the records of a 'good' purchase order and a 'bad' one.
- examine all the foreign key fields to understand how many need to be changed
- try updating the 'bad' purchase order to match the 'good' one where appropriate.
- test shipping the goods and receiving payment (on your disposable database copy, of course) to be sure you handled all FK relations correctly.
Feel free to ask further questions in the comment area of this answer.
I will reply with edits to my answer.
Let's say your "good" and "bad" products look like this.
dbVardan=> select id, name_template from product_product where name_template like '0000000A%'; id | name_template ------+---------------- 202 | 0000000A-Black 203 | 0000000A-Blac (2 rows)
So, "good" records, are all those that refer to the product id #202, and "bad" records, are all those that refer to the product id #203.
So with a purchase order like:
dbVardan=> select id, partner_id, name from purchase_order; id | partner_id | name ----+------------+--------- 83 | 19 | PO00083 (1 row)
Some of the attributes look like this :
dbVardan=> select id, partner_id, order_id, product_id, name from purchase_order_line; id | partner_id | order_id | product_id | name ------+------------+----------+------------+---------------- 654 | 19 | 83 | 203 | 0000000A-Blac (1 row)
To fix, you'd do ...
update purchase_order_line set product_id = 202 , name = '0000000A-Black' where id = 654;
... and up with:
dbVardan=> select id, partner_id, order_id, product_id, name from purchase_order_line; id | partner_id | order_id | product_id | name ------+------------+----------+------------+---------------- 654 | 19 | 83 | 202 | 0000000A-Black (1 row)
Obviously, do this on a disposable clone of your database.
To rapidly detect all places where a change might be required:
- learn how to make a text file backup of your data base with pg_dump
- learn how to use the command diff
- save a text snapshot of your database.
- with no other users connected or doing anything, run through the complete cycle of: purchase, partial receive, back order, stock move, sell, deliver, AR
- save another snapshot of your database
- run diff to find every place where that cycle caused update/insert actions to occur.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 5/6/13, 5:36 AM|
|Seen: 1074 times|
|Last updated: 3/16/15, 8:10 AM|