This question has been flagged
10 Replies
18356 Views

Hello,

I have more than 300 products , I need to export the product name, cost price and current quantity.

Since the numbers of records exceeds 90, I have to do this by bunch of 90's.

Is it possible to do it one shot?

Also int the export fields I can only find foretasted qty, no other qty information is available.

help is appreciated.

Avatar
Discard
Best Answer

You can set the number of lines in the product menu to 80, 100, 200, 500 or unlimited.

Set it to unlimited and it lists all your products.

Go in the right hand menu to export.

If you click on it there is a dropdown menu in wich you can choose for:

  • Import Compatible Export (this is the default)
  • Export All Data

Choose for Export All Data.

Now extra fields are available for export like:

  • Quantity Available
  • Quantity On Hand
Avatar
Discard

You have to go to Warehouse -> Products and not Sales -> Products to check unlimited value for listing all products..

Best Answer

Another option is to use a script, which:

  1. connects to the server
  2. initializes the model(s) you want to export
  3. loop through all the models
  4. write the needed data.

#Example of script I run openERP V7 on a Ubuntu 12.04 server, and have installed openerp-client-lib

Than I made a script:

import openerplib

line = '-' * 40

h : "localhost"

db : 'test1'

u : "admin"

p : 'test654'

def fieldValues(m):

print line

print '-' *10, m

model = connection.get_model(m)

fields = model.fields_get()

# get the IDs, and sorted by 'id'
ids = model.search([],0,0,'id')
if ids == []:
  for f in fields:
    print f

for i in ids:
  print '-' *15, i

  for f in fields:
    info = model.read(i, [f])
    print f,':', info

def fieldData(m):

print line

print '-' *10, m

model = connection.get_model(m)

# get the IDs, and sorted by 'id'
ids = model.search([],0,0,'id')

for i in ids:
  print '-' *15, i
  print model.copy_data(i)

#Begin the process of getting data

print line

print '-' * 5, 'Host:', h

print '-' * 5, 'Database:', db

print line

connection = openerplib.get_connection(hostname=h, database=db, login=u, password=p)

models = { 'sale.order', }

for m in models:

fieldValues(m)

for m in models:

fieldData(m)

print line

#summary Method fieldValues(m) gives you all the fields of the model, with the associated value.

Method fieldData(m) gives you all the data, including the related models (for example when your model is sale.order, than you also get all the related sale.order.lines).

Avatar
Discard
Author

An example would be very helpful. Now am facing another problem the field forcasted qty is not being shown anymore in the export dialog

Best Answer

For posterity: This is a problem, even in v10.0. The easiest solution for an administrator is to simply edit the "limit" tag in the address line:

http://123.123.123.167:8069/web#min=1&limit=2000&view_type=list&model=product.product&menu_id=190&action=307

...where the 2000 number is the limit of the items displayed.

Avatar
Discard

Excelent answer :)

Best Answer

A good way to do this is to locate view_list.js and add more selectable number of rows to the options available. That is add 90 to the list. ...addons/web/static/src/js/view_list.js add

'<option value=90">90</option>' + to

to the options

                var $select = $('<select>')
                    .appendTo($this.empty())
                    .click(function (e) {e.stopPropagation();})
                    .append('<option value="80">80</option>' +
                            '<option value="100">100</option>' +
                            '<option value="200">200</option>' +
                            '<option value="500">500</option>' +
                            '<option value="90">90</option>' +        this would help you I think                       
                            '<option value="NaN">' + _t("Unlimited") + '</option>')
                    .change(function () {
                        var val = parseInt($select.val(), 10);
Avatar
Discard
Best Answer

How about the opposite of this... importing many products...i.e product name, cost price and current quantity... with like 2000 unique products?

Avatar
Discard

Can you post a new question, than we do not mix things. Quick answer: using webinterface to import, or use a script.

Best Answer

When you are listing your products, you are able to change how many products you show in each screen. It is located on the right corner of your screen.

Avatar
Discard

I have already given this answer. See above.