Number Format Qweb report (thousand seperator)

<td><span t-esc="'{0:,.2f}'.format(pack_operation.standard_price * pack_operation.ordered_qty)"/></td>

merge same product id one2many odoo (group by dictionary python) – odoo

input = [
{'product_id': '001', 'location_id': 'NISR', 'qty': 100, 'uom_id': 'roll', 'cost' :50, 'categ_id': 'ALL'},
{'product_id': '001', 'location_id': 'NISR', 'qty': 200, 'uom_id': 'roll', 'cost' :50, 'categ_id': 'ALL'},
{'product_id': '001', 'location_id': 'NISR', 'qty': 300, 'uom_id': 'roll', 'cost' :50, 'categ_id': 'ALL'},
{'product_id': '002', 'location_id': 'NISR', 'qty': 400, 'uom_id': 'roll', 'cost' :20, 'categ_id': 'ALL/SUB'},
{'product_id': '002', 'location_id': 'NISR', 'qty': 500, 'uom_id': 'roll', 'cost' :20, 'categ_id': 'ALL/SUB'},
{'product_id': '002', 'location_id': 'NISR', 'qty': 600, 'uom_id': 'roll', 'cost' :20, 'categ_id': 'ALL/SUB'},
{'product_id': '003', 'location_id': 'NISR', 'qty': 700, 'uom_id': 'roll', 'cost' :30, 'categ_id': 'ALL'},

grouper = itemgetter("product_id", "location_id", "uom_id" ,"cost")
result = []
for key, grp in groupby(sorted(input, key = grouper), grouper):
    temp_dict = dict(zip(["product_id", "location_id","uom_id", "cost"], key))
    temp_dict["categ_id"]=  (list(set(item["categ_id"] for item in grp))[0])
    temp_dict["qty"] = sum(item["qty"] for item in grp)
    temp_dict["amount"] =  temp_dict["cost"] * temp_dict["qty"]
from pprint import pprint

[{'amount': 0,
  'categ_id': 'ALL',
  'cost': 50,
  'location_id': 'NISR',
  'product_id': '001',
  'qty': 0,
  'uom_id': 'roll'},
 {'amount': 0,
  'categ_id': 'ALL/SUB',
  'cost': 20,
  'location_id': 'NISR',
  'product_id': '002',
  'qty': 0,
  'uom_id': 'roll'},
 {'amount': 0,
  'categ_id': 'ALL',
  'cost': 30,
  'location_id': 'NISR',
  'product_id': '003',
  'qty': 0,
  'uom_id': 'roll'}]

mail create using python – odoo

    def create(self, vals):
        values = {}
        mail_mail = self.env['mail.mail']
        # context: no_log, because subtype already handle this
        result = super(HelpdeskTicket, self.with_context(mail_create_nolog=True)).create(vals)

        values['subject'] = 'ePillars Support Case Created - %s  [%s]' % (,
        values['body_html'] = """<html>
                                Case Number:	"""+str( +"""<br/>
                                Support Account Name:	"""+ str("""<br/>
                                Support Account Email:	"""+ str(result.partner_email)+"""<br/>
                                Status:	New <br/>
                                Subject:	"""+str( +"""<br/><br/><br/>

                                You will not be able to 'Reply' to this e-mail. If you wish to contact us,<br/> 
                                Please call +97143263939.
        values['email_from'] = 'ePillars Support<>'
        values['email_to'] = result.partner_email
        values['reply_to'] = 'noreply<>'
        if values['email_to']:
            mail= mail_mail.create(values)
        return result

Reinstall mysql server using Ubuntu Terminal

To remove or uninstall Mysql Client Core 5.5 separately, I used the following commands:

sudo apt-get remove –purge mysql-server mysql-client mysql-common
sudo apt-get remove –purge mysql-client-core-5.5
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql

Now install or reinstall mysql client and server:

sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install mysql-workbench

How to add new button box – odoo

class Employee(models.Model):
    _inherit = "hr.employee"

    def view_onboard(self):
        onboard_ids = []
        action = self.env.ref('feag_hr.open_view_onboarding_action').read()[0]

        onboard = self.env['employee.onboard'].search([('name', '=',])
        for data in onboard:

        action['domain'] = [('id', 'in', onboard_ids)]
        return action
<record id="cf_hr_onboard_view_employee_form" model="ir.ui.view">
        <field name="name">hr.employee.form</field>
        <field name="model">hr.employee</field>
        <field name="inherit_id" ref="hr.view_employee_form"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='button_box']" position="inside">
                <button name="view_onboard" type="object" string="Onboarding" groups="hr.group_hr_user"
                                    class="oe_stat_button" icon="fa-file-text">

hide edit and create button for users – odoo

        <!-- hiding create and edit button for users -->
        <record id="fair_hide_view_picking_form" model="ir.ui.view">
        <field name="name">stock.picking.form</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_form"/>
        <field name="groups_id" eval="[(4,ref('fair_construction.group_fair_user'))]"/>
        <field name="arch" type="xml">
            <xpath expr="/form" position="attributes">
                <attribute name="create">false</attribute>
                <attribute name="edit">false</attribute>