In a SO without customer: Before this commit, the _product_margin wasn't working. This because, as the customer is not defined, the pricelist isn't defined either, and therefore currency of the pricelist is also undefined. When you call the round function, in an undefined currency an error is raised. Now we take into account if customer is defined. closes odoo/odoo#30675