'Some shippers require identical packages in the same shipment. This utility checks it.'

@api.multi
def check_packages_are_identical(self):

    self.ensure_one()
    if self.package_ids:
        packages = [p.packaging_id for p in self.package_ids]
        if (len(set(packages)) != 1):
            package_names = ',    '.join([str(p.name) for p in packages])
            raise UserError(_(('You    are    shipping    different    packaging    types    in    the    same    shipment.\nPackaging    Types:    %s' % package_names)))
    return True
