Hello sir, I have tried a lot for updating an existing product,s stock using IMPORT option. I have created my own excel sheet with columns Warehouse, product reference, Stock for that only three columns . but I am always getting “duplicate ERROR” after the simulation. Please help on this
Pls. submit your first two lines of your spreadsheet as CSV. Which Dolibar version?
Please see the csv file and error image. I am using the version8.0.3
Please see the csv file(.txt) and error image(.jpeg). I am using 8.0.3
Pièces jointes :
- UPDATE_stockCSV.txt (87 Bytes)
Why not use the given names of the import scheme as header info? That does work (Tested on 8.0.4)
Product Warehouse Stock
PREF123456 ALM001 10
You IMPORT NEW products.
You UPDATE EXISTING products.
You are trying to IMPORT EXISTING products so yes you will get a duplicate error as the product ALREADY exists.
Look at the import screen image more carefully: “Key column to use when UPDATING existing data”
In this line you choose the csv field that Dolibarr should use to match your csv with your existing products, i.e. the product reference.
Yes I found the option “Key column to use when UPDATING existing data” .but I can not edit the value to "product reference " because Its totally disabled. May I know why the text message "No update attempt was performed, only insert " showing inside the box
Firstly my apologies for not actually trying to replicate your request (for lack of time), I had assumed “user error” as I did not think for one minute that a stock update would not be available.
But, you are completely correct, the code to allow the UPDATE of existing products is missing!
I cannot understand how could this be possible/how this glaring omission has not been reported/fixed many years ago.
I can confirm this issue is still existing in the development version (10 alpha).
While I flag this up and submit a PR on Github, you can fix it yourself with this change.
Of course, try this on your development server first, always assume any untested code change will self-destruct your server and eat your cat unless you first try it out for yourself on a testing environment. It worked for me, but I use the development codebase.
In
htdocs/core/modules/modStock.class.php
change
$this->import_examplevalues_array[$r]=array(
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
);
to
$this->import_examplevalues_array[$r]=array(
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
);
//mod for stock update: https://www.dolibarr.org/forum/12-howto-help/28659-import-new-stock-of-existing-products/reply/35770
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'Ref');
//eof mod
i have the same issue but for me is importing vtigercrm existing data to dolibarr 8.0.3 vosion i really need help i have tried all my best it still showing error in the SIMULATION part
If you are trying to IMPORT NEW products, this is not the same issue at all, you are posting in the wrong thread.
Looks to me like your file has headers in each column and you are not telling the import to start from line 2.
@alebj, @manso…if your issues have been resolved, please take the time to report back…
Please see the error after editing the PHP file in the directory. I have taken a copy of the same file in the same location before editing.
Your reply is incomplete…you have an error message…what have you done to investigate it?
Is the message correct? ARE there multiple instances of “8” in the table?
please note my CSV file in the following link. The file "UPDATE_stockCSV " is already posted in this thread before. Please check.
CSV file
The following is the content.
Product (ps.fk_product),Warehouse(ps.fk_entrepot),Stock (ps.reel),
CAPX1,NEWIMPORT,10,
You can see there is only one product in the table and so no multiple instance, but the same product(CAPX1) is already in the warehouse(NEWIMPORT) where I want to do the stock update.
I have done the changes what you said in your previous reply . The file located in "htdocs/core/modules/modStock.class.php ". I just inserted the following line of code as you said
$this->import_updatekeys_array[$r]=array(‘sp.fk_product’=>‘Ref’);
I am not an expert in PHP , please correct me if I am doing any thing wrong.
in phpmyadmin, export the table llx_product_stock as a csv and post a link to it please.
Please wait few days ,next two days are holiday for us here. I will reply on Monday .thank you
“in phpmyadmin, export the table llx_product_stock as a csv and post a link to it please”
I think This is not as simple task for me like you, because I am totally unknown to “phpmyadmin”. If you can provide any link that will explain how to do this it is better. other wise please wait for one or two days let me try my own way.
I doubt you need someone to explain how to find information on the internet…
Hi,
I am having problems updating existing products with version 12.0.2. PHP 7.4.0 MYSQL 5.7.28 I have updated htdocs/core/modules/modStock.class.php but still no change. I’m hoping this information might help us to fix the problem.
This is a copy of the CSV file I am using to update:-
This is a picture of Step 4
This is a picture of Step 5 with Product as a reference
Run simulation and no error
Press “IMPORT DATA” and says it is successful
When I look at the items it does not show any stock. Picture of the first line item below:-
When I try to export CSV as below
I cannot export in any format as below
Sorry I can’t help at the moment…since posting here I have not been working with Dolibarr at all.