Getting error like these in odoo
<blockquote>
  <p>TypeError: cannot convert dictionary update sequence element #0 to a sequence</p>
</blockquote>

<p>My code</p>

<pre><code>@api.model
def action_purchase_order(self):
    rec= self.env['purchase.order'].create({
        'partner_id' : self.vendors,
        'store_id' : self.store_id,
        'purchase_order_type' : self.order_type,
        'date_order' : self.date_order,
        'product_id' : self.product_id,
        'date_planned' : self.date_order,
        'product_qty' : self.name,
        'brand_id' : self.brand_id,
        'product_id' : self.product_id,
        'part_number': self.part_number,
        'date_planned' : self.date_order,
        'product_qty' : self.quantity_no,

    })

    return rec
</code></pre>

<p>Access through button..</p>

<p>use <code>@api.multi</code> decorator for buttons actions, <code>api.model</code> is used when you only care about the model and not the field values it contains</p>

<pre><code>@api.multi
def action_purchase_order(self):
    rec= self.env['purchase.order'].create({
        'partner_id' : self.vendors,
        'store_id' : self.store_id,
        'purchase_order_type' : self.order_type,
        'date_order' : self.date_order,
        'product_id' : self.product_id,
        'date_planned' : self.date_order,
        'product_qty' : self.name,
        'brand_id' : self.brand_id,
        'part_number': self.part_number,

    })

    return rec
</code></pre>

<p>from the <a href="https://www.odoo.com/documentation/8.0/reference/orm.html#module-openerp.api" rel="nofollow">docs</a></p>

<blockquote>
  <p>openerp.api.multi(method)</p>
  
  <p>Decorate a record-style method where self is a recordset. The method
  typically defines an operation on records.</p>
  
  <p>openerp.api.model(method)</p>
  
  <p>Decorate a record-style method where self is a recordset, but its
  contents is not relevant, only the model is.</p>
</blockquote>

python openerp odoo-9