Hello azlam
Hope you are doing well.
For 'Purchase Discount for All Items'.
- I put one custom field 'discount' integer.
- So, Whenever we will add any amount in purchase order's 'discount' fields, It will update amount_untaxed, amount_tax and amount_total accordingly.
Code : 
class PurchaseOrder(models.Model):
    _inherit = 'purchase.order'
    discount_total = fields.Float(string='Discount Value')
    @api.depends('discount_value', 'discount_type', 'discount_total', 'order_line.price_total')
    def _amount_all(self):
        super(PurchaseOrder, self)._amount_all()
        for order in self:
            discount_total = 0.0
            order.update({
                'discount_total': discount_total,
                'amount_untaxed': order.amount_untaxed - discount_total,
                'amount_tax': ((order.amount_untaxed - discount_total) * order.order_line.taxes_id.amount / 100),
                'amount_total' : (order.amount_untaxed - discount_total) + ((order.amount_untaxed - discount_total) * order.order_line.taxes_id.amount / 100),
            })  
Also, We can also change calculations according to our need.
Please reach out to us if any queries.
I Hope this information proves helpful to you.
Thanks & Regards,
Email:   odoo@aktivsoftware.com           
Skype: kalpeshmaheshwari