How to do it...

In order to call the export_stock_level() method from the Odoo shell, you need to perform the following steps:

  1. Start the Odoo shell specifying your project configuration file:
    $ ./odoo-bin shell -c project.conf --log-level=error  
  1. Check for error messages, and read the information text displayed before the usual Python command-line prompt:
env: <odoo.api.Environment object at 0x7fac2ac2d990>
odoo: <module 'odoo' from '/home/cookbook/odoo/odoo/__init__.pyc'>
openerp: <module 'odoo' from '/home/cookbook/odoo/odoo/__init__.pyc'>
self: res.users(1,)
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
  1. Get a recordset for product.product:
    >>> product = env['product.product']  
  1. Get the main stock location record:
    >>> location_stock = env.ref('stock.stock_location_stock')
  1. Call the export_stock_level() method:
    >>> product.export_stock_level(location_stock)
  1. Commit the transaction before exiting:
    >>> env.cr.commit()
  1. Exit the shell by pressing Ctrl D
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.177.14