Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Create a virtualenv and install the dependencies"
A block of code is set as follows:
from odoo import models, fields, api class LibraryBook(models.Model): # [...] state = fields.Selection([('draft', 'Unavailable'), ('available', 'Available'), ('borrowed', 'Borrowed'), ('lost', 'Lost')], 'State')
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
def export_stock_level(self, stock_location): import pdb; pdb.set_trace() products = self.with_context(location=stock_location.id).search([]) fname = join(EXPORTS_DIR, 'stock_level.txt') try: with open(fname, 'w') as fobj: for prod in products.filtered('qty_available'): fobj.write('%s\t%f\n' % (
prod.name, prod.qty_available)) except IOError: raise exceptions.UserError('unable to save file')
Any command-line input or output is written as follows:
$ ../odoo/odoo-bin --save --config myodoo.cfg --stop-after-init
In the example above $ is the command line prompt, and it should not be typed. When the command line prompt is a hash sign (#), this means that the command must be run as the root user. Some command lines had to be wrapped on multiple lines due to the width of the pages. In these cases, there is a backslash (\) at the end of the line. When typing the command you may want to ignore these backslashes completely and not input them, entering the whole command on a single line. If you choose to type them, you must not add any spaces after the backslash and hit the Return key immediately to insert a new line character just after the backslash.
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Go to the Settings menu."
Warnings or important notes appear like this.
Tips and tricks appear like this.