diff --git a/accounting/localizations/mexico.rst b/accounting/localizations/mexico.rst index ab9ec2af3..cdba42e96 100644 --- a/accounting/localizations/mexico.rst +++ b/accounting/localizations/mexico.rst @@ -262,14 +262,43 @@ If the invoice is not paid. Payments (Just available for CFDI 3.3) -------------------------------------- -To generate the payment complement you just must to follow the normal payment +To generate the payment complement you only need to follow the normal payment process in Odoo, this considerations to understand the behavior are important. -1. All payment done in the same day of the invoice will be considered as It - will not be signed, because It is the expected behavior legally required - for "Cash payment". -2. To test a regular signed payment just create an invoice for the day before - today and then pay it today. +1. To generate payment complement the payment term in the invoice must be + PPD, because It is the expected behavior legally required for + "Cash payment". + + **1.1. How can I generate an invoice with payment term `PUE`?** + + `According to the SAT documentation`_ a payment is classified as `PUE` if + the invoice was agreed to be fully payed before the 17th of the next + calendar month (the next month of the CFDI date), any other condition + will generate a `PPD` invoice. + + **1.2. How can I get this with Odoo?** + + In order to set the appropriate CFDI payment term (PPD or PUE), you can + easily set it by using the `Payment Terms` defined in the invoice. + + - If an invoice is generated without `Payment Term` the attribute + `MetodoPago` will be `PUE`. + + - Today, if is the first day of the month and is generated an invoice with + `Payment Term` `30 Net Days` the `Due Date` calculated is going to be + the first day of the following month, this means its before the 17th of + the next month, then the attribute `MetodoPago` will be `PUE`. + + - Today, if an invoice is generated with `Payment Term` `30 Net Days` and + the `Due Date` is higher than the day 17 of the next month the + `MetodoPago` will be `PPD`. + + - If having a `Payment Term` with 2 lines or more, for example + `30% Advance End of Following Month`, this is an installments term, + then the attribute `MetodoPago` will be `PPD`. + +2. To test a normal signed payment just create an invoice with payment term + `30% Advance End of Following Month` and then register a payment to it. 3. You must print the payment in order to retrieve the PDF properly. 4. Regarding the "Payments in Advance" you must create a proper invoice with the payment in advance itself as a product line setting the proper SAT code @@ -622,6 +651,7 @@ FAQ .. _Finkok: https://www.finkok.com/contacto.html .. _`Solución Factible`: https://solucionfactible.com/sf/v3/timbrado.jsp .. _`SAT resolution`: http://sat.gob.mx/informacion_fiscal/factura_electronica/Paginas/Anexo_20_version3.3.aspx +.. _`According to the SAT documentation`: https://www.sat.gob.mx/cs/Satellite?blobcol=urldata&blobkey=id&blobtable=MungoBlobs&blobwhere=1461173400586&ssbinary=true .. _`given by the SAT`: http://sat.gob.mx/informacion_fiscal/factura_electronica/Documents/GuiaAnexo20DPA.pdf .. _`Anexo 24`: http://www.sat.gob.mx/fichas_tematicas/buzon_tributario/Documents/Anexo24_05012015.pdf .. _`official information here`: http://www.sat.gob.mx/fichas_tematicas/declaraciones_informativas/Paginas/declaracion_informativa_terceros.aspx diff --git a/odoo_sh/advanced/submodules.rst b/odoo_sh/advanced/submodules.rst index 7a0bc889a..a01157293 100644 --- a/odoo_sh/advanced/submodules.rst +++ b/odoo_sh/advanced/submodules.rst @@ -102,3 +102,10 @@ for more details about the Git submodules. For instance, if you would like to update your submodules to have their latest revision, you can follow the chapter `Pulling in Upstream changes `_. + +Ignore modules +============== + +If you're adding a repository that contains a lot of modules, you may want to ignore some of them in case there are any +that are installed automatically. To do so, you can prefix your submodule folder with a :code:`.`. The platform will +ignore this folder and you can hand pick your modules by creating symlinks to them from another folder. diff --git a/odoo_sh/getting_started.rst b/odoo_sh/getting_started.rst index 8193c6a88..944b8b863 100644 --- a/odoo_sh/getting_started.rst +++ b/odoo_sh/getting_started.rst @@ -12,4 +12,5 @@ Get started getting_started/builds getting_started/status getting_started/settings + getting_started/online-editor getting_started/first_module diff --git a/odoo_sh/getting_started/branches.rst b/odoo_sh/getting_started/branches.rst index e813e371f..43978ba0c 100644 --- a/odoo_sh/getting_started/branches.rst +++ b/odoo_sh/getting_started/branches.rst @@ -181,11 +181,25 @@ and open a shell on your database by typing :code:`psql`. .. image:: ./media/interface-branches-shell.png :align: center +You can open multiple tabs and drag-and-drop them to arrange the layout as you wish, +for instance side by side. + .. Note:: Long running shell instances are not guaranteed. Idle shells can be disconnected at anytime in order to free up resources. +Editor +------ +An online integrated development environment (IDE) to edit the source code. +You can also open terminals, Python consoles and even Odoo Shell consoles. + +.. image:: ./media/interface-branches-editor.png + :align: center + +You can open multiple tabs and drag-and-drop them to arrange the layout as you wish, +for instance side by side. + Logs ---- A viewer to have a look to your server logs. diff --git a/odoo_sh/getting_started/builds.rst b/odoo_sh/getting_started/builds.rst index ec858c91f..089ffe9e0 100644 --- a/odoo_sh/getting_started/builds.rst +++ b/odoo_sh/getting_started/builds.rst @@ -117,7 +117,8 @@ in the dropdown menu of the *Connect* button. .. image:: ./media/interface-builds-build-dropdown.png :align: center +.. _odoosh-gettingstarted-builds-dropdown-menu: + In the dropdown menu of the build, you can access the same features than in :ref:`the branches view `: -*Logs*, *Web Shell*, *Outgoing e-mails*. -You also have the possibility to *Download a dump* of the build's database and for the production database only, -you have the ability to *Make a test duplicate*. +*Logs*, *Web Shell*, *Editor*, *Outgoing e-mails*. +You also have the possibility to *Download a dump* of the build's database. diff --git a/odoo_sh/getting_started/first_module.rst b/odoo_sh/getting_started/first_module.rst index 2967700a5..4b0f0648c 100644 --- a/odoo_sh/getting_started/first_module.rst +++ b/odoo_sh/getting_started/first_module.rst @@ -27,7 +27,38 @@ Replace these by the values of your choice. Create the development branch ============================= -Clone your Github repository on your machine: +From Odoo.sh +------------- + +In the branches view: + +* hit the :code:`+` button next to the development stage, +* choose the branch *master* in the *Fork* selection, +* type *feature-1* in the *To* input. + + |pic1| |pic2| + +.. |pic1| image:: ./media/firstmodule-development-+.png + :width: 45% + +.. |pic2| image:: ./media/firstmodule-development-fork.png + :width: 45% + + +Once the build created, you can access the editor and browse to the folder *~/src/user* to access +to the code of your development branch. + +.. image:: ./media/firstmodule-development-editor.png + :align: center + +.. image:: ./media/firstmodule-development-editor-interface.png + :align: center + +From your computer +------------------ + + +Clone your Github repository on your computer: .. code-block:: bash @@ -50,20 +81,25 @@ Scaffolding the module ---------------------- While not necessary, scaffolding avoids the tedium of setting the basic Odoo module structure. -It nevertheless requires *odoo-bin*, and therefore the -`installation of Odoo `_ on your machine. +You can scaffold a new module using the executable *odoo-bin*. -If you do not want to bother installing Odoo on your machine, -you can also :download:`download this module structure template ` in which you replace every occurrences of -*my_module* to the name of your choice. +From the Odoo.sh editor, in a terminal: -Use *odoo-bin scaffold* to generate the module structure in your repository: +.. code-block:: bash + + $ odoo-bin scaffold my_module ~/src/user/ + +Or, from your computer, if you have an `installation of Odoo `_: .. code-block:: bash $ ./odoo-bin scaffold my_module ~/src/odoo-addons/ -This will generate the below structure: +If you do not want to bother installing Odoo on your computer, +you can also :download:`download this module structure template ` in which you replace every occurrences of +*my_module* to the name of your choice. + +The below structure will be generated: :: @@ -134,12 +170,28 @@ Commit your changes Push your changes to your remote repository +From an Odoo.sh editor terminal: + +.. code-block:: bash + + $ git push https HEAD:feature-1 + +The above command is explained in the section +:ref:`Commit & Push your changes +` of the +:ref:`Online Editor ` +chapter. +It includes the explanation regarding the fact you will be prompted to type your username and password, +and what to do if you use the two-factor authentication. + +Or, from your computer terminal: + .. code-block:: bash $ git push -u origin feature-1 You need to specify *-u origin feature-1* for the first push only. -From that point, to push your future changes, you can simply use +From that point, to push your future changes from your computer, you can simply use .. code-block:: bash @@ -262,13 +314,14 @@ Add a change This section explains how to add a change in your module by adding a new field in a model and deploy it. -In your module, edit the file *models/models.py* +From the Odoo.sh editor, + * browse to your module folder *~/src/user/my_module*, + * then, open the file *models/models.py*. -.. code-block:: bash - - $ nano ~/src/odoo-addons/my_module/models/models.py - -We encourage you to use the editor of your choice, such as *Atom*, *Sublime Text*, *PyCharm*, instead of *nano*. +Or, from your computer, + * use the file browser of your choice to browse to your module folder *~/src/odoo-addons/my_module*, + * then, open the file *models/models.py* using the editor of your choice, + such as *Atom*, *Sublime Text*, *PyCharm*, *vim*, ... Then, after the description field @@ -282,11 +335,7 @@ Add a datetime field start_datetime = fields.Datetime('Start time', default=lambda self: fields.Datetime.now()) -Then, edit the file *views/views.xml* - -.. code-block:: bash - - $ nano ~/src/odoo-addons/my_module/views/views.xml +Then, open the file *views/views.xml*. After @@ -309,11 +358,7 @@ these changes requires the module to be updated. If you would like the update to be performed automatically by the Odoo.sh platform when you push your changes, increase your module version in its manifest. -Edit the module manifest - -.. code-block:: bash - - $ nano ~/src/odoo-addons/my_module/__manifest__.py +Open the module manifest *__manifest__.py*. Replace @@ -329,11 +374,24 @@ with The platform will detect the change of version and trigger the update of the module upon the new revision deployment. -Stage your changes to be committed +Browse to your Git folder. + +Then, from an Odoo.sh terminal: + +.. code-block:: bash + + $ cd ~/src/user/ + +Or, from your computer terminal: .. code-block:: bash $ cd ~/src/odoo-addons/ + +Then, stage your changes to be committed + +.. code-block:: bash + $ git add my_module Commit your changes @@ -342,7 +400,15 @@ Commit your changes $ git commit -m "[ADD] my_module: add the start_datetime field to the model my_module.my_module" -Push your changes +Push your changes: + +From an Odoo.sh terminal: + +.. code-block:: bash + + $ git push https HEAD:feature-1 + +Or, from your computer terminal: .. code-block:: bash @@ -371,9 +437,9 @@ your module. Create a file *requirements.txt* in the root folder of your repository -.. code-block:: bash +From the Odoo.sh editor, create and open the file ~/src/user/requirements.txt. - $ nano ~/src/odoo-addons/requirements.txt +Or, from your computer, create and open the file ~/src/odoo-addons/requirements.txt. Add @@ -384,11 +450,7 @@ Add Then use the library in your module, for instance to remove any special characters in the name field of your model. -Edit the file *models/models.py* - -.. code-block:: bash - - $ nano ~/src/odoo-addons/my_module/models/models.py +Open the file *models/models.py*. Before @@ -426,11 +488,7 @@ Add Adding a Python dependency requires a module version increase for the platform to install it. -Edit the module manifest - -.. code-block:: bash - - $ nano ~/src/odoo-addons/my_module/__manifest__.py +Edit the module manifest *__manifest__.py* Replace @@ -444,11 +502,24 @@ with 'version': '0.3', -Then stage, commit and push your changes +Stage and commit your changes: .. code-block:: bash $ git add requirements.txt $ git add my_module $ git commit -m "[IMP] my_module: automatically remove special chars in my_module.my_module name field" + +Then, push your changes: + +In an Odoo.sh terminal: + +.. code-block:: bash + + $ git push https HEAD:feature-1 + +In your computer terminal: + +.. code-block:: bash + $ git push diff --git a/odoo_sh/getting_started/media/firstmodule-development-+.png b/odoo_sh/getting_started/media/firstmodule-development-+.png new file mode 100644 index 000000000..501f19b83 Binary files /dev/null and b/odoo_sh/getting_started/media/firstmodule-development-+.png differ diff --git a/odoo_sh/getting_started/media/firstmodule-development-editor-interface.png b/odoo_sh/getting_started/media/firstmodule-development-editor-interface.png new file mode 100644 index 000000000..bb059fbdb Binary files /dev/null and b/odoo_sh/getting_started/media/firstmodule-development-editor-interface.png differ diff --git a/odoo_sh/getting_started/media/firstmodule-development-editor.png b/odoo_sh/getting_started/media/firstmodule-development-editor.png new file mode 100644 index 000000000..9ec91c61a Binary files /dev/null and b/odoo_sh/getting_started/media/firstmodule-development-editor.png differ diff --git a/odoo_sh/getting_started/media/firstmodule-development-fork.png b/odoo_sh/getting_started/media/firstmodule-development-fork.png new file mode 100644 index 000000000..b243f538a Binary files /dev/null and b/odoo_sh/getting_started/media/firstmodule-development-fork.png differ diff --git a/odoo_sh/getting_started/media/interface-branches-editor.png b/odoo_sh/getting_started/media/interface-branches-editor.png new file mode 100644 index 000000000..db98c80aa Binary files /dev/null and b/odoo_sh/getting_started/media/interface-branches-editor.png differ diff --git a/odoo_sh/getting_started/media/interface-branches-shell.png b/odoo_sh/getting_started/media/interface-branches-shell.png index 0403a84e1..92bebfc1c 100644 Binary files a/odoo_sh/getting_started/media/interface-branches-shell.png and b/odoo_sh/getting_started/media/interface-branches-shell.png differ diff --git a/odoo_sh/getting_started/media/interface-builds-build-dropdown.png b/odoo_sh/getting_started/media/interface-builds-build-dropdown.png index 1626ea5c6..17300a857 100644 Binary files a/odoo_sh/getting_started/media/interface-builds-build-dropdown.png and b/odoo_sh/getting_started/media/interface-builds-build-dropdown.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-automaticreload.gif b/odoo_sh/getting_started/media/interface-editor-automaticreload.gif new file mode 100644 index 000000000..36be2420c Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-automaticreload.gif differ diff --git a/odoo_sh/getting_started/media/interface-editor-commit-push.png b/odoo_sh/getting_started/media/interface-editor-commit-push.png new file mode 100644 index 000000000..110c7ae34 Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-commit-push.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-console-odoo-graph.png b/odoo_sh/getting_started/media/interface-editor-console-odoo-graph.png new file mode 100644 index 000000000..dda714d3e Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-console-odoo-graph.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-console-odoo-pretty.png b/odoo_sh/getting_started/media/interface-editor-console-odoo-pretty.png new file mode 100644 index 000000000..0b545aff4 Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-console-odoo-pretty.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-console-python-read-csv.png b/odoo_sh/getting_started/media/interface-editor-console-python-read-csv.png new file mode 100644 index 000000000..264af9cf1 Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-console-python-read-csv.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-open-file.png b/odoo_sh/getting_started/media/interface-editor-open-file.png new file mode 100644 index 000000000..7719c8ef8 Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-open-file.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-save-file.png b/odoo_sh/getting_started/media/interface-editor-save-file.png new file mode 100644 index 000000000..d0e22eceb Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-save-file.png differ diff --git a/odoo_sh/getting_started/media/interface-editor-update-current-module.png b/odoo_sh/getting_started/media/interface-editor-update-current-module.png new file mode 100644 index 000000000..c57472afa Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor-update-current-module.png differ diff --git a/odoo_sh/getting_started/media/interface-editor.png b/odoo_sh/getting_started/media/interface-editor.png new file mode 100644 index 000000000..ed51e596c Binary files /dev/null and b/odoo_sh/getting_started/media/interface-editor.png differ diff --git a/odoo_sh/getting_started/online-editor.rst b/odoo_sh/getting_started/online-editor.rst new file mode 100644 index 000000000..6442952ed --- /dev/null +++ b/odoo_sh/getting_started/online-editor.rst @@ -0,0 +1,195 @@ +:banner: banners/odoo-sh.jpg + +.. _odoosh-gettingstarted-online-editor: + +================================== +Online Editor +================================== + +Overview +======== + +The online editor allows you to edit the source code of your builds from a web browser. +It also gives you the possibility to open terminals, Python consoles, Odoo Shell consoles and +`Notebooks `_. + +.. image:: ./media/interface-editor.png + :align: center + +You can access the editor of a build through +:ref:`the branches tabs `, +:ref:`the builds dropdown menu ` +or by adding */odoo-sh/editor* to your build domain name +(e.g. *https://odoo-addons-master-1.dev.odoo.com/odoo-sh/editor*). + +Edit the source code +==================== + +The working directory is composed of the following folders: + +:: + + . + ├── home + │ └── odoo + │ ├── src + │ │ ├── odoo Odoo Community source code + │ │ │ └── odoo-bin Odoo server executable + │ │ ├── enterprise Odoo Enterprise source code + │ │ ├── themes Odoo Themes source code + │ │ └── user Your repository branch source code + │ ├── repositories The Git repositories used by your project + │ ├── data + │ │ ├── filestore database attachments, as well as the files of binary fields + │ │ └── sessions visitors and users sessions + │ └── logs + │ ├── install.log Database installation logs + │ ├── odoo.log Running server logs + │ ├── update.log Database updates logs + │ └── pip.log Python packages installation logs + +You can edit the source code (files under */src*) in development and staging builds. +For production builds, the source code is read-only, because applying local changes on a production +server is not a good practice. + +* The source code of your Github repository is located under */src/user*, +* The source code of Odoo is located under + + * */src/odoo* (`odoo/odoo `_), + * */src/enterprise* (`odoo/enterprise `_), + * */src/themes* (`odoo/design-themes `_). + +To open a file in the editor, just double-click on it in the file browser panel on the left. + +.. image:: ./media/interface-editor-open-file.png + :align: center + +You can then begin to make your changes. You can save your changes with the menu +:menuselection:`File --> Save .. File` or by hitting the :kbd:`Ctrl+S` shortcut. + +.. image:: ./media/interface-editor-save-file.png + :align: center + +If you save a Python file which is under your Odoo server addons path, +Odoo will detect it and reload automatically so your changes are reflected immediately, +without having to restart the server manually. + +.. image:: ./media/interface-editor-automaticreload.gif + :align: center + +However, if the change is a data stored in database, such as the label of a field, or a view, +you have to update the according module to apply the change. +You can update the module of the currently opened file by using the menu +:menuselection:`Odoo --> Update current module`. Note that the file considered as currently opened +is the file focused in the text editor, not the file highlighted in the file browser. + +.. image:: ./media/interface-editor-update-current-module.png + :align: center + +You can also open a terminal and execute the command: + +.. code-block:: bash + + $ odoo-bin -u --stop-after-init + +.. _odoosh-gettingstarted-online-editor-push: + +Commit & Push your changes +========================== + +You have the possibility to commit and push your changes to your Github repository. + +* Open a terminal (:menuselection:`File --> New --> Terminal`), +* Change the directory to *~/src/user* using :code:`cd ~/src/user`, +* Stage your changes using :code:`git add`, +* Commit your changes using :code:`git commit`, +* Push your changes using :code:`git push https HEAD:`. + +In this last command, + +* *https* is the name of your *HTTPS* Github remote repository + (e.g. https://github.com/username/repository.git), +* HEAD is the reference to the latest revision you committed, +* must be replaced by the name of the branch to which you want to push the changes, + most-likely the current branch if you work in a development build. + +.. image:: ./media/interface-editor-commit-push.png + :align: center + +.. Note:: + The SSH Github remote is not used because your SSH private key + is not hosted in your build containers (for obvious security concerns) + nor forwarded through an SSH Agent (as you access this editor through a web browser) + and you therefore cannot authenticate yourself to Github using SSH. + You have to use the HTTPS remote of your Github repository to push your changes, + which is added automatically named as *https* in your Git remotes. + You will be prompted to enter your Github username and password. + If you activated the two-factor authentication on Github, + you can create a + `personal access token `_ + and use it as password. + + +.. Note:: + The Git source folder *~/src/user* is not checked out on a branch but rather on a detached revision: + This is because builds work on specific revisions rather than branches. + In other words, this means you can have multiple builds on the same branch, but on different revisions. + +Once your changes are pushed, +according to your :ref:`branch push behavior `, +a new build may be created. You can continue to work in the editor you pushed from, +as it will have the same revision as the new build that was created, but always make sure to be +in an editor of a build using the latest revision of your branch. + +Consoles +======== + +You can open Python consoles, which are +`IPython interactive shells `_. +One of the most interesting addition to use a Python console +rather than a IPython shell within a terminal is the +`rich display `_ +capabilities. +Thanks to this, you will be able to display objects in HTML. + +You can for instance display cells of a CSV file using +`pandas `_. + +.. image:: ./media/interface-editor-console-python-read-csv.png + :align: center + +You can also open an Odoo Shell console to play around +with the Odoo registry and model methods of your database. You can also directly read or write +on your records. + +.. Warning:: + In an Odoo Console, transactions are automatically committed. + This means, for instance, that changes in records are applied effectively in the database. + If you change the name of a user, the name of the user is changed in your database + as well. + You therefore should use Odoo consoles carefully on production databases. + +You can use *env* to invoke models of your database registry, e.g. :code:`env['res.users']`. + +.. code-block:: python + + env['res.users'].search_read([], ['name', 'email', 'login']) + [{'id': 2, + 'login': 'admin', + 'name': 'Administrator', + 'email': 'admin@example.com'}] + +The class :code:`Pretty` gives you the possibility +to easily display lists and dicts in a pretty way, using the +`rich display `_ +mentioned above. + +.. image:: ./media/interface-editor-console-odoo-pretty.png + :align: center + +You can also use +`pandas `_ +to display graphs. + +.. image:: ./media/interface-editor-console-odoo-graph.png + :align: center