how to call python method from server action in odoo 9
<p>I want try to call the python method from server action in same module . but there is no error found but the method is not called . I also follow this link <a href="https://www.odoo.com/forum/help-1/question/how-to-open-a-form-with-ir-action-server-which-executes-python-code-61910" rel="nofollow">for call the python method</a> . This is the code i use for call the method .</p>

<p>.xml</p>

<pre><code>&lt;record id="action_email_data_parser_server" model="ir.actions.server" &gt;
  &lt;field name="name"&gt;[Server Action] Create Leads from Mail&lt;/field&gt;
  &lt;field name="model_id" ref="model_email_data_parser"/&gt;
  &lt;field name="condition"&gt;True&lt;/field&gt;
  &lt;field name="type"&gt;ir.actions.server&lt;/field&gt;
  &lt;field name="state"&gt;code&lt;/field&gt;
  &lt;field name="code"&gt;
      lead = self.browse(cr, uid, context['active_id'], context=context)
      mail_message = lead.message_ids[0]
      mail_body = mail_message['body']
      lead_data_dict = self.parse_body(cr, uid, mail_body)
      self.write(cr, uid, context['active_id'], lead_data_dict)
  &lt;/field&gt;
&lt;/record&gt;
</code></pre>

<p>.py</p>

<pre><code>class email_data_parser(osv.osv):
  _name = "email_data_parser"
  _description = "Email Data Parser"

  def parse_body(self, uid, body):
     data_dist = body
     retun data_dist
</code></pre>

<p>So , if any one have any idea please share with me , how can i solve this .</p>