from odoo import models, fields, api class Approver_PO(models.Model):
_inherit = 'purchase.order'
def get_user_id(self):
return self.env.uid
@api.multi
def button_approve(self, force=False):
self.write({'state': 'purchase'})
self._create_picking()
approver_id = fields.Many2one('res.users','Approved By', default=_get_user_id)
if self.company_id.po_lock == 'lock':
self.write({'state': 'done'})
return {}