Author: ananthukrishna

How to call python function from QWeb


.xml code

<t t-foreach="o._get_purchase_mrn_details(o.origin,pack_operation.product_id)" t-as="purchase_line">
   <td class="text-right"><span t-esc="purchase_line['price_unit']"/></td>                            
   <td class="text-right"><span t-esc="purchase_line['taxes_id']"/></td>
   
</t>

.py code

@api.multi
    def _get_purchase_mrn_details(self,origin,product_id):
        if origin and product_id:
            self.ensure_one()
            purchase_data = []
            purchase_order_obj = self.env['purchase.order'].search([('name','=',origin)])
            order_line_ids = purchase_order_obj.order_line.mapped('product_id')
            for line in purchase_order_obj.order_line:
                if line.product_id.id == product_id.id:
                    purchase_data.append ({
                        'price_unit': line.price_unit,
                        'taxes_value': line.taxes_id.amount,
                        'taxes_id': line.taxes_id.name,
                    })
            return purchase_data
Advertisements

How to git clone without SSL Verify ?


git config http.sslVerify false

in your specific repo to disable SSL certificate checking for that repo only.

In case you don’t have a git repo yet then you can modify the global config

git config --global http.sslVerify false

OSError: [Errno 98] Address already in use



odoo@odoo-11:~/odoo$ ps -fA | grep python

root 1680 1 1 09:16 ? 00:00:01 /usr/bin/python3 /usr/sbin/aptd
odoo 2369 2350 0 09:19 pts/10 00:00:00 grep python
odoo 5760 1 0 يون10 ? 00:01:07 python3 ./odoo-bin -d hr

odoo@odoo-11:~/odoo$ sudo kill 1680
odoo@odoo-11:~/odoo$ sudo kill 2369
odoo@odoo-11:~/odoo$ sudo kill 5760

How to Reset Encrypted Password for Admin User in Odoo v8, v9, v10 and v11?


Login as postgres user:

sudo su postgres;

Switch to the database in question:

psql <databaseName>;

List all users with their passwords:

select * from res_users;

Now copy the password and use it in the following command:

update res_users set password_crypt = ‘<copiedPasswordFromAbove>’ where id = ‘1’;

That’s it. Go and login with username admin and password you used to register the user in the first place.

If it helped you… don’t forget to share this post on your wall. It may be helpful to someone else.

Dump Postgresql


OPTION 1
Dump DB
$ sudo pg_dump --no-owner db_name > /opt/db_name.sql or .dump

Restore DB
$ sudo su postgres
$ psql
$ create database db_name;
$ psql db_name > db_name.sql
OPTION 2
Dump DB
$ sudo pg_dump --no-owner db_name | gzip > /opt/db_name.sql.gz

Restore DB
createdb  db_name -T template1 -U odoo -h localhost
zless db_name.sql.gz | psql db_name

VirtualBox can’t find host-only adapters on Windows 10


I get the same results when using the command lines tools. The creation of new interfaces works without problems:

C:\> VBoxManage.exe hostonlyif create
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface 'VirtualBox Host-Only Ethernet Adapter #5' was successfully created

But VirtualBox can’t find the adapters, as the following command does not return any output:

$ VBoxManage.exe list hostonlyifs