Hi,
If you need to get purchase order and sales order from account.move model ( invoic), you can use below link
self.line_ids[0].sale_line_ids.order_id.id
that will gives you the sale order id and using that
self.env['sale.order'].browse(sales_order_id).get_purchase_order()
then the method is
if hasattr(self, 'order_line') and self.order_line:
purchase_line_ids = getattr(self.order_line, 'purchase_line_ids', [])
if purchase_line_ids and purchase_line_ids[0]:
purchase_order = purchase_line_ids[0].order_id
if purchase_order:
return purchase_order
return ''