Running Postgresql Queries from Linux Command’s Terminal

To Access Postgresql Interface, Enter command

$ psql db_name

You will be switched to shell below

psql (9.5.5)
Type “help” for help.

db_name=#

Now run your queries as:

Queries for Information Schemas
db_name=# select table_name from information_schema.tables;
db_name=# select table_name from information_schema.tables where table_name is like ‘%cms%’;
db_name=# select table_name from information_schema.columns where table_name = ‘res_users’;

Queries for User Defined Tables
db_name=# select name, father_name from cms_entryregis where id in (1,2,3,4,5);

Advertisements

Using <xpath> in OpenERP/ odoo


<template id="report_saleorder_document">
  <t t-call="report.external_layout">
    <div class="page">
      <h2>
        <span t-field="doc.name"/>
      </h2>
      <table class="table table-condensed">
        <thead>
          <tr>
            <th>Description</th>
            <th class="text-right">Quantity</th>
            <th class="text-right">Unit Price</th>
            <th t-if="display_discount" class="text-right"</th>
            <th class="text-right">Taxes</th>
            <th class="text-right" name="price_subtotal_head">Price</th>
          </tr>
        </thead>
      </table>
    </div>
  </t>
</template>

Using to add new label:

Option 1:

<xpath expr="//th[@name='price_subtotal_head']" position="after">
  <th class="text-right">New Label</th>
</xpath>

Option 2:

<xpath expr="//t/div/table/thead/tr/th[5]" position="after">
  <th class="text-right">New Label</th>
</xpath>

Option 3:

<xpath expr="//t/div/table/thead/tr/th[last()]" position="after">
  <th class="text-right">New Label</th>
</xpath>