odut 1.6.0
Odoo utility functions with command line interfaces.
Keywords: odut

====
odut
====

.. image:: https://pyup.io/repos/gitlab/minglyu/odut/shield.svg
     :target: https://gitlab.com/minglyupolimi/odut
     :alt: Updates

Odoo utility functions with commnd line interfaces.

1.Before runing the scripts, make sure you have activated your virtual enviroment,
and installed the dependencies:  

``pip3 install -r requirements.txt``


Features
--------
1. Safely remove dependencies of the Odoo modules...
you can either pass modules in a list from the cmd line, or you can just use a file
with the modules listed in the first line of the file.  


Install the package from the source
-----------------------------------
``pip3 install odut``


**Windows**::

  $ odut --modules "['account', 'crm']" --base_dir 'Path to your addons'

**Macos/Linux**::

  $ odut --modules "['account', 'crm']" --base_dir 'Path to your addons'


Deployment
-----------

Start a PostgreSQL server
............................

  ::

  $ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10

Start an Odoo instance
.......................

  ::

  $ docker run -p 8069:8069 --name odoo --link db:db -t odoo


(Optional)Delete unnecessary modules
......................................

  ::

  $ docker exec -it --user root odoo bash
  $ pip3 install --upgrade pip
  $ pip3 install odut
  $ # incase of: ImportError: cannot import name 'main'
  $ hash -d pip3 # multiple times!
  $ alias odut=./var/lib/odoo/.local/bin/odut
  $ find . -name '*odoo*' # to find the odoo addons using find.
  $ # usually in this directory ./usr/lib/python3/dist-packages/odoo/addons/ 
  $ odut --modules "['crm', 'inventory', 'sales']" --base_dir '/usr/lib/python3/dist-packages/odoo/addons/' 


Stop and restart an Odoo instance
..................................

  ::

  $ docker stop odoo
  $ docker start -a odoo


Packaging Up
-------------

Locally
........

Develop mode::

  $ # testing locally in development mode.
  $ python setup.py develop

  $ python setup.py develop --uninstall

Editable Mode::

  $ pip install -e .

This is similar to running ``python setup.py develop`` in that it
installs your package using a symlink to your development code.


Packaging up to Pypi
.....................

(Optional) Bumpversion::

  $ bumpversion --allow-dirty --current-version 1.4.0  minor setup.py

Create the distribution file::

  $ python3 setup.py sdist bdist_wheel

run commands to check the errors::

  $ twine check dist/*

Uploading to Pypi::

  $ python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*


Re Upload to pypi
..................

change the version number in setup.py and __init__.py file::

  $ rm -r dist/
  $ rm -r build/

then, redo the procedures.


**Caution**:dist file of same name cannot be uploaded again.

https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/introduction.html

Test
------

https://docs.pytest.org/en/latest/goodpractices.html


About setup.py
---------------

python setup.py install is used to install (typically third party) packages that you're not going 
to develop/modify/debug yourself.

For your own stuff, you want to first install your package and then be able to frequently edit 
the code without having to re-install the package every time — and that is exactly what python 
setup.py develop does: 

it installs the package (typically just a source folder) in a way that allows you to 
conveniently edit your code after it’s installed to the (virtual) environment,
and have the changes take effect immediately.

Note that it is highly recommended to use pip install . (install) and pip install -e . (developer install) 
to install packages, as invoking setup.py directly will do the wrong things for many dependencies, such as pull
prereleases and incompatible package versions, or make the package hard to uninstall with pip.

Credits
--------

minglyupolimi@gmail.com


=======
History
=======

0.1.0 (2019-06-29)
------------------

* First release on PyPI.