Skip to main content

Posts

Showing posts from June, 2017

Odoo 10: Close wizard and open standard form

Hi, Today we are going to learn how to open standard form after saving data in wizard. Let's say I have created an wizard to fill basic User details and once saved open default User form. Here is the xml code for my wizrd: <record id="view_custom_user_wizard" model="ir.ui.view">         <field name="name">Create User</field>         <field name="model">res.users</field>         <field name="arch" type="xml">             <form string="Create User">                 <group>             <field name="company_id" />             <field name="name" required="1"/>             <field name="login" required="1"/>             <field name="password" required="1" pas...

Odoo: Download Binary File in v10

To download any binary file in Odoo10 following is the link: http://127.0.0.1:8069/web/content?model=<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id> module_name    - the name of the model with the Binary field field_name         - the name of the Binary field object_id            - id of the record containing particular file. field_filename    - name of a Char field containing file's name (optional). So if you want to call a function on button click and download the file, code is as follow: file_url = "http://127.0.0.1:8069/web/content?model=<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id>" return {     'type': 'ir.actions.act_url',     'url': file_url,     'target': 'new' } In Reports or web page, you can u...

Emails not working in PHP/Ubuntu

Hi, lot of solutions are there to fix this problem but I feel somewhere, sometimes we miss the basic part... It may be possibility that we don't have sendemail  utility itself not installed. Please install by running following command. sudo apt-get install sendmail -y If issue is still there please check following link: https://www.digitalocean.com/community/questions/do-i-need-to-configure-anything-to-use-php-mail-function-on-fresh-lamp-install Thanks!!!! Enjoy Programming :)

Odoo: Set/use context in email templates

Today we are going to discuss, how to use/change the context in dynamic/custom templates. Let's say we want to send some values to an email template other than normal object id, here is the code for that In controllers/main.py local_context = request.env.context.copy() In module.py file local_context = self.env.context.copy() local_context.update({     'name': 'Shiv',     'place': 'Bangalore' }) template = request.env.ref('module_name.email_template_id')             template.with_context(local_context).send_mail(object.id, force_send=True, raise_exception=True) In email template code you can access context as: <p>${ctx['name']}</p> <p>${ctx[' place ']}</p> That's it. To know how to create a custom email template, please check here:  http://www.odoo.yenthevg.com/creating-mail-templates/ Thanks!!! Enjoy Programming!!! :)